Enchantment,EnchantmentHelper,EntityEnderman,EntityZombie,EntityVillager,FurnaceRecipes,RecipeFireworks,RecipeRepairItem,NetworkSystem,S00PacketServerInfo

PotionEffect,StatList,Session,WeightedRandomChestContent,Explosion,ExtendedBlockStorage,SaveHandler.

All NBT patches seem to have been merged upstream, so removing. The IntegratedServer and MinecraftServer pending queue changes also removed, as fixed upstream.
This commit is contained in:
cpw 2015-11-12 22:02:41 -05:00
parent 7258d577cd
commit 8f94ff14ff
39 changed files with 351 additions and 439 deletions

View File

@ -9,3 +9,58 @@
}
else
{
@@ -140,7 +140,7 @@
public boolean canApply(ItemStack stack)
{
- return this.type.canEnchantItem(stack.getItem());
+ return canApplyAtEnchantingTable(stack);
}
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
@@ -151,6 +151,45 @@
{
}
+ /**
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
+ * applies for <i>all possible</i> enchantments.
+ * @param stack
+ * @return
+ */
+ public boolean canApplyAtEnchantingTable(ItemStack stack)
+ {
+ return this.type.canEnchantItem(stack.getItem());
+ }
+
+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1];
+ /**
+ * Add to the list of enchantments applicable by the anvil from a book
+ *
+ * @param enchantment
+ */
+ public static void addToBookList(Enchantment enchantment)
+ {
+ try
+ {
+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null,
+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e); //Rethrow see what happens
+ }
+ }
+
+ /**
+ * Is this enchantment allowed to be enchanted on books via Enchantment Table
+ * @return false to disable the vanilla feature
+ */
+ public boolean isAllowedOnBooks()
+ {
+ return true;
+ }
+
static
{
List<Enchantment> list = Lists.<Enchantment>newArrayList();

View File

@ -0,0 +1,41 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
@@ -297,7 +297,7 @@
public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_)
{
Item item = p_77514_3_.getItem();
- int i = item.getItemEnchantability();
+ int i = item.getItemEnchantability(p_77514_3_);
if (i <= 0)
{
@@ -346,7 +346,7 @@
public static List<EnchantmentData> buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_)
{
Item item = p_77513_1_.getItem();
- int i = item.getItemEnchantability();
+ int i = item.getItemEnchantability(p_77513_1_);
if (i <= 0)
{
@@ -388,7 +388,9 @@
for (EnchantmentData enchantmentdata1 : list)
{
- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue())))
+ Enchantment e1 = enchantmentdata1.enchantmentobj;
+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue());
+ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together
{
flag = false;
break;
@@ -422,7 +424,8 @@
for (Enchantment enchantment : Enchantment.enchantmentsBookList)
{
- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag))
+ if (enchantment == null) continue;
+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks()))
{
for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i)
{

View File

@ -1,6 +1,24 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java
@@ -366,6 +366,18 @@
@@ -200,12 +200,14 @@
protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_)
{
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
double d0 = this.posX;
double d1 = this.posY;
double d2 = this.posZ;
- this.posX = p_70825_1_;
- this.posY = p_70825_3_;
- this.posZ = p_70825_5_;
+ this.posX = event.targetX;
+ this.posY = event.targetY;
+ this.posZ = event.targetZ;
boolean flag = false;
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
@@ -366,6 +368,18 @@
}
}

View File

@ -49,3 +49,12 @@
entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null);
this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
@@ -466,7 +479,7 @@
if (p_180482_2_ == null)
{
- p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F);
+ p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F);
}
if (p_180482_2_ instanceof EntityZombie.GroupData)

View File

@ -17,7 +17,15 @@
{
if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0))
{
@@ -636,6 +637,7 @@
@@ -523,6 +524,7 @@
private void populateBuyingList()
{
+ //TODO: Hook into VillagerRegistry
EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()];
if (this.careerId != 0 && this.careerLevel != 0)
@@ -636,6 +638,7 @@
}
}
@ -25,7 +33,7 @@
if (s1 != null)
{
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]);
@@ -698,7 +700,7 @@
@@ -698,7 +701,7 @@
public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_)
{
p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_);

