Merge branch 'mithionchanges'

This commit is contained in:
Christian 2013-03-23 16:57:03 -04:00
commit 8e1c8f25f3
12 changed files with 411 additions and 38 deletions

View File

@ -41,6 +41,8 @@ protected ri.* #FD:EntityMinecart/* # All private -> protected
# Block
public apa.<init>(ILaif;)V #MD:Block/<init>(ILnet/minecraft/src/Material;) #Constructor
public apa.<init>(IILaif;)V #MD:Block/<init>(IILnet/minecraft/src/Material;) #Constructor
public apa.cB #FD:Block/field_72029_cc #blockResistance
public apa.cA #FD:Block/field_71989_cb #blockHardness
# -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify
public apa.a(Lape;)Lapa; #MD:Block/func_71884_a #setStepSound
public apa.b(F)Lapa; #MD:Block/func_71894_b #setResistance
@ -60,6 +62,7 @@ public api.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel
public wk.<init>(I)V #MD:Item/<init>(I) #Constructor
public wk.e(I)Lwk; #MD:Item/func_77656_e #setMaxDamage
public-f wk.h(Lwm;)Llx; #MD:Item/func_77650_f #getIconIndex
public wk.c(Ljava/lang/String;)Lwk; #MD:Item/func_77631_c #setPotionEffect
# RailLogic
public alc #CL:BlockBaseRailLogic
public alc.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles
@ -93,6 +96,7 @@ public-f aab.A #FD:World/field_72982_D #villageCollectionObj
public aab.G #FD:World/field_72993_I #activeChunkSet
# EntityLiving
public ng.be #FD:EntityLiving/field_70728_aV #experienceValue
public ng.bp #FD:EntityLiving/field_70715_bh #targetTasks
# GuiFlatPresets
public axm.a(Ljava/lang/String;ILaav;Ljava/util/List;[Laei;)V #MD:GuiFlatPresets/func_82294_a
public axm.a(Ljava/lang/String;ILaav;[Laei;)V #MD:GuiFlatPresets/func_82297_a
@ -135,4 +139,10 @@ public bis.a #FD:TextureMap/field_94255_a
public bis.b #FD:TextureMap/field_94253_b
public bis.c #FD:TextureMap/field_94254_c
public bis.d #FD:TextureMap/field_94251_d
#Potion
public mk.b(II)Lmk; #MD:ItemPotion/func_76399_b #setIconIndex
#PotionHelper
public xu.m #FD:PotionHelper/field_77927_l #potionRequirements
public xu.n #FD:PotionHelper/field_77928_m #potionAmplifiers
#PotionEffect
public ml.b #FD:PotionEffect/field_76460_b #duration

View File

@ -0,0 +1,37 @@
package net.minecraftforge.common;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
/**
* Allows for custom entity data and logic to be hooked to existing entity classes.
*
* @author cpw, mithion
*
*/
public interface IExtendedEntityProperties {
/**
* Called when the entity that this class is attached to is saved.
* Any custom entity data that needs saving should be saved here.
* @param compound The compound to save to.
*/
public void saveNBTData(NBTTagCompound compound);
/**
* Called when the entity that this class is attached to is loaded.
* In order to hook into this, you will need to subscribe to the EntityConstructing event.
* Otherwise, you will need to initialize manually.
* @param compound The compound to load from.
*/
public void loadNBTData(NBTTagCompound compound);
/**
* Used to initialize the extended properties with the entity that this is attached to, as well
* as the world object.
* Called automatically if you register with the EntityConstructing event.
* @param entity The entity that this extended properties is attached to
* @param world The world in which the entity exists
*/
public void init(Entity entity, World world);
}

View File

@ -0,0 +1,16 @@
package net.minecraftforge.event.brewing;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.Event;
public class PotionBrewedEvent extends Event
{
/**
* The brewing stacks in the brewing stand. Each index has the possibility to be null, so make sure you check.
*/
public ItemStack[] brewingStacks;
public PotionBrewedEvent(ItemStack[] brewingStacks)
{
this.brewingStacks = brewingStacks;
}
}

View File

@ -1,6 +1,7 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.event.Event;
public class EntityEvent extends Event
@ -12,6 +13,14 @@ public class EntityEvent extends Event
this.entity = entity;
}
public static class EntityConstructing extends EntityEvent
{
public EntityConstructing(Entity entity)
{
super(entity);
}
}
public static class CanUpdate extends EntityEvent
{
public boolean canUpdate = false;

View File

@ -0,0 +1,29 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLiving;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
/**
* Event for when an Enderman teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
* @author Mithion
*
*/
@Cancelable
public class EnderTeleportEvent extends LivingEvent
{
public double targetX;
public double targetY;
public double targetZ;
public int attackDamage;
public EnderTeleportEvent(EntityLiving entity, double targetX, double targetY, double targetZ, int attackDamage)
{
super(entity);
this.targetX = targetX;
this.targetY = targetY;
this.targetZ = targetZ;
this.attackDamage = attackDamage;
}
}

View File

@ -0,0 +1,22 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.Cancelable;
/**
* Occurs when a player falls, but is able to fly. Doesn't need to be cancelable, this is mainly for notification purposes.
* @author Mithion
*
*/
public class PlayerFlyableFallEvent extends PlayerEvent
{
public float distance;
public PlayerFlyableFallEvent(EntityPlayer player, float f)
{
super(player);
this.distance = f;
}
}

View File

@ -1,14 +1,17 @@
--- ../src_base/minecraft/net/minecraft/entity/Entity.java
+++ ../src_work/minecraft/net/minecraft/entity/Entity.java
@@ -2,6 +2,7 @@
@@ -1,7 +1,10 @@
package net.minecraft.entity;
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.UUID;
@@ -13,8 +14,13 @@
@@ -13,8 +16,13 @@
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.enchantment.EnchantmentProtection;
import net.minecraft.entity.effect.EntityLightningBolt;
@ -22,7 +25,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
@@ -25,6 +31,7 @@
@@ -25,12 +33,16 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
@ -30,7 +33,16 @@
import net.minecraft.util.ReportedException;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
@@ -225,6 +232,11 @@
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
+import net.minecraftforge.common.IExtendedEntityProperties;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.EntityEvent;
public abstract class Entity
{
@@ -225,6 +237,13 @@
private boolean invulnerable;
private UUID entityUniqueID;
public EnumEntitySize myEntitySize;
@ -39,10 +51,27 @@
+ public boolean captureDrops = false;
+ public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
+ private UUID persistentID;
+
+ private HashMap<String, IExtendedEntityProperties> extendedProperties;
public Entity(World par1World)
{
@@ -554,7 +566,7 @@
@@ -274,6 +293,14 @@
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300));
this.entityInit();
+
+ extendedProperties = new HashMap<String, IExtendedEntityProperties>();
+
+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));
+
+ for (IExtendedEntityProperties props : this.extendedProperties.values()){
+ props.init(this, par1World);
+ }
}
protected abstract void entityInit();
@@ -554,7 +581,7 @@
if (!this.worldObj.isRemote)
{
this.setFlag(0, this.fire > 0);
@ -51,7 +80,7 @@
}
this.firstUpdate = false;
@@ -1534,6 +1546,10 @@
@@ -1534,6 +1561,21 @@
par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
@ -59,10 +88,21 @@
+ {
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
+ }
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
+ props.saveNBTData(par1NBTTagCompound);
+ }catch (Throwable t){
+ FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier);
+ t.printStackTrace();
+ }
+ }
+
this.writeEntityToNBT(par1NBTTagCompound);
if (this.ridingEntity != null)
@@ -1604,6 +1620,15 @@
@@ -1604,6 +1646,26 @@
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
@ -70,6 +110,17 @@
+ {
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
+ props.loadNBTData(par1NBTTagCompound);
+ }catch (Throwable t){
+ FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier);
+ t.printStackTrace();
+ }
+ }
+
+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly
+ if (par1NBTTagCompound.hasKey("PersistentIDMSB") && par1NBTTagCompound.hasKey("PersistentIDLSB"))
+ {
@ -78,7 +129,7 @@
this.readEntityFromNBT(par1NBTTagCompound);
}
catch (Throwable throwable)
@@ -1698,7 +1723,14 @@
@@ -1698,7 +1760,14 @@
{
EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
entityitem.delayBeforeCanPickup = 10;
@ -94,7 +145,7 @@
return entityitem;
}
@@ -2056,7 +2088,7 @@
@@ -2056,7 +2125,7 @@
*/
public boolean isRiding()
{
@ -103,7 +154,7 @@
}
/**
@@ -2400,7 +2432,7 @@
@@ -2400,7 +2469,7 @@
public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block)
{
@ -112,7 +163,7 @@
}
public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7)
@@ -2455,4 +2487,100 @@
@@ -2455,4 +2524,139 @@
{
return this.getEntityName();
}
@ -211,5 +262,44 @@
+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount)
+ {
+ return type.getCreatureClass().isAssignableFrom(this.getClass());
+ }
+
+ /**
+ * Register the instance of IExtendedProperties into the entity's collection.
+ * @param identifier The identifier which you can use to retrieve these properties for the entity.
+ * @param properties The instanceof IExtendedProperties to register
+ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique.
+ */
+ public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties){
+ if (identifier == null){
+ FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability.");
+ return "";
+ }
+ if (properties == null){
+ FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability.");
+ return "";
+ }
+
+ String baseIdentifier = identifier;
+ int identifierModCount = 1;
+ while (this.extendedProperties.containsKey(identifier)){
+ identifier = String.format("%s%d", baseIdentifier, identifierModCount);
+ }
+
+ if (baseIdentifier != identifier){
+ FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
+ }
+
+ this.extendedProperties.put(identifier, properties);
+ return identifier;
+ }
+
+ /**
+ * Gets the extended properties identified by the passed in key
+ * @param identifier The key that identifies the extended properties.
+ * @return The instance of IExtendedProperties that was found, or null.
+ */
+ public IExtendedEntityProperties getExtendedProperties(String identifier){
+ return this.extendedProperties.get(identifier);
+ }
}

