Some entity patches.

This commit is contained in:
LexManos 2016-03-01 20:42:36 -08:00
parent 728319cbb5
commit ad788880e5
57 changed files with 697 additions and 751 deletions

View File

@ -188,7 +188,7 @@
}
protected ItemStack createStackedBlock(IBlockState state)
@@ -844,6 +864,1160 @@
@@ -844,6 +864,1180 @@
return "Block{" + blockRegistry.getNameForObject(this) + "}";
}
@ -567,12 +567,13 @@
+ * players to sleep in it, though the block has to specifically
+ * perform the sleeping functionality in it's activated event.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @param player The player or camera entity, null in some cases.
+ * @return True to treat this as a bed
+ */
+ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player)
+ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player)
+ {
+ return this == net.minecraft.init.Blocks.bed;
+ }
@ -581,12 +582,13 @@
+ * Returns the position that the player is moved to upon
+ * waking up, or respawning at the bed.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @param player The player or camera entity, null in some cases.
+ * @return The spawn position
+ */
+ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player)
+ public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player)
+ {
+ if (world instanceof World)
+ return BlockBed.getSafeExitLocation((World)world, pos, 0);
@ -616,13 +618,14 @@
+ * Returns the direction of the block. Same values that
+ * are returned by BlockDirectional
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return Bed direction
+ */
+ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos)
+ public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING);
+ return (EnumFacing)getActualState(state, world, pos).getValue(BlockHorizontal.field_185512_D);
+ }
+
+ /**
@ -990,15 +993,30 @@
+ /**
+ * Determines if this block is can be destroyed by the specified entities normal behavior.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return True to allow the ender dragon to destroy this block
+ */
+ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity)
+ public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity)
+ {
+ if (entity instanceof net.minecraft.entity.boss.EntityDragon)
+ {
+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block;
+ return this != net.minecraft.init.Blocks.barrier &&
+ this != net.minecraft.init.Blocks.obsidian &&
+ this != net.minecraft.init.Blocks.end_stone &&
+ this != net.minecraft.init.Blocks.bedrock &&
+ this != net.minecraft.init.Blocks.end_portal &&
+ this != net.minecraft.init.Blocks.end_portal_frame &&
+ this != net.minecraft.init.Blocks.command_block &&
+ this != net.minecraft.init.Blocks.field_185776_dc &&
+ this != net.minecraft.init.Blocks.field_185777_dd &&
+ this != net.minecraft.init.Blocks.iron_bars &&
+ this != net.minecraft.init.Blocks.field_185775_db;
+ }
+ else if (entity instanceof net.minecraft.entity.boss.EntityWither)
+ {
+ return net.minecraft.entity.boss.EntityWither.func_181033_a(this);
+ }
+
+ return true;
@ -1031,7 +1049,7 @@
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty<?> prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("facing") || prop.getName().equals("rotation"))
+ {
@ -1052,10 +1070,11 @@
+ public EnumFacing[] getValidRotations(World world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty<?> prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class)
+ {
+ @SuppressWarnings("unchecked")
+ java.util.Collection<EnumFacing> values = ((java.util.Collection<EnumFacing>)prop.getAllowedValues());
+ return values.toArray(new EnumFacing[values.size()]);
+ }
@ -1082,10 +1101,11 @@
+ * @param color The color to change to
+ * @return If the recoloring was successful
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
+ {

View File

@ -1,6 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -167,6 +167,12 @@
@@ -162,11 +162,18 @@
if (itemstack1.stackSize == 0)
{
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND);
this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null);
}
}
}
@ -13,3 +19,11 @@
return flag;
}
}
@@ -456,6 +463,7 @@
if (itemstack.stackSize == 0)
{
p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_);
}
}

View File

@ -38,21 +38,3 @@
}
else
{
@@ -362,6 +374,17 @@
this.secondaryColor = p_i47076_3_;
this.field_151512_d = StatList.getStatKillEntity(this);
this.field_151513_e = StatList.getStatEntityKilledBy(this);
+ this.name = EntityList.getStringFromID(id);
}
+
+ public EntityEggInfo(String name, int primaryColor, int secondaryColor)
+ {
+ this.spawnedID = -1;
+ this.name = name;
+ this.primaryColor = primaryColor;
+ this.secondaryColor = secondaryColor;
+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat();
+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat();
+ }
}
}

View File

@ -152,3 +152,56 @@
public abstract EnumHandSide func_184591_cq();
public boolean func_184587_cr()
@@ -2371,6 +2432,14 @@
if (itemstack == this.field_184627_bm)
{
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn <= 0)
+ {
+ this.onItemUseFinish();
+ }
+ else
+ { // Forge Keep unindented to lower patch
+ field_184627_bm.getItem().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added
if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0)
{
this.func_184584_a(this.field_184627_bm, 5);
@@ -2380,6 +2449,7 @@
{
this.onItemUseFinish();
}
+ }
}
else
{
@@ -2394,8 +2464,10 @@
if (itemstack != null && !this.func_184587_cr())
{
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getMaxItemUseDuration());
+ if (duration <= 0) return;
this.field_184627_bm = itemstack;
- this.field_184628_bn = itemstack.getMaxItemUseDuration();
+ this.field_184628_bn = duration;
if (!this.worldObj.isRemote)
{
@@ -2478,6 +2550,8 @@
this.func_184584_a(this.field_184627_bm, 16);
ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this);
+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack);
+
if (itemstack != null && itemstack.stackSize == 0)
{
itemstack = null;
@@ -2508,6 +2582,8 @@
if (this.field_184627_bm != null)
{
this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv());
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv()))
+ this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv());
}
this.func_184602_cy();

View File

@ -1,6 +1,37 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java
@@ -477,6 +477,9 @@
@@ -398,6 +398,14 @@
this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
this.motionZ = this.trackedEntity.motionZ;
+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D);
+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D);
+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D);
+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ)
+ {
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ);
+ }
+
if (flag && !(packet instanceof SPacketSpawnMob))
{
playerMP.playerNetServerHandler.sendPacket(new SPacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ));
@@ -438,6 +446,7 @@
this.trackedEntity.func_184178_b(playerMP);
playerMP.func_184848_d(this.trackedEntity);
+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP);
}
}
else if (this.trackingPlayers.contains(playerMP))
@@ -445,6 +454,7 @@
this.trackingPlayers.remove(playerMP);
this.trackedEntity.func_184203_c(playerMP);
playerMP.removeEntity(this.trackedEntity);
+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP);
}
}
}
@@ -477,6 +487,9 @@
logger.warn("Fetching addPacket for removed entity");
}

View File