View File

@ -8,3 +8,13 @@
this.smeltingList.put(input, stack);
this.experienceList.put(stack, Float.valueOf(experience));
}
@@ -102,6 +103,9 @@
public float getSmeltingExperience(ItemStack stack)
{
+ float ret = stack.getItem().getSmeltingExperience(stack);
+ if (ret != -1) return ret;
+
for (Entry<ItemStack, Float> entry : this.experienceList.entrySet())
{
if (this.compareItemStacks(stack, (ItemStack)entry.getKey()))

View File

@ -1,5 +1,27 @@
--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java
+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java
@@ -87,9 +87,9 @@
{
this.field_92102_a = new ItemStack(Items.fireworks);
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
if (l > 0)
{
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
@@ -106,9 +106,9 @@
nbttagcompound3.setTag("Explosions", nbttaglist);
nbttagcompound3.setByte("Flight", (byte)j);
nbttagcompound1.setTag("Fireworks", nbttagcompound3);
- this.field_92102_a.setTagCompound(nbttagcompound1);
}
+ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection
return true;
}
else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1)
@@ -250,11 +250,7 @@
for (int i = 0; i < aitemstack.length; ++i)
{

View File

@ -18,6 +18,15 @@
{
return null;
}
@@ -67,7 +67,7 @@
ItemStack itemstack2 = (ItemStack)list.get(0);
ItemStack itemstack3 = (ItemStack)list.get(1);
- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable())
+ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable())
{
Item item = itemstack2.getItem();
int j = item.getMaxDamage() - itemstack2.getItemDamage();
@@ -104,11 +104,7 @@
for (int i = 0; i < aitemstack.length; ++i)
{

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java
+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java
@@ -120,7 +120,7 @@
;
}
- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND)));
+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND)));
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager);

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java
+++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java
@@ -35,7 +35,7 @@
public void writePacketData(PacketBuffer buf) throws IOException
{
- buf.writeString(GSON.toJson((Object)this.response));
+ buf.writeString(this.response.getJson());
}
public void processPacket(INetHandlerStatusClient handler)

View File

@ -26,6 +26,15 @@
}
public void combine(PotionEffect other)
@@ -191,7 +196,7 @@
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
- int i = nbt.getByte("Id");
+ int i = nbt.getByte("Id") & 0xff;
if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null)
{
@@ -224,4 +229,62 @@
{
return this.isPotionDurationMax;

View File

@ -9,6 +9,20 @@
String s = func_180204_a(item);
if (s != null)
@@ -127,11 +127,11 @@
{
for (Block block : Block.blockRegistry)
{
- Item item = Item.getItemFromBlock(block);
+ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these
if (item != null)
{
- int i = Block.getIdFromBlock(block);
+ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these
String s = func_180204_a(item);
if (s != null && block.getEnableStats())
@@ -151,7 +151,7 @@
{
if (item != null)

View File

@ -25,7 +25,23 @@
this.username = usernameIn;
this.playerID = playerIDIn;
this.token = tokenIn;
@@ -63,6 +78,19 @@
@@ -50,11 +65,13 @@
try
{
UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID());
- return new GameProfile(uuid, this.getUsername());
+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile.
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
+ return ret; // which helps to fix MC-52974.
}
catch (IllegalArgumentException var2)
{
- return new GameProfile((UUID)null, this.getUsername());
+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername());
}
}
@@ -63,6 +80,19 @@
return this.sessionType;
}

View File

@ -1,6 +1,28 @@
--- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java
+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java
@@ -57,6 +57,19 @@
@@ -37,48 +37,39 @@
for (int i = 0; i < p_177630_3_; ++i)
{
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_);
- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_);
- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j)
+ for (ItemStack itemstack1 : stacks)
{
- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
- itemstack1.stackSize = j;
p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1);
}
- else
- {
- for (int k = 0; k < j; ++k)
- {
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = 1;
- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack);
- }
- }
}
}
@ -20,3 +42,27 @@
public static void generateDispenserContents(Random random, List<WeightedRandomChestContent> p_177631_1_, TileEntityDispenser dispenser, int p_177631_3_)
{
for (int i = 0; i < p_177631_3_; ++i)
{
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_);
- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser);
- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j)
+ for (ItemStack itemstack1 : stacks)
{
- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
- itemstack1.stackSize = j;
dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1);
}
- else
- {
- for (int k = 0; k < j; ++k)
- {
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = 1;
- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack);
- }
- }
}
}