View File

@ -0,0 +1,28 @@
--- ../src_base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java
+++ ../src_work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java
@@ -8,6 +8,8 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.EnderTeleportEvent;
public class EntityEnderPearl extends EntityThrowable
{
@@ -50,9 +52,13 @@
if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj)
{
- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ);
- this.getThrower().fallDistance = 0.0F;
- this.getThrower().attackEntityFrom(DamageSource.fall, 5);
+ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ);
+ if (!MinecraftForge.EVENT_BUS.post(event)){
+ this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
+ this.getThrower().fallDistance = 0.0F;
+ this.getThrower().attackEntityFrom(DamageSource.fall, 5);
+ }
+
}
}

View File

@ -0,0 +1,50 @@
--- ../src_base/minecraft/net/minecraft/entity/monster/EntityEnderman.java
+++ ../src_work/minecraft/net/minecraft/entity/monster/EntityEnderman.java
@@ -11,6 +11,8 @@
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.EnderTeleportEvent;
public class EntityEnderman extends EntityMob
{
@@ -264,12 +266,17 @@
*/
protected boolean teleportTo(double par1, double par3, double par5)
{
+ EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5);
+ if (MinecraftForge.EVENT_BUS.post(event)){
+ return false;
+ }
+
double d3 = this.posX;
double d4 = this.posY;
double d5 = this.posZ;
- this.posX = par1;
- this.posY = par3;
- this.posZ = par5;
+ this.posX = event.targetX;
+ this.posY = event.targetY;
+ this.posZ = event.targetZ;
boolean flag = false;
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY);
@@ -296,7 +303,7 @@
}
if (flag1)
- {
+ {
this.setPosition(this.posX, this.posY, this.posZ);
if (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox))
@@ -439,7 +446,7 @@
}
}
- return false;
+ return super.attackEntityFrom(par1DamageSource, par2);
}
else
{

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayer.java
+++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayer.java
@@ -66,8 +66,21 @@
@@ -66,8 +66,22 @@
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
@ -13,6 +13,7 @@
+import net.minecraftforge.event.entity.player.EntityInteractEvent;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
+import net.minecraftforge.event.entity.player.PlayerDropsEvent;
+import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
+
public abstract class EntityPlayer extends EntityLiving implements ICommandSender
@ -22,7 +23,7 @@
/** Inventory of the player */
public InventoryPlayer inventory = new InventoryPlayer(this);
private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest();
@@ -268,6 +281,7 @@
@@ -268,6 +282,7 @@
if (itemstack == this.itemInUse)
{
@ -30,7 +31,7 @@
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{
this.updateItemUse(itemstack, 5);
@@ -528,11 +542,11 @@
@@ -528,11 +543,11 @@
this.cameraYaw = 0.0F;
this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2);
@ -44,7 +45,7 @@
}
}
@@ -661,6 +675,9 @@
@@ -661,6 +676,9 @@
this.setPosition(this.posX, this.posY, this.posZ);
this.motionY = 0.10000000149011612D;
@ -54,7 +55,7 @@
if (this.username.equals("Notch"))
{
this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true);
@@ -669,6 +686,20 @@
@@ -669,6 +687,20 @@
if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
{
this.inventory.dropAllItems();
@ -75,7 +76,7 @@
}
if (par1DamageSource != null)
@@ -719,7 +750,20 @@
@@ -719,7 +751,20 @@
*/
public EntityItem dropOneItem(boolean par1)
{
@ -97,7 +98,7 @@
}
/**
@@ -728,7 +772,7 @@
@@ -728,7 +773,7 @@
*/
public EntityItem dropPlayerItem(ItemStack par1ItemStack)
{
@ -106,7 +107,7 @@
}
/**
@@ -780,15 +824,28 @@
@@ -780,15 +825,28 @@
*/
public void joinEntityItemWithWorld(EntityItem par1EntityItem)
{
@ -137,7 +138,7 @@
if (f > 1.0F)
{
@@ -799,7 +856,9 @@
@@ -799,7 +857,9 @@
{
float f1 = (float)(i * i + 1);
@ -148,7 +149,7 @@
{
f += f1 * 0.08F;
}
@@ -830,7 +889,8 @@
@@ -830,7 +890,8 @@
f /= 5.0F;
}
@ -158,7 +159,7 @@
}
/**
@@ -838,7 +898,7 @@
@@ -838,7 +899,7 @@
*/
public boolean canHarvestBlock(Block par1Block)
{
@ -167,7 +168,7 @@
}
/**
@@ -1096,12 +1156,22 @@
@@ -1096,12 +1157,22 @@
{
if (!this.isEntityInvulnerable())
{
@ -191,7 +192,7 @@
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.addExhaustion(par1DamageSource.getHungerDamage());
int j = this.getHealth();
@@ -1144,6 +1214,10 @@
@@ -1144,6 +1215,10 @@
public boolean interactWith(Entity par1Entity)
{
@ -202,7 +203,7 @@
if (par1Entity.interact(this))
{
return true;
@@ -1187,7 +1261,9 @@
@@ -1187,7 +1262,9 @@
*/
public void destroyCurrentEquippedItem()
{
@ -212,7 +213,7 @@
}
/**
@@ -1204,6 +1280,15 @@
@@ -1204,6 +1281,15 @@
*/
public void attackTargetEntityWithCurrentItem(Entity par1Entity)
{
@ -228,7 +229,7 @@
if (par1Entity.canAttackWithItem())
{
if (!par1Entity.func_85031_j(this))
@@ -1378,6 +1463,12 @@
@@ -1378,6 +1464,12 @@
*/
public EnumStatus sleepInBedAt(int par1, int par2, int par3)
{
@ -241,7 +242,7 @@
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1417,6 +1508,11 @@
@@ -1417,6 +1509,11 @@
{
int l = this.worldObj.getBlockMetadata(par1, par2, par3);
int i1 = BlockBed.getDirection(l);
@ -253,7 +254,7 @@
float f = 0.5F;
float f1 = 0.5F;
@@ -1487,10 +1583,12 @@
@@ -1487,10 +1584,12 @@
ChunkCoordinates chunkcoordinates = this.playerLocation;
ChunkCoordinates chunkcoordinates1 = this.playerLocation;
@ -270,7 +271,7 @@
if (chunkcoordinates1 == null)
{
@@ -1527,7 +1625,9 @@
@@ -1527,7 +1626,9 @@
*/
private boolean isInBed()
{
@ -281,7 +282,7 @@
}
/**
@@ -1542,9 +1642,12 @@
@@ -1542,9 +1643,12 @@
ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
@ -297,7 +298,7 @@
return chunkcoordinates1;
}
else
@@ -1566,10 +1669,13 @@
@@ -1566,10 +1670,13 @@
{
if (this.playerLocation != null)
{
@ -315,7 +316,16 @@
{
case 0:
return 90.0F;
@@ -1876,7 +1982,7 @@
@@ -1834,6 +1941,8 @@
}
super.fall(par1);
+ }else{
+ MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(this, par1));
}
}
@@ -1876,7 +1985,7 @@
{
if (par1ItemStack.getItem().requiresMultipleRenderPasses())
{
@ -324,7 +334,7 @@
}
if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID)
@@ -1898,6 +2004,7 @@
@@ -1898,6 +2007,7 @@
return Item.bow.func_94599_c(0);
}
}
@ -332,7 +342,7 @@
}
return icon;
@@ -2137,6 +2244,14 @@
@@ -2137,6 +2247,14 @@
}
this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest;
@ -347,7 +357,7 @@
}
/**
@@ -2208,7 +2323,14 @@
@@ -2208,7 +2326,14 @@
*/
public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack)
{

View File

@ -0,0 +1,27 @@
--- ../src_base/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java
+++ ../src_work/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java
@@ -2,6 +2,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemPotion;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.AchievementList;
@@ -35,7 +36,7 @@
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
- if (par2ItemStack.itemID == Item.potion.itemID && par2ItemStack.getItemDamage() > 0)
+ if (par2ItemStack.getItem() instanceof ItemPotion && par2ItemStack.getItemDamage() > 0)
{
this.player.addStat(AchievementList.potion, 1);
}
@@ -48,6 +49,6 @@
*/
public static boolean canHoldPotion(ItemStack par0ItemStack)
{
- return par0ItemStack != null && (par0ItemStack.itemID == Item.potion.itemID || par0ItemStack.itemID == Item.glassBottle.itemID);
+ return par0ItemStack != null && (par0ItemStack.getItem() instanceof ItemPotion || par0ItemStack.itemID == Item.glassBottle.itemID);
}
}

View File

@ -1,6 +1,33 @@
--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java
@@ -184,7 +184,7 @@
@@ -11,6 +11,8 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.PotionHelper;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.brewing.PotionBrewedEvent;
public class TileEntityBrewingStand extends TileEntity implements ISidedInventory
{
@@ -122,7 +124,7 @@
for (int i = 0; i < 3; ++i)
{
- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID)
+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.getPotionResult(j, itemstack);
@@ -161,7 +163,7 @@
for (int i = 0; i < 3; ++i)
{
- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID)
+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion)
{
int j = this.brewingItemStacks[i].getItemDamage();
int k = this.getPotionResult(j, itemstack);
@@ -184,7 +186,7 @@
if (Item.itemsList[itemstack.itemID].hasContainerItem())
{
@ -9,3 +36,21 @@
}
else
{
@@ -195,6 +197,8 @@
this.brewingItemStacks[3] = null;
}
}
+
+ MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks));
}
}
@@ -343,7 +347,7 @@
*/
public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack)
{
- return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.itemID == Item.potion.itemID || par2ItemStack.itemID == Item.glassBottle.itemID;
+ return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.getItem() instanceof ItemPotion || par2ItemStack.itemID == Item.glassBottle.itemID;
}
@SideOnly(Side.CLIENT)