Skip to content

Commit

Permalink
Fixes NuclearCraft: NSME
Browse files Browse the repository at this point in the history
Reverted old testing patches this fixes a NoSuchMethodError in NuclearCraft
  • Loading branch information
Hexeption committed Aug 23, 2019
1 parent daa22c7 commit e9bd415
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 72 deletions.
34 changes: 6 additions & 28 deletions patches/net/minecraft/entity/EntityLiving.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@
public boolean canAttackClass(Class <? extends EntityLivingBase > cls)
{
return cls != EntityGhast.class;
@@ -355,7 +381,7 @@
public void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
- compound.setBoolean("CanPickUpLoot", this.canPickUpLoot());
+ compound.setBoolean("CanPickUpLoot", this.thisisatestof());
compound.setBoolean("PersistenceRequired", this.persistenceRequired);
NBTTagList nbttaglist = new NBTTagList();

@@ -447,12 +473,21 @@
{
super.readEntityFromNBT(compound);
Expand All @@ -149,7 +140,7 @@
+ // this.idkwhyreyoudoingthis(compound.getBoolean("CanPickUpLoot"));
+ boolean data = compound.getBoolean("CanPickUpLoot");
+ if (isLevelAtLeast(compound, 1) || data) {
+ this.idkwhyreyoudoingthis(data);
+ this.setCanPickUpLoot(data);
+ }
}

Expand All @@ -162,15 +153,6 @@

if (compound.hasKey("ArmorItems", 9))
{
@@ -577,7 +612,7 @@
super.onLivingUpdate();
this.world.profiler.startSection("looting");

- if (!this.world.isRemote && this.canPickUpLoot() && !this.dead && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this))
+ if (!this.world.isRemote && this.thisisatestof() && !this.dead && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this))
{
for (EntityItem entityitem : this.world.getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().grow(1.0D, 0.0D, 1.0D)))
{
@@ -653,8 +688,14 @@
}
}
Expand Down Expand Up @@ -225,22 +207,18 @@
this.world.profiler.startSection("sensing");
this.senses.clearSensingCache();
this.world.profiler.endSection();
@@ -1190,14 +1237,14 @@
}
}
@@ -1192,12 +1239,12 @@

- public boolean canPickUpLoot()
+ public boolean thisisatestof()
public boolean canPickUpLoot()
{
- return this.canPickUpLoot;
+ return thisisatest;
+ return canPickUpLoot;
}

- public void setCanPickUpLoot(boolean canPickup)
+ public void idkwhyreyoudoingthis(boolean canPickup)
public void setCanPickUpLoot(boolean canPickup)
{
- this.canPickUpLoot = canPickup;
+ thisisatest = canPickup;
+ canPickUpLoot = canPickup;
}

public boolean isNoDespawnRequired()
Expand Down
2 changes: 1 addition & 1 deletion patches/net/minecraft/entity/EntityLivingBase.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<>();
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
+ public boolean collides = true;
+ public boolean thisisatest;
+ public boolean canPickUpLoot;
+ // CraftBukkit end
+
+ // Spigot start
Expand Down
4 changes: 2 additions & 2 deletions patches/net/minecraft/entity/item/EntityItem.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@
+ itemstack.setCount(canHold);
+ // Call legacy event
+ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityIn.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ playerEvent.setCancelled(!entityIn.thisisatest);
+ playerEvent.setCancelled(!entityIn.canPickUpLoot);
+ this.world.getServer().getPluginManager().callEvent(playerEvent);
+ if (playerEvent.isCancelled()) {
+ return;
+ }
+
+ // Call newer event afterwards
+ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((org.bukkit.entity.Player) entityIn.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ entityEvent.setCancelled(!entityIn.thisisatest);
+ entityEvent.setCancelled(!entityIn.canPickUpLoot);
+ this.world.getServer().getPluginManager().callEvent(entityEvent);
+ if (entityEvent.isCancelled()) {
+ return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
}
}
}
@@ -168,7 +175,7 @@
this.setEquipmentBasedOnDifficulty(difficulty);
this.setEnchantmentBasedOnDifficulty(difficulty);
this.setCombatTask();
- this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());
+ this.idkwhyreyoudoingthis(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());

if (this.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty())
{
@@ -221,8 +228,17 @@
double d2 = target.posZ - this.posZ;
double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2);
Expand Down
7 changes: 1 addition & 6 deletions patches/net/minecraft/entity/monster/EntityZombie.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@
this.world.playEvent((EntityPlayer)null, 1026, new BlockPos(this), 0);
}
}
@@ -443,16 +461,16 @@
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
float f = difficulty.getClampedAdditionalDifficulty();
- this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f);
+ this.idkwhyreyoudoingthis(this.rand.nextFloat() < 0.55F * f);
@@ -447,12 +465,12 @@

if (livingdata == null)
{
Expand Down
14 changes: 2 additions & 12 deletions patches/net/minecraft/entity/passive/EntityVillager.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

public EntityVillager(World worldIn)
{
@@ -125,11 +132,11 @@
@@ -125,7 +132,7 @@
public EntityVillager(World worldIn, int professionId)
{
super(worldIn);
Expand All @@ -47,11 +47,6 @@
this.setProfession(professionId);
this.setSize(0.6F, 1.95F);
((PathNavigateGround)this.getNavigator()).setBreakDoors(true);
- this.setCanPickUpLoot(true);
+ this.idkwhyreyoudoingthis(true);
}

protected void initEntityAI()
@@ -186,6 +193,22 @@
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
}
Expand Down Expand Up @@ -91,12 +86,7 @@
}
}

@@ -388,11 +418,11 @@
}
}

- this.setCanPickUpLoot(true);
+ this.idkwhyreyoudoingthis(true);
@@ -392,7 +422,7 @@
this.setAdditionalAItasks();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
}
+
+ this.displayName = this.getName();
+ this.thisisatest = true;
+ this.canPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth();
}

Expand Down
11 changes: 0 additions & 11 deletions patches/net/minecraft/util/EntitySelectors.java.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,11 @@ public EntityEquipment getEquipment() {
}

public void setCanPickupItems(boolean pickup) {
getHandle().thisisatest = pickup;
getHandle().canPickUpLoot = pickup;
}

public boolean getCanPickupItems() {
return getHandle().thisisatest;
return getHandle().canPickUpLoot;
}

@Override
Expand Down

0 comments on commit e9bd415

Please sign in to comment.