View File

@ -25,7 +25,15 @@
f -= (f2 + 0.3F) * 0.3F;
}
@@ -214,8 +216,7 @@
@@ -127,6 +129,7 @@
int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D);
int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D);
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1));
+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3);
Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ);
for (int k2 = 0; k2 < list.size(); ++k2)
@@ -214,8 +217,7 @@
block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0);
}
@ -35,7 +43,7 @@
}
}
}
@@ -251,4 +252,6 @@
@@ -251,4 +253,6 @@
{
return this.affectedBlockPositions;
}

View File

@ -1,10 +1,11 @@
++++ REJECTED PATCH 1
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java
@@ -35,6 +35,8 @@
public void set(int x, int y, int z, IBlockState state)
{
+ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState)
+ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean();
IBlockState iblockstate1 = this.get(x, y, z);
Block block = iblockstate1.getBlock();
IBlockState iblockstate = this.get(x, y, z);
Block block = iblockstate.getBlock();
Block block1 = state.getBlock();
++++ END PATCH

View File

@ -1,15 +1,48 @@
--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java
+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java
@@ -144,6 +144,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("Data", nbttagcompound);
@@ -105,13 +105,17 @@
{
File file1 = new File(this.worldDirectory, "level.dat");
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2);
+ WorldInfo worldInfo = null;
+
try
if (file1.exists())
{
File file1 = new File(this.worldDirectory, "level.dat_new");
@@ -182,6 +184,8 @@
try
{
NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1));
NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data");
- return new WorldInfo(nbttagcompound3);
+ worldInfo = new WorldInfo(nbttagcompound3);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2);
+ return worldInfo;
}
catch (Exception exception1)
{
@@ -119,6 +123,7 @@
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this);
file1 = new File(this.worldDirectory, "level.dat_old");
if (file1.exists())
@@ -127,7 +132,13 @@
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
- return new WorldInfo(nbttagcompound1);
+ worldInfo = new WorldInfo(nbttagcompound1);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo;
+ }
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e)
+ {
+ throw e;
}
catch (Exception exception)
{
@@ -144,6 +155,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("Data", nbttagcompound);
@ -18,7 +51,16 @@
try
{
File file1 = new File(this.worldDirectory, "level.dat_new");
@@ -230,6 +234,7 @@
@@ -182,6 +195,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("Data", nbttagcompound);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1);
+
try
{
File file1 = new File(this.worldDirectory, "level.dat_new");
@@ -230,6 +245,7 @@
}
file1.renameTo(file2);
@ -26,7 +68,7 @@
}
catch (Exception var5)
{
@@ -260,6 +265,7 @@
@@ -260,6 +276,7 @@
p_75752_1_.readFromNBT(nbttagcompound);
}
@ -34,7 +76,7 @@
return nbttagcompound;
}
@@ -301,4 +307,22 @@
@@ -301,4 +318,22 @@
{
return this.saveDirectoryName;
}

View File