@ -1,14 +1,15 @@
++++ REJECTED PATCH 1
private double targetX;
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java
@@ -21,6 +21,8 @@
private double targetY;
private double targetZ;
protected final int field_188493_g = 20;
+ private int failedPathFindingPenalty = 0;
+ private boolean canPenalize = false;
public EntityAIAttackOnCollide(EntityCreature creature, Class <? extends Entity > targetClass, double speedIn, boolean useLongMemory)
public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory)
{
++++ END PATCH
++++ REJECTED PATCH 2
@@ -45,6 +47,19 @@
}
else
{
@ -28,8 +29,7 @@
this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
return this.entityPathEntity != null;
}
++++ END PATCH
++++ REJECTED PATCH 3
@@ -89,6 +104,23 @@
this.targetZ = entitylivingbase.posZ;
this.delayCounter = 4 + this.attacker.getRNG().nextInt(7);
@ -53,4 +53,3 @@
if (d0 > 1024.0D)
{
this.delayCounter += 10;
++++ END PATCH

View File

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java
+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java
@@ -474,13 +474,13 @@
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Block block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.fire)
+ if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.func_185904_a() != Material.fire)
{
if (!this.worldObj.getGameRules().getBoolean("mobGriefing"))
{
flag = true;
}
- else if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame)
+ else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this))
{
if (block != Blocks.command_block && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.iron_bars && block != Blocks.field_185775_db)
{

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java
+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java
@@ -365,7 +365,7 @@
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Block block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() != Material.air && func_181033_a(block))
+ if (!block.isAir(iblockstate, this.worldObj, blockpos))
{
flag = this.worldObj.destroyBlock(blockpos, true) || flag;
}

View File

@ -24,7 +24,7 @@
public void onUpdate()
{
+ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10);
+ ItemStack stack = this.func_184212_Q().func_187225_a(field_184533_c).orNull();
+ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return;
if (this.getEntityItem() == null)
{
@ -34,7 +34,7 @@
this.handleWaterMovement();
- if (!this.worldObj.isRemote && this.age >= 6000)
+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10);
+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull();
+
+ if (!this.worldObj.isRemote && this.age >= lifespan)
{
@ -63,7 +63,7 @@
- {
- this.setDead();
- }
+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10);
+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull();
+ if (item == null || item.stackSize <= 0) this.setDead();
+ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan");
}

View File

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java
@@ -122,6 +122,7 @@
public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true;
this.commandBlockLogic.tryOpenEditCommandBlock(p_184230_1_);
return false;
}

View File

@ -4,7 +4,7 @@
public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_)
{
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true;
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true;
if (!this.worldObj.isRemote)
{
p_184230_1_.displayGUIChest(this);

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java
@@ -19,6 +19,8 @@
public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true;
+
if (p_184230_1_.isSneaking())
{
return false;

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java
@@ -136,6 +136,8 @@
public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true;
+
if (p_184230_2_ != null && p_184230_2_.getItem() == Items.coal && this.fuel + 3600 <= 32000)
{
if (!p_184230_1_.capabilities.isCreativeMode)

View File

@ -4,7 +4,7 @@
public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_)
{
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true;
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true;
if (!this.worldObj.isRemote)
{
p_184230_1_.displayGUIChest(this);

View File

@ -1,6 +1,17 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java
@@ -342,6 +342,18 @@
@@ -259,7 +259,9 @@
private boolean teleportTo(double x, double y, double z)
{
- boolean flag = this.func_184595_k(x, y, z);
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false;
+ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ);
if (flag)
{
@@ -342,6 +344,18 @@
}
}

View File

@ -1,6 +1,53 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java
@@ -279,7 +279,7 @@
@@ -101,7 +101,7 @@
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
this.getEntityAttribute(SharedMonsterAttributes.field_188791_g).setBaseValue(2.0D);
- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D);
+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance);
}
protected void entityInit()
@@ -259,12 +259,24 @@
entitylivingbase = (EntityLivingBase)source.getEntity();
}
- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning"))
+ int i = MathHelper.floor_double(this.posX);
+ int j = MathHelper.floor_double(this.posY);
+ int k = MathHelper.floor_double(this.posZ);
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue());
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true;
+
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW ||
+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning"))
{
- int i = MathHelper.floor_double(this.posX);
- int j = MathHelper.floor_double(this.posY);
- int k = MathHelper.floor_double(this.posZ);
- EntityZombie entityzombie = new EntityZombie(this.worldObj);
+ EntityZombie entityzombie;
+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
+ {
+ entityzombie = summonAid.customSummonedAid;
+ }
+ else
+ {
+ entityzombie = new EntityZombie(this.worldObj);
+ }
for (int l = 0; l < 50; ++l)
{
@@ -272,14 +284,14 @@
int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
- if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10)
+ if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.worldObj, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10)
{
entityzombie.setPosition((double)i1, (double)j1, (double)k1);
if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.func_184144_a(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox()))
{
this.worldObj.spawnEntityInWorld(entityzombie);
@ -9,7 +56,7 @@
entityzombie.onInitialSpawn(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));
@@ -483,7 +483,7 @@
@@ -483,7 +495,7 @@
if (livingdata == null)
{

View File

@ -9,13 +9,30 @@
{
public EntityMooshroom(World worldIn)
{
@@ -78,6 +78,35 @@
@@ -22,6 +22,7 @@
this.spawnableBlock = Blocks.mycelium;
}
+ @SuppressWarnings("unused")
public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_)
{
if (p_184645_3_ != null && p_184645_3_.getItem() == Items.bowl && this.getGrowingAge() >= 0 && !p_184645_1_.capabilities.isCreativeMode)
@@ -37,7 +38,7 @@
return true;
}
- else if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0)
+ else if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared
{
this.setDead();
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
@@ -78,6 +79,35 @@
return new EntityMooshroom(this.worldObj);
}
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; }
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return getGrowingAge() >= 0; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune)
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune)
+ {
+ this.setDead();
+ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
@ -38,7 +55,7 @@
+ ret.add(new ItemStack(Blocks.red_mushroom));
+ }
+
+ this.playSound("mob.sheep.shear", 1.0F, 1.0F);
+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F);
+ return ret;
+ }
+

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java
@@ -285,7 +285,7 @@
IBlockState iblockstate = this.worldObj.getBlockState(blockpos.down());
Block block = iblockstate.getBlock();
- if (block == Blocks.grass || iblockstate.func_185904_a() == Material.leaves)
+ if (block == Blocks.grass || block.isLeaves(iblockstate, this.worldObj, blockpos.down()))
{
return true;
}

View File