@ -1,55 +0,0 @@
++++ REJECTED PATCH 2
public boolean canApply(ItemStack stack)
{
- return this.type.canEnchantItem(stack.getItem());
+ return canApplyAtEnchantingTable(stack);
}
public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {}
public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {}
+ /**
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
+ * applies for <i>all possible</i> enchantments.
+ * @param stack
+ * @return
+ */
+ public boolean canApplyAtEnchantingTable(ItemStack stack)
+ {
+ return this.type.canEnchantItem(stack.getItem());
+ }
+
+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1];
+ /**
+ * Add to the list of enchantments applicable by the anvil from a book
+ *
+ * @param enchantment
+ */
+ public static void addToBookList(Enchantment enchantment)
+ {
+ try
+ {
+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null,
+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e); //Rethrow see what happens
+ }
+ }
+
+ /**
+ * Is this enchantment allowed to be enchanted on books via Enchantment Table
+ * @return false to disable the vanilla feature
+ */
+ public boolean isAllowedOnBooks()
+ {
+ return true;
+ }
+
static
{
ArrayList var0 = Lists.newArrayList();
++++ END PATCH

View File

@ -1,43 +0,0 @@
++++ REJECTED PATCH 1
public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_)
{
Item item = p_77514_3_.getItem();
- int k = item.getItemEnchantability();
+ int k = item.getItemEnchantability(p_77514_3_);
if (k <= 0)
{
++++ END PATCH
++++ REJECTED PATCH 2
public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_)
{
Item item = p_77513_1_.getItem();
- int j = item.getItemEnchantability();
+ int j = item.getItemEnchantability(p_77513_1_);
if (j <= 0)
{
++++ END PATCH
++++ REJECTED PATCH 3
{
EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next();
- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue())))
+ Enchantment e1 = enchantmentdata1.enchantmentobj;
+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue());
+ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together
{
continue;
}
++++ END PATCH
++++ REJECTED PATCH 4
{
Enchantment enchantment = aenchantment[k];
- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag))
+ if (enchantment == null) continue;
+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks()))
{
for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l)
{
++++ END PATCH

View File

@ -1,19 +0,0 @@
++++ REJECTED PATCH 1
protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_)
{
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
double d3 = this.posX;
double d4 = this.posY;
double d5 = this.posZ;
- this.posX = p_70825_1_;
- this.posY = p_70825_3_;
- this.posZ = p_70825_5_;
+ this.posX = event.targetX;
+ this.posY = event.targetY;
+ this.posZ = event.targetZ;
boolean flag = false;
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 4
if (p_180482_2_1 == null)
{
- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null);
+ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null);
}
if (p_180482_2_1 instanceof EntityZombie.GroupData)
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 3
private void populateBuyingList()
{
+ //TODO: Hook into VillagerRegistry
EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()];
if (this.careerId != 0 && this.careerLevel != 0)
++++ END PATCH

View File

@ -1,11 +0,0 @@
++++ REJECTED PATCH 2
public float getSmeltingExperience(ItemStack stack)
{
+ float ret = stack.getItem().getSmeltingExperience(stack);
+ if (ret != -1) return ret;
+
Iterator iterator = this.experienceList.entrySet().iterator();
Entry entry;
++++ END PATCH

View File

@ -1,23 +0,0 @@
++++ REJECTED PATCH 1
{
this.field_92102_a = new ItemStack(Items.fireworks);
+ nbttagcompound = new NBTTagCompound();
if (l > 0)
{
- nbttagcompound = new NBTTagCompound();
nbttagcompound1 = new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
++++ END PATCH
++++ REJECTED PATCH 2
nbttagcompound1.setTag("Explosions", nbttaglist);
nbttagcompound1.setByte("Flight", (byte)j);
nbttagcompound.setTag("Fireworks", nbttagcompound1);
- this.field_92102_a.setTagCompound(nbttagcompound);
}
+ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection
return true;
}
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 3
ItemStack itemstack2 = (ItemStack)arraylist.get(0);
itemstack = (ItemStack)arraylist.get(1);
- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable())
+ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable())
{
Item item = itemstack2.getItem();
int j = item.getMaxDamage() - itemstack2.getItemDamage();
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
{
+ sizeTracker.read(32); //Forge: Count the length as well
int j = input.readInt();
sizeTracker.read((long)(8 * j));
this.data = new byte[j];
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
while ((b0 = readType(input, sizeTracker)) != 0)
{
String s = readKey(input, sizeTracker);
- sizeTracker.read((long)(16 * s.length()));
+ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header.
NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker);
this.tagMap.put(s, nbtbase);
}
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
{
+ sizeTracker.read(32); //Forge: Count the length as well
int j = input.readInt();
sizeTracker.read((long)(32 * j));
this.intArray = new int[j];
++++ END PATCH

View File

@ -1,15 +0,0 @@
++++ REJECTED PATCH 1
{
sizeTracker.read(8L);
this.tagType = input.readByte();
+ sizeTracker.read(32); //Forge: Count the length as well
int j = input.readInt();
this.tagList = Lists.newArrayList();
for (int k = 0; k < j; ++k)
{
+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation.
NBTBase nbtbase = NBTBase.createNewByType(this.tagType);
nbtbase.read(input, depth + 1, sizeTracker);
this.tagList.add(nbtbase);
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
;
}
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND));
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
public void writePacketData(PacketBuffer buf) throws IOException
{
- buf.writeString(GSON.toJson(this.response));
+ buf.writeString(this.response.getJson());
}
public void processPacket(INetHandlerStatusClient handler)
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 4
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
- byte b0 = nbt.getByte("Id");
+ int b0 = nbt.getByte("Id") & 0xff;
if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null)
{
++++ END PATCH

View File

@ -1,11 +0,0 @@
// do we still need this?
++++ REJECTED PATCH 16
{
try
{
- ((FutureTask)this.futureTaskQueue.poll()).run();
+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll()));
}
catch (Throwable throwable2)
{
++++ END PATCH

View File

@ -1,11 +0,0 @@
// This in now a method in Util, which does almost the same, do we need this still?
++++ REJECTED PATCH 4
{
try
{
- ((FutureTask)this.futureTaskQueue.poll()).run();
+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll()));
}
catch (Throwable throwable)
{
++++ END PATCH

View File

@ -1,15 +0,0 @@
++++ REJECTED PATCH 2
while (iterator.hasNext())
{
Block block = (Block)iterator.next();
- Item item = Item.getItemFromBlock(block);
+ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these
if (item != null)
{
- int i = Block.getIdFromBlock(block);
+ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these
String s = func_180204_a(item);
if (s != null && block.getEnableStats())
++++ END PATCH

View File

@ -1,17 +0,0 @@
++++ REJECTED PATCH 2
try
{
UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID());
- return new GameProfile(uuid, this.getUsername());
+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile.
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
+ return ret; // which helps to fix MC-52974.
}
catch (IllegalArgumentException illegalargumentexception)
{
- return new GameProfile((UUID)null, this.getUsername());
+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername());
}
}
++++ END PATCH

View File

@ -1,54 +0,0 @@
++++ REJECTED PATCH 1
for (int j = 0; j < p_177630_3_; ++j)
{
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_);
- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_);
- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k)
+ for (ItemStack itemstack : stacks)
{
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = k;
p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack);
}
- else
- {
- for (int l = 0; l < k; ++l)
- {
- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
- itemstack1.stackSize = 1;
- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1);
- }
- }
}
}
++++ END PATCH
++++ REJECTED PATCH 2
for (int j = 0; j < p_177631_3_; ++j)
{
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_);
- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser);
- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k)
+ for (ItemStack itemstack : stacks)
{
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = k;
dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack);
}
- else
- {
- for (int l = 0; l < k; ++l)
- {
- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
- itemstack1.stackSize = 1;
- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1);
- }
- }
}
}
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 4
int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D);
int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D);
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1));
+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3);
Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ);
for (int l1 = 0; l1 < list.size(); ++l1)
++++ END PATCH

View File

@ -1,48 +0,0 @@
++++ REJECTED PATCH 1
NBTTagCompound nbttagcompound;
NBTTagCompound nbttagcompound1;
+ WorldInfo worldInfo = null;
+
if (file1.exists())
{
try
{
nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
- return new WorldInfo(nbttagcompound1);
+ worldInfo = new WorldInfo(nbttagcompound1);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo;
}
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e)
+ {
+ throw e;
+ }
catch (Exception exception1)
{
exception1.printStackTrace();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this);
file1 = new File(this.worldDirectory, "level.dat_old");
if (file1.exists())
++++ END PATCH
++++ REJECTED PATCH 2
{
nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1));
nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
- return new WorldInfo(nbttagcompound1);
+ worldInfo = new WorldInfo(nbttagcompound1);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo;
+ }
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e)
+ {
+ throw e;
}
catch (Exception exception)
{
++++ END PATCH