@ -9,7 +9,19 @@
{
private static final DataParameter<Byte> field_184774_bv = EntityDataManager.<Byte>func_187226_a(EntitySheep.class, DataSerializers.field_187191_a);
private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container()
@@ -356,4 +356,19 @@
@@ -171,9 +171,10 @@
}
}
+ @SuppressWarnings("unused")
public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_)
{
- if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild())
+ if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared
{
if (!this.worldObj.isRemote)
{
@@ -356,4 +357,19 @@
DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F});
DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F});
}
@ -25,7 +37,7 @@
+ for (int j = 0; j < i; ++j)
+ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()));
+
+ this.playSound("mob.sheep.shear", 1.0F, 1.0F);
+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F);
+ return ret;
+ }
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,18 @@
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java
@@ -174,6 +174,7 @@
@@ -93,6 +93,11 @@
@SuppressWarnings("incomplete-switch")
public abstract class EntityPlayer extends EntityLivingBase
{
+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
+ private java.util.HashMap<Integer, BlockPos> spawnChunkMap = new java.util.HashMap<Integer, BlockPos>();
+ private java.util.HashMap<Integer, Boolean> spawnForcedMap = new java.util.HashMap<Integer, Boolean>();
+ public float eyeHeight = this.getDefaultEyeHeight();
+
private static final DataParameter<Float> field_184829_a = EntityDataManager.<Float>func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c);
private static final DataParameter<Integer> field_184830_b = EntityDataManager.<Integer>func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b);
protected static final DataParameter<Byte> field_184827_bp = EntityDataManager.<Byte>func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a);
@@ -174,6 +179,7 @@
public void onUpdate()
{
@ -8,15 +20,7 @@
this.noClip = this.isSpectator();
if (this.isSpectator())
@@ -205,6 +206,7 @@
{
this.wakeUpPlayer(false, true, true);
}
+ }
}
}
else if (this.sleepTimer > 0)
@@ -219,7 +221,7 @@
@@ -219,7 +225,7 @@
super.onUpdate();
@ -25,7 +29,7 @@
{
this.closeScreen();
this.openContainer = this.inventoryContainer;
@@ -360,6 +362,7 @@
@@ -360,6 +366,7 @@
this.setSize(f, f1);
}
}
@ -33,7 +37,21 @@
}
public int getMaxInPortalTime()
@@ -576,11 +579,15 @@
@@ -442,11 +449,11 @@
this.cameraYaw = 0.0F;
this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2);
- if (this.func_184187_bx() instanceof EntityPig)
+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this))
{
this.rotationPitch = f1;
this.rotationYaw = f;
- this.renderYawOffset = ((EntityPig)this.func_184187_bx()).renderYawOffset;
+ this.renderYawOffset = ((EntityLivingBase)this.func_184187_bx()).renderYawOffset;
}
}
}
@@ -576,11 +583,15 @@
public void onDeath(DamageSource cause)
{
@ -49,7 +67,7 @@
if (this.getName().equals("Notch"))
{
this.dropItem(new ItemStack(Items.apple, 1), true, false);
@@ -591,6 +598,9 @@
@@ -591,6 +602,9 @@
this.inventory.dropAllItems();
}
@ -59,7 +77,7 @@
if (cause != null)
{
this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 0.017453292F) * 0.1F);
@@ -678,12 +688,25 @@
@@ -678,12 +692,25 @@
public EntityItem dropOneItem(boolean dropAll)
{
@ -87,7 +105,7 @@
}
public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem)
@@ -746,15 +769,24 @@
@@ -746,15 +773,24 @@
protected ItemStack func_184816_a(EntityItem p_184816_1_)
{
@ -113,7 +131,23 @@
if (f > 1.0F)
{
int i = EnchantmentHelper.func_185293_e(this);
@@ -845,6 +877,16 @@
@@ -804,12 +840,13 @@
f /= 5.0F;
}
- return f;
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos);
+ return (f < 0 ? 0 : f);
}
public boolean func_184823_b(IBlockState p_184823_1_)
{
- return this.inventory.func_184432_b(p_184823_1_);
+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.inventory.func_184432_b(p_184823_1_));
}
public void readEntityFromNBT(NBTTagCompound tagCompund)
@@ -845,6 +882,16 @@
this.spawnForced = tagCompund.getBoolean("SpawnForced");
}
@ -130,7 +164,7 @@
this.foodStats.readNBT(tagCompund);
this.capabilities.readCapabilitiesFromNBT(tagCompund);
@@ -877,6 +919,23 @@
@@ -877,6 +924,23 @@
tagCompound.setBoolean("SpawnForced", this.spawnForced);
}
@ -154,7 +188,7 @@
this.foodStats.writeNBT(tagCompound);
this.capabilities.writeCapabilitiesToNBT(tagCompound);
tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT());
@@ -884,6 +943,7 @@
@@ -884,6 +948,7 @@
public boolean attackEntityFrom(DamageSource source, float amount)
{
@ -162,7 +196,36 @@
if (this.isEntityInvulnerable(source))
{
return false;
@@ -1123,6 +1183,7 @@
@@ -966,6 +1031,7 @@
if (this.field_184627_bm.stackSize <= 0)
{
EnumHand enumhand = this.func_184600_cs();
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, enumhand);
if (enumhand == EnumHand.MAIN_HAND)
{
@@ -1001,8 +1067,12 @@
{
if (!this.isEntityInvulnerable(damageSrc))
{
+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount);
+ if (damageAmount <= 0) return;
damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount);
+ if (damageAmount <= 0) return;
float f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
@@ -1067,6 +1137,7 @@
}
else
{
+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS;
ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.copy() : null;
if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_))
@@ -1123,6 +1194,7 @@
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
@ -170,7 +233,7 @@
if (targetEntity.canAttackWithItem())
{
if (!targetEntity.hitByEntity(this))
@@ -1410,6 +1471,8 @@
@@ -1410,6 +1482,8 @@
public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation)
{
@ -179,7 +242,21 @@
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1514,13 +1577,14 @@
@@ -1449,9 +1523,10 @@
this.setSize(0.2F, 0.2F);
- if (this.worldObj.isBlockLoaded(bedLocation))
- {
- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockHorizontal.field_185512_D);
+ IBlockState state = null;
+ if (this.worldObj.isBlockLoaded(bedLocation)) state = this.worldObj.getBlockState(bedLocation);
+ if (state != null && state.getBlock().isBed(state, this.worldObj, bedLocation, this)) {
+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, this.worldObj, bedLocation);
float f = 0.5F;
float f1 = 0.5F;
@@ -1514,13 +1589,14 @@
public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn)
{
@ -188,16 +265,16 @@
IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation);
- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed)
+ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this))
+ if (this.playerLocation != null && iblockstate.getBlock().isBed(iblockstate, worldObj, playerLocation, this))
{
- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4);
- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0);
+ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false);
+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this);
+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(iblockstate, worldObj, playerLocation, this);
if (blockpos == null)
{
@@ -1529,6 +1593,10 @@
@@ -1529,6 +1605,10 @@
this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F));
}
@ -208,7 +285,7 @@
this.sleeping = false;
@@ -1547,14 +1615,14 @@
@@ -1547,14 +1627,15 @@
private boolean isInBed()
{
@ -218,14 +295,37 @@
public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn)
{
Block block = worldIn.getBlockState(bedLocation).getBlock();
- Block block = worldIn.getBlockState(bedLocation).getBlock();
+ IBlockState state = worldIn.getBlockState(bedLocation);
+ Block block = state.getBlock();
- if (block != Blocks.bed)
+ if (!block.isBed(worldIn, bedLocation, null))
+ if (!block.isBed(state, worldIn, bedLocation, null))
{
if (!forceSpawn)
{
@@ -1618,16 +1686,24 @@
@@ -1569,16 +1650,17 @@
}
else
{
- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0);
+ return block.getBedSpawnPosition(state, worldIn, bedLocation, null);
}
}
@SideOnly(Side.CLIENT)
public float getBedOrientationInDegrees()
{
- if (this.playerLocation != null)
+ IBlockState state = this.playerLocation == null ? null : this.worldObj.getBlockState(playerLocation);
+ if (state != null && state.getBlock().isBed(state, worldObj, playerLocation, this))
{
- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.field_185512_D);
+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, worldObj, playerLocation);
switch (enumfacing)
{
@@ -1618,16 +1700,24 @@
public BlockPos getBedLocation()
{
@ -252,7 +352,7 @@
if (pos != null)
{
this.spawnChunk = pos;
@@ -1822,6 +1898,10 @@
@@ -1822,6 +1912,10 @@
super.fall(distance, damageMultiplier);
}
@ -263,18 +363,38 @@
}
protected void resetHeight()
@@ -2009,6 +2089,10 @@
this.field_181016_an = oldPlayer.field_181016_an;
this.field_181017_ao = oldPlayer.field_181017_ao;
this.field_181018_ap = oldPlayer.field_181018_ap;
+ //Copy and re-init ExtendedProperties when switching dimensions.
+ this.extendedProperties = oldPlayer.extendedProperties;
+ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values())
+ p.init(this, this.worldObj);
}
else if (this.worldObj.getGameRules().getBoolean("keepInventory") || oldPlayer.isSpectator())
{
@@ -2129,7 +2213,7 @@
@@ -2022,6 +2116,18 @@
this.xpSeed = oldPlayer.xpSeed;
this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest;
this.func_184212_Q().func_187227_b(field_184827_bp, oldPlayer.func_184212_Q().func_187225_a(field_184827_bp));
+
+ this.spawnChunkMap = oldPlayer.spawnChunkMap;
+ this.spawnForcedMap = oldPlayer.spawnForcedMap;
+
+ //Copy over a section of the Entity Data from the old player.
+ //Allows mods to specify data that persists after players respawn.
+ NBTTagCompound old = oldPlayer.getEntityData();
+ if (old.hasKey(PERSISTED_NBT_TAG))
+ {
+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG));
+ }
+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd);
}
protected boolean canTriggerWalking()
@@ -2120,7 +2226,10 @@
public ITextComponent getDisplayName()
{
- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
+ ITextComponent itextcomponent = new TextComponentString("");
+ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.appendSibling(prefix);
+ itextcomponent.appendSibling(new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())));
+ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.appendSibling(suffix);
itextcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
itextcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent());
itextcomponent.getChatStyle().setInsertion(this.getName());
@@ -2129,7 +2238,7 @@
public float getEyeHeight()
{
@ -283,7 +403,7 @@
if (this.isPlayerSleeping())
{
@@ -2340,6 +2424,136 @@
@@ -2340,6 +2449,136 @@
return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue();
}
@ -397,23 +517,23 @@
+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName());
+ }
+
+ private final java.util.Collection<net.minecraft.util.IChatComponent> prefixes = new java.util.LinkedList<net.minecraft.util.IChatComponent>();
+ private final java.util.Collection<net.minecraft.util.IChatComponent> suffixes = new java.util.LinkedList<net.minecraft.util.IChatComponent>();
+ private final java.util.Collection<ITextComponent> prefixes = new java.util.LinkedList<ITextComponent>();
+ private final java.util.Collection<ITextComponent> suffixes = new java.util.LinkedList<ITextComponent>();
+
+ /**
+ * Add a prefix to the player's username in chat
+ * @param prefix The prefix
+ */
+ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); }
+ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); }
+
+ /**
+ * Add a suffix to the player's username in chat
+ * @param suffix The suffix
+ */
+ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); }
+ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); }
+
+ public java.util.Collection<net.minecraft.util.IChatComponent> getPrefixes() { return this.prefixes; }
+ public java.util.Collection<net.minecraft.util.IChatComponent> getSuffixes() { return this.suffixes; }
+ public java.util.Collection<ITextComponent> getPrefixes() { return this.prefixes; }
+ public java.util.Collection<ITextComponent> getSuffixes() { return this.suffixes; }
+
+ /* ======================================== FORGE END =====================================*/
+

View File

@ -1,6 +1,24 @@
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java
@@ -250,7 +250,7 @@
@@ -134,14 +134,15 @@
public int ping;
public boolean playerConqueredTheEnd;
+ @SuppressWarnings("unused")
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManager)
{
super(worldIn, profile);
interactionManager.thisPlayerMP = this;
this.theItemInWorldManager = interactionManager;
- BlockPos blockpos = worldIn.getSpawnPoint();
+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint();
- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
{
int i = Math.max(0, server.func_184108_a(worldIn));
int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ()));
@@ -250,7 +251,7 @@
this.openContainer.detectAndSendChanges();
@ -9,7 +27,15 @@
{
this.closeScreen();
this.openContainer = this.inventoryContainer;
@@ -459,7 +459,20 @@
@@ -433,6 +434,7 @@
public void onDeath(DamageSource cause)
{
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return;
boolean flag = this.worldObj.getGameRules().getBoolean("showDeathMessages");
this.playerNetServerHandler.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag));
@@ -459,7 +461,20 @@
if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator())
{
@ -24,13 +50,30 @@
+ {
+ for (net.minecraft.entity.item.EntityItem item : capturedDrops)
+ {
+ joinEntityItemWithWorld(item);
+ this.worldObj.spawnEntityInWorld(item);
+ }
+ }
}
for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.deathCount))
@@ -921,6 +934,7 @@
@@ -540,6 +555,7 @@
public Entity func_184204_a(int p_184204_1_)
{
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return;
this.field_184851_cj = true;
if (this.dimension == 1 && p_184204_1_ == 1)
@@ -697,7 +713,7 @@
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
- if (iblockstate.func_185904_a() == Material.air)
+ if (iblockstate.getBlock().isAir(iblockstate, this.worldObj, blockpos))
{
BlockPos blockpos1 = blockpos.down();
IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1);
@@ -921,6 +937,7 @@
{
if (stat != null)
{

View File

@ -1,7 +1,23 @@
--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java
+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java
@@ -304,6 +304,14 @@
return i;
@@ -270,13 +270,8 @@
if (itemstack == null)
{
- itemstack = new ItemStack(item, 0, itemStackIn.getMetadata());
-
- if (itemStackIn.hasTagCompound())
- {
- itemstack.setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy());
- }
-
+ itemstack = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up.
+ itemstack.stackSize = 0;
this.setInventorySlotContents(j, itemstack);
}
@@ -344,6 +339,14 @@
}
}
}
+
@ -14,4 +30,4 @@
+ }
}
private int storeItemStack(ItemStack itemStackIn)
public boolean addItemStackToInventory(final ItemStack itemStackIn)

View File

@ -12,3 +12,11 @@
{
return;
}
@@ -689,6 +692,7 @@
if (itemstack != null && itemstack.stackSize == 0)
{
this.playerEntity.func_184611_a(enumhand, (ItemStack)null);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand);
itemstack = null;
}
}

View File

@ -138,7 +138,7 @@
+ BlockPos ret = this.worldObj.getSpawnPoint();
+
+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE;
+ int spawnFuzz = terrainType.getSpawnFuzz();
+ int spawnFuzz = this.worldObj instanceof WorldServer ? terrainType.getSpawnFuzz((WorldServer)this.worldObj, this.worldObj.getMinecraftServer()) : 1;
+ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ()));
+ if (border < spawnFuzz) spawnFuzz = border;
+ if (spawnFuzz < 1) spawnFuzz = 1;

View File

@ -93,9 +93,9 @@
+ * Useful for void world types.
+ * @return Fuzz for entity initial spawn in blocks.
+ */
+ public int getSpawnFuzz()
+ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server)
+ {
+ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6);
+ return Math.max(0, server.func_184108_a(world));
+ }
+
+ /**

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
public boolean interactFirst(EntityPlayer playerIn)
{
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true;
this.commandBlockLogic.tryOpenEditCommandBlock(playerIn);
return false;
}
++++ END PATCH

View File

@ -1,32 +0,0 @@
++++ REJECTED PATCH 1
this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
this.motionZ = this.trackedEntity.motionZ;
+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D);
+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D);
+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D);
+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ)
+ {
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ);
+ }
+
if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob))
{
playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ));
++++ END PATCH
++++ REJECTED PATCH 2
playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect));
}
}
+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP);
}
}
else if (this.trackingPlayers.contains(playerMP))
{
this.trackingPlayers.remove(playerMP);
playerMP.removeEntity(this.trackedEntity);
+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP);
}
}
}
++++ END PATCH

View File

@ -1,13 +0,0 @@
++++ REJECTED PATCH 1
BlockPos blockpos = new BlockPos(k1, l1, i2);
Block block = this.worldObj.getBlockState(blockpos).getBlock();
- if (block.getMaterial() != Material.air)
+ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2)))
{
- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing"))
+ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getBoolean("mobGriefing"))
{
flag1 = this.worldObj.setBlockToAir(blockpos) || flag1;
}
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
BlockPos blockpos = new BlockPos(i3, k, l);
Block block = this.worldObj.getBlockState(blockpos).getBlock();
- if (block.getMaterial() != Material.air && func_181033_a(block))
+ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this))
{
flag = this.worldObj.destroyBlock(blockpos, true) || flag;
}
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public interface IBossDisplayData
{
float getMaxHealth();
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
public boolean interactFirst(EntityPlayer playerIn)
{
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true;
if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
{
return true;
++++ END PATCH

View File

@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
public boolean interactFirst(EntityPlayer playerIn)
{
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true;
ItemStack itemstack = playerIn.inventory.getCurrentItem();
if (itemstack != null && itemstack.getItem() == Items.coal)
++++ END PATCH

View File

@ -1,19 +0,0 @@
++++ REJECTED PATCH 1
protected boolean teleportTo(double x, double y, double z)
{
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 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 = x;
- this.posY = y;
- this.posZ = z;
+ 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,42 +0,0 @@
++++ REJECTED PATCH 1
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D);
+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance);
}
protected void entityInit()
++++ END PATCH
++++ REJECTED PATCH 2
entitylivingbase = (EntityLivingBase)source.getEntity();
}
- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue())
+ int i = MathHelper.floor_double(this.posX);
+ int j = MathHelper.floor_double(this.posY);
+ int k = MathHelper.floor_double(this.posZ);
+
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue());
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true;
+
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW ||
+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue())
{
- int i = MathHelper.floor_double(this.posX);
- int j = MathHelper.floor_double(this.posY);
- int k = MathHelper.floor_double(this.posZ);
- EntityZombie entityzombie = new EntityZombie(this.worldObj);
+ EntityZombie entityzombie;
+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
+ {
+ entityzombie = summonAid.customSummonedAid;
+ }
+ else
+ {
+ entityzombie = new EntityZombie(this.worldObj);
+ }
for (int l = 0; l < 50; ++l)
{
++++ END PATCH

View File

@ -1,19 +0,0 @@
++++ REJECTED PATCH 2
this.spawnableBlock = Blocks.mycelium;
}
+ @SuppressWarnings("unused")
public boolean interact(EntityPlayer player)
{
ItemStack itemstack = player.inventory.getCurrentItem();
++++ END PATCH
++++ REJECTED PATCH 3
}
}
- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0)
+ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared
{
this.setDead();
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
++++ END PATCH

View File

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
Block block = this.worldObj.getBlockState(blockpos.down()).getBlock();
- if (block == Blocks.grass || block.getMaterial() == Material.leaves)
+ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down()))
{
return true;
}
++++ END PATCH

View File

@ -1,15 +0,0 @@
++++ REJECTED PATCH 2
}
}
+ @SuppressWarnings("unused")
public boolean interact(EntityPlayer player)
{
ItemStack itemstack = player.inventory.getCurrentItem();
- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild())
+ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared
{
if (!this.worldObj.isRemote)
{
++++ END PATCH

File diff suppressed because one or more lines are too long

View File

@ -1,228 +0,0 @@
++++ REJECTED PATCH 1
@SuppressWarnings("incomplete-switch")
public abstract class EntityPlayer extends EntityLivingBase
{
+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
+ private java.util.HashMap<Integer, BlockPos> spawnChunkMap = new java.util.HashMap<Integer, BlockPos>();
+ private java.util.HashMap<Integer, Boolean> spawnForcedMap = new java.util.HashMap<Integer, Boolean>();
+ public float eyeHeight = this.getDefaultEyeHeight();
+
public InventoryPlayer inventory = new InventoryPlayer(this);
private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest();
public Container inventoryContainer;
++++ END PATCH
++++ REJECTED PATCH 2
{
if (this.itemInUse != null)
{
- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount);
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount))
+ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount);
}
this.clearItemInUse();
++++ END PATCH
++++ REJECTED PATCH 4
if (itemstack == this.itemInUse)
{
+ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount);
+ if (itemInUseCount <= 0)
+ {
+ this.onItemUseFinish();
+ }
+ else
+ { // Forge Keep unindented to lower patch
+ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{
this.updateItemUse(itemstack, 5);
++++ END PATCH
++++ REJECTED PATCH 8
int i = this.itemInUse.stackSize;
ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this);
+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack);
if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i)
{
this.inventory.mainInventory[this.inventory.currentItem] = itemstack;
- if (itemstack.stackSize == 0)
+ if (itemstack != null && itemstack.stackSize == 0)
{
this.inventory.mainInventory[this.inventory.currentItem] = null;
}
++++ END PATCH
++++ REJECTED PATCH 9
this.cameraYaw = 0.0F;
this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2);
- if (this.ridingEntity instanceof EntityPig)
+ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this))
{
this.rotationPitch = f1;
this.rotationYaw = f;
- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset;
+ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset;
}
}
}
++++ END PATCH
++++ REJECTED PATCH 14
f /= 5.0F;
}
- return f;
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos);
+ return (f < 0 ? 0 : f);
}
public boolean canHarvestBlock(Block blockToHarvest)
{
- return this.inventory.canHeldItemHarvest(blockToHarvest);
+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, blockToHarvest, this.inventory.canHeldItemHarvest(blockToHarvest));
}
public void readEntityFromNBT(NBTTagCompound tagCompund)
++++ END PATCH
++++ REJECTED PATCH 18
{
if (!this.isEntityInvulnerable(damageSrc))
{
+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount);
+ if (damageAmount <= 0) return;
if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F)
{
damageAmount = (1.0F + damageAmount) * 0.5F;
}
- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount);
+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount);
+ if (damageAmount <= 0) return;
damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount);
float f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F);
++++ END PATCH
++++ REJECTED PATCH 19
}
else
{
+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, targetEntity)) return false;
ItemStack itemstack = this.getCurrentEquippedItem();
ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null;
++++ END PATCH
++++ REJECTED PATCH 20
public void destroyCurrentEquippedItem()
{
+ ItemStack orig = getCurrentEquippedItem();
this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig);
}
public double getYOffset()
++++ END PATCH
++++ REJECTED PATCH 23
this.setSize(0.2F, 0.2F);
- if (this.worldObj.isBlockLoaded(bedLocation))
+ if (this.worldObj.isBlockLoaded(bedLocation) && worldObj.getBlockState(bedLocation).getBlock().isBed(worldObj, bedLocation, this))
{
- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING);
+ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation);
float f = 0.5F;
float f1 = 0.5F;
++++ END PATCH
++++ REJECTED PATCH 27
}
else
{
- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0);
+ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null);
}
}
@SideOnly(Side.CLIENT)
public float getBedOrientationInDegrees()
{
- if (this.playerLocation != null)
+ if (this.playerLocation != null && worldObj.getBlockState(playerLocation).getBlock().isBed(worldObj, playerLocation, this))
{
- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING);
+ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation);
switch (enumfacing)
{
++++ END PATCH
++++ REJECTED PATCH 30
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn)));
+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn));
if (entitylist$entityegginfo != null)
{
++++ END PATCH
++++ REJECTED PATCH 31
{
if (stack != this.itemInUse)
{
+ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration);
+ if (duration <= 0) return;
this.itemInUse = stack;
this.itemInUseCount = duration;
++++ END PATCH
++++ REJECTED PATCH 33
this.xpSeed = oldPlayer.xpSeed;
this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest;
this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10)));
+
+ this.spawnChunkMap = oldPlayer.spawnChunkMap;
+ this.spawnForcedMap = oldPlayer.spawnForcedMap;
+
+ //Copy over a section of the Entity Data from the old player.
+ //Allows mods to specify data that persists after players respawn.
+ NBTTagCompound old = oldPlayer.getEntityData();
+ if (old.hasKey(PERSISTED_NBT_TAG))
+ {
+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG));
+ }
+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd);
}
protected boolean canTriggerWalking()
++++ END PATCH
++++ REJECTED PATCH 34
public void setCurrentItemOrArmor(int slotIn, ItemStack stack)
{
- this.inventory.armorInventory[slotIn] = stack;
+ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item
+ {
+ this.inventory.mainInventory[this.inventory.currentItem] = stack;
+ }
+ else
+ {
+ this.inventory.armorInventory[slotIn - 1] = stack;
+ }
}
@SideOnly(Side.CLIENT)
++++ END PATCH
++++ REJECTED PATCH 35
public IChatComponent getDisplayName()
{
- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
+ IChatComponent ichatcomponent = new ChatComponentText("");
+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix);
+ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString())));
+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix);
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent());
ichatcomponent.getChatStyle().setInsertion(this.getName());
++++ END PATCH

View File

@ -1,55 +0,0 @@
++++ REJECTED PATCH 1
public int ping;
public boolean playerConqueredTheEnd;
+ @SuppressWarnings("unused")
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager)
{
super(worldIn, profile);
interactionManager.thisPlayerMP = this;
this.theItemInWorldManager = interactionManager;
- BlockPos blockpos = worldIn.getSpawnPoint();
+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint();
- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
{
int i = Math.max(5, server.getSpawnProtectionSize() - 6);
int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ()));
++++ END PATCH
++++ REJECTED PATCH 3
for (Chunk chunk1 : list)
{
this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this));
}
}
}
++++ END PATCH
++++ REJECTED PATCH 4
public void onDeath(DamageSource cause)
{
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return;
if (this.worldObj.getGameRules().getBoolean("showDeathMessages"))
{
Team team = this.getTeam();
++++ END PATCH
++++ REJECTED PATCH 6
if (entitylivingbase != null)
{
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase)));
+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase));
if (entitylist$entityegginfo != null)
{
++++ END PATCH
++++ REJECTED PATCH 7
public void travelToDimension(int dimensionId)
{
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return;
if (this.dimension == 1 && dimensionId == 1)
{
this.triggerAchievement(AchievementList.theEnd2);
++++ END PATCH

View File

@ -1,16 +0,0 @@
++++ REJECTED PATCH 1
{
if (this.mainInventory[j] == null)
{
- this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata());
-
- if (itemStackIn.hasTagCompound())
- {
- this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy());
- }
+ this.mainInventory[j] = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up.
+ this.mainInventory[j].stackSize = 0;
}
int k = i;
++++ END PATCH

View File

@ -21,7 +21,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@ -42,6 +45,7 @@ import net.minecraftforge.event.entity.EntityMountEvent;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
@ -61,7 +65,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent;
import net.minecraftforge.event.entity.player.UseHoeEvent;
@ -102,11 +105,11 @@ public class ForgeEventFactory
return event;
}
public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success)
public static boolean doPlayerHarvestCheck(EntityPlayer player, IBlockState state, boolean success)
{
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, state, success);
MinecraftForge.EVENT_BUS.post(event);
return event.success;
return event.canHarvest();
}
public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos)
@ -128,9 +131,9 @@ public class ForgeEventFactory
return event;
}
public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack)
public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack, EnumHand hand)
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack));
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
}
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z)
@ -212,26 +215,26 @@ public class ForgeEventFactory
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
}
public static int onItemUseStart(EntityPlayer player, ItemStack item, int duration)
public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration)
{
PlayerUseItemEvent event = new PlayerUseItemEvent.Start(player, item, duration);
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration;
}
public static int onItemUseTick(EntityPlayer player, ItemStack item, int duration)
public static int onItemUseTick(EntityLivingBase entity, ItemStack item, int duration)
{
PlayerUseItemEvent event = new PlayerUseItemEvent.Tick(player, item, duration);
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration;
}
public static boolean onUseItemStop(EntityPlayer player, ItemStack item, int duration)
public static boolean onUseItemStop(EntityLivingBase entity, ItemStack item, int duration)
{
return MinecraftForge.EVENT_BUS.post(new PlayerUseItemEvent.Stop(player, item, duration));
return MinecraftForge.EVENT_BUS.post(new LivingEntityUseItemEvent.Stop(entity, item, duration));
}
public static ItemStack onItemUseFinish(EntityPlayer player, ItemStack item, int duration, ItemStack result)
public static ItemStack onItemUseFinish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result)
{
PlayerUseItemEvent.Finish event = new PlayerUseItemEvent.Finish(player, item, duration, result);
LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result);
MinecraftForge.EVENT_BUS.post(event);
return event.result;
}
@ -294,7 +297,7 @@ public class ForgeEventFactory
return 0;
}
public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, MovingObjectPosition target)
public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target)
{
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
if (MinecraftForge.EVENT_BUS.post(event)) return stack;
@ -305,10 +308,10 @@ public class ForgeEventFactory
return stack;
if (--stack.stackSize <= 0)
return event.result;
return event.getFilledBucket();
if (!player.inventory.addItemStackToInventory(event.result))
player.dropPlayerItemWithRandomChoice(event.result, false);
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false);
return stack;
}
@ -367,9 +370,9 @@ public class ForgeEventFactory
}
}
public static boolean canInteractWith(EntityPlayer player, Entity entity)
public static boolean canInteractWith(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand)
{
return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity));
return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity, item, hand));
}
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)

View File

@ -3,7 +3,6 @@ package net.minecraftforge.event;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.text.ITextComponent;
/**
@ -26,11 +25,10 @@ import net.minecraft.util.text.ITextComponent;
@Cancelable
public class ServerChatEvent extends Event
{
public final String message, username;
public final EntityPlayerMP player;
@Deprecated //Use methods below
public ChatComponentTranslation component;
public ServerChatEvent(EntityPlayerMP player, String message, ChatComponentTranslation component)
private final String message, username;
private final EntityPlayerMP player;
private ITextComponent component;
public ServerChatEvent(EntityPlayerMP player, String message, ITextComponent component)
{
super();
this.message = message;
@ -41,14 +39,15 @@ public class ServerChatEvent extends Event
public void setComponent(ITextComponent e)
{
if (e instanceof ChatComponentTranslation)
this.component = (ChatComponentTranslation)e;
else
this.component = new ChatComponentTranslation("%s", e);
this.component = e;
}
public ITextComponent getComponent()
{
return this.component;
}
public String getMessage() { return this.message; }
public String getUsername() { return this.username; }
public EntityPlayerMP getPlayer() { return this.player; }
}

View File

@ -1,17 +1,18 @@
package net.minecraftforge.event.entity.player;
package net.minecraftforge.event.entity.living;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public abstract class PlayerUseItemEvent extends PlayerEvent
public abstract class LivingEntityUseItemEvent extends LivingEvent
{
public final ItemStack item;
public int duration;
private PlayerUseItemEvent(EntityPlayer player, ItemStack item, int duration)
private LivingEntityUseItemEvent(EntityLivingBase entity, ItemStack item, int duration)
{
super(player);
super(entity);
this.item = item;
this.duration = duration;
}
@ -28,11 +29,11 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
*
*/
@Cancelable
public static class Start extends PlayerUseItemEvent
public static class Start extends LivingEntityUseItemEvent
{
public Start(EntityPlayer player, ItemStack item, int duration)
public Start(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
@ -43,32 +44,32 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
*
*/
@Cancelable
public static class Tick extends PlayerUseItemEvent
public static class Tick extends LivingEntityUseItemEvent
{
public Tick(EntityPlayer player, ItemStack item, int duration)
public Tick(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
/**
* Fired when a player stops using an item without the use duration timing out.
* Fired when a player stops using an item without the use duration timing out.
* Example:
* Stop eating 1/2 way through
* Stop defending with sword
* Stop drawing bow. This case would fire the arrow
*
*
* Duration on this event is how long the item had left in it's count down before 'finishing'
*
* Canceling this event will prevent the Item from being notified that it has stopped being used,
* Canceling this event will prevent the Item from being notified that it has stopped being used,
* The only vanilla item this would effect are bows, and it would cause them NOT to fire there arrow.
*/
@Cancelable
public static class Stop extends PlayerUseItemEvent
public static class Stop extends LivingEntityUseItemEvent
{
public Stop(EntityPlayer player, ItemStack item, int duration)
public Stop(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
@ -76,18 +77,18 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
* Fired after an item has fully finished being used.
* The item has been notified that it was used, and the item/result stacks reflect after that state.
* This means that when this is fired for a Potion, the potion effect has already been applied.
*
*
* If you wish to cancel those effects, you should cancel one of the above events.
*
*
* The result item stack is the stack that is placed in the player's inventory in replacement of the stack that is currently being used.
*
*/
public static class Finish extends PlayerUseItemEvent
public static class Finish extends LivingEntityUseItemEvent
{
public ItemStack result;
public Finish(EntityPlayer player, ItemStack item, int duration, ItemStack result)
public Finish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result)
{
super(player, item, duration);
super(entity, item, duration);
this.result = result;
}
}

View File

@ -3,11 +3,13 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartEmpty#interactFirst(EntityPlayer)
* EntityMinecartFurnace#interactFirst(EntityPlayer)
* EntityMinecartHopper#interactFirst(EntityPlayer).<br>
@ -24,11 +26,19 @@ import net.minecraft.entity.player.EntityPlayer;
@Cancelable
public class MinecartInteractEvent extends MinecartEvent
{
public final EntityPlayer player;
private final EntityPlayer player;
private final ItemStack item;
private final EnumHand hand;
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player)
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player, ItemStack item, EnumHand hand)
{
super(minecart);
this.player = player;
this.item = item;
this.hand = hand;
}
public EntityPlayer getPlayer() { return player; }
public ItemStack getItem() { return item; }
public EnumHand getHand() { return hand; }
}

View File

@ -4,6 +4,8 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* EntityInteractEvent is fired when a player interacts with an Entity.<br>
@ -22,10 +24,18 @@ import net.minecraft.entity.player.EntityPlayer;
@Cancelable
public class EntityInteractEvent extends PlayerEvent
{
public final Entity target;
public EntityInteractEvent(EntityPlayer player, Entity target)
private final Entity target;
private final ItemStack item;
private final EnumHand hand;
public EntityInteractEvent(EntityPlayer player, Entity target, ItemStack item, EnumHand hand)
{
super(player);
this.target = target;
this.item = item;
this.hand = hand;
}
public Entity getTarget() { return this.target; }
public ItemStack getItem() { return this.item; }
public EnumHand getHand() { return this.hand; }
}

View File

@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@Cancelable
@ -12,26 +12,32 @@ import net.minecraft.world.World;
public class FillBucketEvent extends PlayerEvent
{
/**
* This event is fired when a player attempts to use a Empty bucket, it
* This event is fired when a player attempts to use a Empty bucket, it
* can be canceled to completely prevent any further processing.
*
* If you set the result to 'ALLOW', it means that you have processed
* the event and wants the basic functionality of adding the new
*
* If you set the result to 'ALLOW', it means that you have processed
* the event and wants the basic functionality of adding the new
* ItemStack to your inventory and reducing the stack size to process.
* setResult(ALLOW) is the same as the old setHandeled();
*/
public final ItemStack current;
public final World world;
public final MovingObjectPosition target;
private final ItemStack current;
private final World world;
private final RayTraceResult target;
public ItemStack result;
private ItemStack result;
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, MovingObjectPosition target)
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, RayTraceResult target)
{
super(player);
this.current = current;
this.world = world;
this.target = target;
}
public ItemStack getEmptyBucket() { return this.current; }
public World getWorld(){ return this.world; }
public RayTraceResult getTarget() { return this.target; }
public ItemStack getFilledBucket() { return this.result; }
public void setFilledBucket(ItemStack bucket) { this.result = bucket; }
}

View File

@ -3,6 +3,7 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* PlayerDestroyItemEvent is fired when a player destroys an item.<br>
@ -15,6 +16,7 @@ import net.minecraft.item.ItemStack;
* and ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float).<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* (@link #hand) contains the hand that the current item was held in.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@ -24,11 +26,16 @@ import net.minecraft.item.ItemStack;
**/
public class PlayerDestroyItemEvent extends PlayerEvent
{
public final ItemStack original;
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original)
private final ItemStack original;
private final EnumHand hand;
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand)
{
super(player);
this.original = original;
this.hand = hand;
}
public ItemStack getOriginal() { return this.original; }
public EnumHand getHand() { return this.hand; }
}

View File

@ -43,15 +43,19 @@ public class PlayerEvent extends LivingEvent
**/
public static class HarvestCheck extends PlayerEvent
{
public final Block block;
public boolean success;
private final IBlockState state;
private boolean success;
public HarvestCheck(EntityPlayer player, Block block, boolean success)
public HarvestCheck(EntityPlayer player, IBlockState state, boolean success)
{
super(player);
this.block = block;
this.state = state;
this.success = success;
}
public IBlockState getTargetBlock() { return this.state; }
public boolean canHarvest() { return this.success; }
public void setCanHarvest(boolean success){ this.success = success; }
}
/**

View File

@ -321,12 +321,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
return true;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state)
{
return null;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{

View File

@ -14,7 +14,7 @@ import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.network.ByteBufUtils;
@ -110,12 +110,12 @@ public abstract class FMLMessage {
}
public static class EntityAdjustMessage extends EntityMessage {
int serverX;
int serverY;
int serverZ;
long serverX;
long serverY;
long serverZ;
public EntityAdjustMessage() {}
public EntityAdjustMessage(Entity entity, int serverX, int serverY, int serverZ)
public EntityAdjustMessage(Entity entity, long serverX, long serverY, long serverZ)
{
super(entity);
this.serverX = serverX;
@ -127,9 +127,9 @@ public abstract class FMLMessage {
void toBytes(ByteBuf buf)
{
super.toBytes(buf);
buf.writeInt(serverX);
buf.writeInt(serverY);
buf.writeInt(serverZ);
buf.writeLong(serverX);
buf.writeLong(serverY);
buf.writeLong(serverZ);
}
@Override

View File

@ -109,7 +109,7 @@ public class FMLNetworkHandler
}
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, long serverX, long serverY, long serverZ)
{
EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);

View File

@ -118,8 +118,6 @@ public class EntityRegistry
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
private Map<String, EntityList.EntityEggInfo> entityEggs = Maps.newHashMap();
private Map<String, EntityList.EntityEggInfo> entityEggsUn = Collections.unmodifiableMap(entityEggs);
public static EntityRegistry instance()
{
@ -200,40 +198,6 @@ public class EntityRegistry
entityRegistrations.put(mc, er);
}
/**
* Registers a spawn egg for the specified entity class.
* The class must already be registered in the EntityList.classToStringMapping.
* This can be done either by using the global ID system, or preferably the registerModEntity functions above.
* Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with
* value of the name this class is registered in the classToStringMapping with.
*
* @param entityClass The entity class
* @param primary Primary egg color
* @param secondary Secondary egg color
*
* @throws IllegalArgumentException if entityClass is not registered in classToStringMapping.
*
*/
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
{
if (!EntityList.classToStringMapping.containsKey(entityClass))
throw new IllegalArgumentException("Entity not registered in classToString map: " + entityClass);
String name = (String)EntityList.classToStringMapping.get(entityClass);
EntityRegistry.instance().entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
}
/**
* Returns a Unmodifiable view of the registered entity eggs list.
*
* @return An Unmodifiable view of the registered entity eggs list.
*/
public static Map<String, EntityList.EntityEggInfo> getEggs()
{
return instance().entityEggsUn;
}
/**
* Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used.
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead.

View File

@ -21,8 +21,8 @@ import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.Level;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.functions.GenericIterableFactory;
import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;

View File

@ -431,11 +431,10 @@ public class VillagerRegistry
},
{
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()),
new PriceInfo(-2, -1))
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1))
},
{
new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)),
new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
},
{

View File

@ -10,7 +10,7 @@ import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.server.ForgeTimeTracker;
@ -113,7 +113,7 @@ public class ForgeCommand extends CommandBase {
{
ForgeTimeTracker.tileEntityTrackingDuration = duration;
ForgeTimeTracker.tileEntityTracking = true;
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tracking.te.enabled", duration));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration));
}
private void doTPSLog(ICommandSender sender, String[] args)
@ -136,17 +136,17 @@ public class ForgeCommand extends CommandBase {
{
double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dimId)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
double meanTickTime = ForgeCommand.mean(this.getServer().tickTimeArray) * 1.0E-6D;
double meanTPS = Math.min(1000.0/meanTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
}
else
{
double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dim)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
}