More patch work, client patches.

This commit is contained in:
LexManos committed 2016-03-07 21:06:54 -08:00
1 parent f0e5baa8e5
commit 26ca27193c
28 files changed
+380 -403

No files matched your search

@@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/Block.java
+++ ../src-work/minecraft/net/minecraft/block/Block.java
@@ -46,8 +46,9 @@
@@ -17,6 +17,7 @@
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.init.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
@@ -46,8 +47,9 @@
public class Block
{
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
@@ -12,7 +20,7 @@
public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public static final AxisAlignedBB field_185506_k = null;
private CreativeTabs displayOnCreativeTab;
@@ -70,6 +71,9 @@
@@ -70,6 +72,9 @@
private IBlockState defaultBlockState;
private String unlocalizedName;
@@ -22,7 +30,7 @@
public static int getIdFromBlock(Block blockIn)
{
return blockRegistry.getIDForObject(blockIn);
@@ -83,7 +87,8 @@
@@ -83,7 +88,8 @@
public static Block getBlockById(int id)
{
@@ -32,16 +40,16 @@
}
public static IBlockState getStateById(int id)
@@ -268,7 +273,7 @@
@@ -268,7 +274,7 @@
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
{
- return false;
+ return getMaterial().isReplaceable();
+ return worldIn.getBlockState(pos).func_185904_a().isReplaceable();
}
public Block setHardness(float hardness)
@@ -305,9 +310,10 @@
@@ -305,9 +311,10 @@
return this.needsRandomTick;
}
@@ -53,7 +61,7 @@
}
public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_)
@@ -346,13 +352,13 @@
@@ -346,13 +353,13 @@
@SideOnly(Side.CLIENT)
public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_)
{
@@ -69,7 +77,7 @@
}
else
{
@@ -415,7 +421,7 @@
@@ -415,7 +422,7 @@
}
}
@@ -78,7 +86,7 @@
}
@SideOnly(Side.CLIENT)
@@ -472,6 +478,10 @@
@@ -472,6 +479,10 @@
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
@@ -89,7 +97,7 @@
}
public int quantityDropped(Random random)
@@ -486,8 +496,7 @@
@@ -486,8 +497,7 @@
public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_)
{
@@ -99,7 +107,7 @@
}
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
@@ -497,20 +506,16 @@
@@ -497,20 +507,16 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
@@ -125,7 +133,7 @@
}
}
}
@@ -518,8 +523,13 @@
@@ -518,8 +524,13 @@
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
{
@@ -140,7 +148,7 @@
float f = 0.5F;
double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
@@ -588,7 +598,7 @@
@@ -588,7 +599,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
@@ -149,7 +157,7 @@
}
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_)
@@ -638,25 +648,35 @@
@@ -638,25 +649,35 @@
player.triggerAchievement(StatList.func_188055_a(this));
player.addExhaustion(0.025F);
@@ -188,7 +196,7 @@
}
protected ItemStack createStackedBlock(IBlockState state)
@@ -747,6 +767,7 @@
@@ -747,6 +768,7 @@
entityIn.motionY = 0.0D;
}
@@ -196,7 +204,7 @@
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
{
return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_));
@@ -844,6 +865,1162 @@
@@ -844,6 +866,1165 @@
return "Block{" + blockRegistry.getNameForObject(this) + "}";
}
@@ -245,7 +253,6 @@
+ */
+ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower();
+ return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m();
+ }
+
@@ -283,7 +290,7 @@
+
+ if (this instanceof BlockSlab)
+ {
+ return isFullBlock()
+ return base_state.func_185913_b()
+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP )
+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN);
+ }
@@ -378,6 +385,7 @@
+ * Note: When used in multiplayer, this is called on both client and
+ * server sides!
+ *
+ * @param state The current state.
+ * @param world The current world
+ * @param player The player damaging the block, may be null
+ * @param pos Block position in world
@@ -385,9 +393,10 @@
+ * Can be useful to delay the destruction of tile entities till after harvestBlock
+ * @return True if the block is actually destroyed.
+ */
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ return world.setBlockToAir(pos);
+ this.onBlockHarvested(world, pos, state, player);
+ return world.setBlockState(pos, Blocks.air.getDefaultState(), world.isRemote ? 11 : 3);
+ }
+
+ /**
@@ -761,13 +770,14 @@
+ * Determines if a torch can be placed on the top surface of this block.
+ * Useful for creating your own block that torches can be on, such as fences.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return True to allow the torch to be placed
+ */
+ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos)
+ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ if (isSideSolid(world, pos, EnumFacing.UP))
+ if (state.isSideSolid(world, pos, EnumFacing.UP))
+ {
+ return true;
+ }
@@ -835,13 +845,14 @@
+ * control over the particles. Useful when you have entirely different
+ * texture sheets for different sides/locations in the world.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param target The target the player is looking at {x/y/z/side/sub}
+ * @param effectRenderer A reference to the current effect renderer.
+ * @return True to prevent vanilla digging particles form spawning.
+ */
+ @SideOnly(Side.CLIENT)
+ public boolean addHitEffects(World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer)
+ public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer)
+ {
+ return false;
+ }
@@ -886,35 +897,35 @@
+ IBlockState plant = plantable.getPlant(world, pos.offset(direction));
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
+
+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus)
+ if (plant.getBlock() == Blocks.cactus && this == Blocks.cactus)
+ {
+ return true;
+ }
+
+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds)
+ if (plant.getBlock() == Blocks.reeds && this == Blocks.reeds)
+ {
+ return true;
+ }
+
+ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this))
+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_185514_i(state))
+ {
+ return true;
+ }
+
+ switch (plantType)
+ {
+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt;
+ case Nether: return this == net.minecraft.init.Blocks.soul_sand;
+ case Crop: return this == net.minecraft.init.Blocks.farmland;
+ case Cave: return isSideSolid(world, pos, EnumFacing.UP);
+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland;
+ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0;
+ case Desert: return this == Blocks.sand || this == Blocks.hardened_clay || this == Blocks.stained_hardened_clay || this == Blocks.dirt;
+ case Nether: return this == Blocks.soul_sand;
+ case Crop: return this == Blocks.farmland;
+ case Cave: return state.isSideSolid(world, pos, EnumFacing.UP);
+ case Plains: return this == Blocks.grass || this == Blocks.dirt || this == Blocks.farmland;
+ case Water: return state.func_185904_a() == Material.water && state.getValue(BlockLiquid.LEVEL) == 0;
+ case Beach:
+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand;
+ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water);
+ boolean isBeach = this == Blocks.grass || this == Blocks.dirt || this == Blocks.sand;
+ boolean hasWater = (world.getBlockState(pos.east()).func_185904_a() == Material.water ||
+ world.getBlockState(pos.west()).func_185904_a() == Material.water ||
+ world.getBlockState(pos.north()).func_185904_a() == Material.water ||
+ world.getBlockState(pos.south()).func_185904_a() == Material.water);
+ return isBeach && hasWater;
+ }
+
@@ -1139,9 +1150,9 @@
+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side
+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power
+ */
+ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side)
+ public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return isNormalCube();
+ return state.func_185915_l();
+ }
+
+ /**
@@ -54,7 +54,7 @@
return true;
}
}
@@ -284,6 +279,32 @@
@@ -284,6 +279,33 @@
return Block.EnumOffsetType.XZ;
}
@@ -65,6 +65,7 @@
+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT);
+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
@@ -74,11 +75,11 @@
+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta()));
+ return ret;
+ }
+
+ @Override
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames.
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this)
+ world.setBlockToAir(pos.up());
+ return world.setBlockToAir(pos);
@@ -1,11 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java
@@ -86,7 +86,7 @@
@@ -79,14 +79,14 @@
private boolean canPlaceOn(World worldIn, BlockPos pos)
{
- if (worldIn.getBlockState(pos).func_185896_q())
+ IBlockState state = worldIn.getBlockState(pos);
+ if (state.isSideSolid(worldIn, pos, EnumFacing.UP))
{
return true;
}
else
{
Block block = worldIn.getBlockState(pos).getBlock();
- Block block = worldIn.getBlockState(pos).getBlock();
- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass;
+ return block.canPlaceTorchOnTop(worldIn, pos);
+ return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
}
}
@@ -16,3 +16,26 @@
}
private synchronized void loadSoundSystem()
@@ -350,6 +352,9 @@
}
else
{
+ p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound);
+ if (p_sound == null) return;
+
if (!this.field_188777_o.isEmpty())
{
for (ISoundEventListener isoundeventlistener : this.field_188777_o)
@@ -400,10 +405,12 @@
if (sound.func_188723_h())
{
this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s));
}
else
{
this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s));
}
logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s});
@@ -56,3 +56,16 @@
{
d2 = 1.0D - d1;
i = 5;
@@ -515,6 +528,12 @@
public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_)
{
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, p_184185_2_, p_184185_3_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184185_1_ = event.getSound();
+ p_184185_2_ = event.getVolume();
+ p_184185_3_ = event.getPitch();
+
this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
}
@@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -250,6 +250,7 @@
public BlockPos func_186839_b()
{
+
BlockPos blockpos = null;
if (this.field_186853_g.objectMouseOver != null && this.field_186853_g.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
@@ -11,7 +11,22 @@
public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn)
{
this.parentScreen = parentScreenIn;
@@ -64,6 +68,7 @@
@@ -57,6 +61,14 @@
int j = 141;
this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.displayColumn * 24 - i / 2 - 12);
this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.displayRow * 24 - j / 2);
+ minecraftAchievements.clear();
+ for (Achievement achievement : AchievementList.field_187981_e)
+ {
+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement))
+ {
+ minecraftAchievements.add(achievement);
+ }
+ }
}
public void initGui()
@@ -64,6 +76,7 @@
this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS));
this.buttonList.clear();
this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0])));
@@ -19,7 +34,7 @@
}
protected void actionPerformed(GuiButton button) throws IOException
@@ -74,6 +79,16 @@
@@ -74,6 +87,16 @@
{
this.mc.displayGuiScreen(this.parentScreen);
}
@@ -36,7 +51,7 @@
}
}
@@ -257,7 +272,9 @@
@@ -257,7 +280,9 @@
GlStateManager.depthFunc(518);
GlStateManager.pushMatrix();
GlStateManager.translate((float)i1, (float)j1, -200.0F);
@@ -47,7 +62,34 @@
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableRescaleNormal();
@@ -432,6 +449,7 @@
@@ -331,11 +356,12 @@
GlStateManager.depthFunc(515);
this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5)
+ java.util.List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements());
+ for (int j5 = 0; j5 < achievementList.size(); ++j5)
{
Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5);
- if (achievement1.parentAchievement != null)
+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement))
{
int k5 = achievement1.displayColumn * 24 - i + 11;
int l5 = achievement1.displayRow * 24 - j + 11;
@@ -389,9 +415,9 @@
GlStateManager.enableRescaleNormal();
GlStateManager.enableColorMaterial();
- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6)
+ for (int i6 = 0; i6 < achievementList.size(); ++i6)
{
- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6);
+ Achievement achievement2 = achievementList.get(i6);
int l6 = achievement2.displayColumn * 24 - i;
int j7 = achievement2.displayRow * 24 - j;
@@ -432,6 +458,7 @@
this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
@@ -55,7 +97,7 @@
if (achievement2.getSpecial())
{
this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26);
@@ -440,6 +458,7 @@
@@ -440,6 +467,7 @@
{
this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26);
}
@@ -63,7 +105,7 @@
if (!this.statFileWriter.canUnlockAchievement(achievement2))
{
@@ -448,7 +467,7 @@
@@ -448,7 +476,7 @@
this.itemRender.func_175039_a(false);
}
@@ -1,25 +1,85 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -162,11 +162,18 @@
@@ -121,6 +121,12 @@
}
}
if (itemstack1.stackSize == 0)
+ ItemStack stack = mc.thePlayer.func_184614_ca();
+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, p_187103_1_, mc.thePlayer))
+ {
+ return false;
+ }
+
if (this.currentGameType.isCreative() && this.mc.thePlayer.func_184614_ca() != null && this.mc.thePlayer.func_184614_ca().getItem() instanceof ItemSword)
{
return false;
@@ -142,14 +148,7 @@
else
{
world.playAuxSFX(2001, p_187103_1_, Block.getStateId(iblockstate));
- block.onBlockHarvested(world, p_187103_1_, iblockstate, this.mc.thePlayer);
- boolean flag = world.setBlockState(p_187103_1_, Blocks.air.getDefaultState(), 11);
- if (flag)
- {
- block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate);
- }
-
this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());
if (!this.currentGameType.isCreative())
@@ -160,13 +159,20 @@
{
itemstack1.onBlockDestroyed(world, iblockstate, p_187103_1_, this.mc.thePlayer);
- if (itemstack1.stackSize == 0)
+ if (itemstack1.stackSize <= 0)
{
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND);
this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null);
}
}
}
+ boolean flag = block1.removedByPlayer(world, pos, mc.thePlayer, false);
+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, mc.thePlayer, false);
+
+ if (flag)
+ {
+ block1.onBlockDestroyedByPlayer(world, pos, iblockstate);
+ block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate);
+ }
return flag;
}
}
@@ -453,9 +460,10 @@
@@ -373,11 +379,15 @@
{
if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
+ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.getItem();
+ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_);
+ if (ret != EnumActionResult.PASS) return ret;
+
IBlockState iblockstate = p_187099_2_.getBlockState(p_187099_4_);
- if ((!p_187099_1_.isSneaking() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2))
+ if ((!p_187099_1_.isSneaking() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null))
{
- flag = true;
+ flag = iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2);
}
if (!flag && p_187099_3_ != null && p_187099_3_.getItem() instanceof ItemBlock)
@@ -418,7 +428,9 @@
}
else
{
- return p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2);
+ EnumActionResult ret = p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2);
+ if (p_187099_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_);
+ return ret;
}
}
else
@@ -453,9 +465,10 @@
{
p_187101_1_.func_184611_a(p_187101_4_, itemstack);
@@ -10,7 +10,24 @@
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.List;
@@ -460,4 +463,13 @@
@@ -143,6 +146,7 @@
public void addEffect(EntityFX effect)
{
+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
this.field_187241_h.add(effect);
}
@@ -376,7 +380,7 @@
public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
{
- if (state.func_185904_a() != Material.air)
+ if (state.getBlock().isAir(state, worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this))
{
state = state.func_185899_b(this.worldObj, pos);
int i = 4;
@@ -460,4 +464,13 @@
return "" + i;
}
@@ -97,7 +97,7 @@
this.missingImage.generateMipmaps(this.mipmapLevels);
stitcher.addSprite(this.missingImage);
+ skipFirst = false;
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3);
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2);
try
{
@@ -105,7 +105,7 @@
stitcher.doStitch();
}
catch (StitcherException stitcherexception)
@@ -150,9 +183,11 @@
@@ -150,11 +183,16 @@
}
logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath});
@@ -113,11 +113,16 @@
TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight());
Map<String, TextureAtlasSprite> map = Maps.<String, TextureAtlasSprite>newHashMap(this.mapRegisteredSprites);
+ bar.step("Uploading GL texture");
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.getStichSlots().size());
+
for (TextureAtlasSprite textureatlassprite1 : stitcher.getStichSlots())
{
+ bar.step(textureatlassprite1.getIconName());
if (textureatlassprite1 == this.missingImage || this.func_184397_a(resourceManager, textureatlassprite1))
@@ -185,6 +220,13 @@
{
String s = textureatlassprite1.getIconName();
@@ -185,6 +223,13 @@
{
textureatlassprite2.copyFrom(this.missingImage);
}
@@ -131,7 +136,7 @@
}
private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_)
@@ -317,4 +359,37 @@
@@ -317,4 +362,37 @@
{
return this.missingImage;
}
@@ -105,7 +105,7 @@
}
public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem)
@@ -746,15 +773,24 @@
@@ -746,15 +773,22 @@
protected ItemStack func_184816_a(EntityItem p_184816_1_)
{
@@ -125,13 +125,11 @@
+ public float getBreakSpeed(IBlockState state, BlockPos pos)
+ {
+ ItemStack stack = this.inventory.getCurrentItem();
+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state));
+
+ float f = this.inventory.func_184438_a(state);
if (f > 1.0F)
{
int i = EnchantmentHelper.func_185293_e(this);
@@ -804,12 +840,13 @@
@@ -804,12 +838,13 @@
f /= 5.0F;
}
@@ -147,7 +145,7 @@
}
public void readEntityFromNBT(NBTTagCompound tagCompund)
@@ -845,6 +882,16 @@
@@ -845,6 +880,16 @@
this.spawnForced = tagCompund.getBoolean("SpawnForced");
}
@@ -164,7 +162,7 @@
this.foodStats.readNBT(tagCompund);
this.capabilities.readCapabilitiesFromNBT(tagCompund);
@@ -877,6 +924,23 @@
@@ -877,6 +922,23 @@
tagCompound.setBoolean("SpawnForced", this.spawnForced);
}
@@ -188,7 +186,7 @@
this.foodStats.writeNBT(tagCompound);
this.capabilities.writeCapabilitiesToNBT(tagCompound);
tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT());
@@ -884,6 +948,7 @@
@@ -884,6 +946,7 @@
public boolean attackEntityFrom(DamageSource source, float amount)
{
@@ -196,7 +194,7 @@
if (this.isEntityInvulnerable(source))
{
return false;
@@ -966,6 +1031,7 @@
@@ -966,6 +1029,7 @@
if (this.field_184627_bm.stackSize <= 0)
{
EnumHand enumhand = this.func_184600_cs();
@@ -204,7 +202,7 @@
if (enumhand == EnumHand.MAIN_HAND)
{
@@ -1001,8 +1067,12 @@
@@ -1001,8 +1065,12 @@
{
if (!this.isEntityInvulnerable(damageSrc))
{
@@ -217,7 +215,7 @@
float f = damageAmount;
damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F);
this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount));
@@ -1067,6 +1137,7 @@
@@ -1067,6 +1135,7 @@
}
else
{
@@ -225,7 +223,7 @@
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 @@
@@ -1123,6 +1192,7 @@
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
@@ -233,7 +231,7 @@
if (targetEntity.canAttackWithItem())
{
if (!targetEntity.hitByEntity(this))
@@ -1410,6 +1482,8 @@
@@ -1410,6 +1480,8 @@
public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation)
{
@@ -242,7 +240,7 @@
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1449,9 +1523,10 @@
@@ -1449,9 +1521,10 @@
this.setSize(0.2F, 0.2F);
@@ -256,7 +254,7 @@
float f = 0.5F;
float f1 = 0.5F;
@@ -1514,13 +1589,14 @@
@@ -1514,13 +1587,14 @@
public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn)
{
@@ -274,7 +272,7 @@
if (blockpos == null)
{
@@ -1529,6 +1605,10 @@
@@ -1529,6 +1603,10 @@
this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F));
}
@@ -285,7 +283,7 @@
this.sleeping = false;
@@ -1547,14 +1627,15 @@
@@ -1547,14 +1625,15 @@
private boolean isInBed()
{
@@ -304,7 +302,7 @@
{
if (!forceSpawn)
{
@@ -1569,16 +1650,17 @@
@@ -1569,16 +1648,17 @@
}
else
{
@@ -325,7 +323,7 @@
switch (enumfacing)
{
@@ -1618,16 +1700,24 @@
@@ -1618,16 +1698,24 @@
public BlockPos getBedLocation()
{
@@ -352,7 +350,7 @@
if (pos != null)
{
this.spawnChunk = pos;
@@ -1822,6 +1912,10 @@
@@ -1822,6 +1910,10 @@
super.fall(distance, damageMultiplier);
}
@@ -363,7 +361,7 @@
}
protected void resetHeight()
@@ -2022,6 +2116,18 @@
@@ -2022,6 +2114,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));
@@ -382,7 +380,7 @@
}
protected boolean canTriggerWalking()
@@ -2120,7 +2226,10 @@
@@ -2120,7 +2224,10 @@
public ITextComponent getDisplayName()
{
@@ -394,7 +392,7 @@
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 @@
@@ -2129,7 +2236,7 @@
public float getEyeHeight()
{
@@ -403,7 +401,7 @@
if (this.isPlayerSleeping())
{
@@ -2340,6 +2449,136 @@
@@ -2340,6 +2447,136 @@
return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue();
}
@@ -57,7 +57,7 @@
Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false);
}
@@ -422,11 +431,629 @@
@@ -422,11 +431,619 @@
return false;
}
@@ -110,22 +110,12 @@
+ * @param world The Current World
+ * @param pos Target position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ * @param hand Which hand the item is being held in.
+ * @return Return PASS to allow vanilla handling, any other to skip normal code.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
+ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param state The block state
+ * @return The damage strength
+ */
+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state)
+ {
+ return getStrVsBlock(itemstack, state.getBlock());
+ return EnumActionResult.PASS;
+ }
+
+ protected boolean canRepair = true;
@@ -322,7 +312,7 @@
+ * @param player The Player that is wielding the item
+ * @return
+ */
+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player)
+ public boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player)
+ {
+ return false;
+ }
@@ -687,7 +677,7 @@
public static void registerItems()
{
registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function<ItemStack, String>()
@@ -935,6 +1562,10 @@
@@ -935,6 +1552,10 @@
private final float damageVsEntity;
private final int enchantability;
@@ -698,7 +688,7 @@
private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability)
{
this.harvestLevel = harvestLevel;
@@ -969,9 +1600,36 @@
@@ -969,9 +1590,36 @@
return this.enchantability;
}
@@ -18,8 +18,8 @@
public boolean canHarvestBlock(IBlockState blockIn)
@@ -36,4 +37,71 @@
Block block = block.getBlock();
return block != Blocks.web && block.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F;
Block block = state.getBlock();
return block != Blocks.web && state.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F;
}
+
+
@@ -19,7 +19,19 @@
}
protected ItemTool(Item.ToolMaterial p_i46746_1_, Set<Block> p_i46746_2_)
@@ -84,7 +96,9 @@
@@ -42,6 +54,11 @@
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
+ for (String type : getToolClasses(stack))
+ {
+ if (state.getBlock().isToolEffective(type, state))
+ return efficiencyOnProperMaterial;
+ }
return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F;
}
@@ -84,7 +101,9 @@
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
@@ -30,7 +42,7 @@
}
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_)
@@ -99,4 +113,38 @@
@@ -99,4 +118,27 @@
return multimap;
}
@@ -56,16 +68,5 @@
+ {
+ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack);
+ }
+
+ @Override
+ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state)
+ {
+ for (String type : getToolClasses(stack))
+ {
+ if (state.getBlock().isToolEffective(type, state))
+ return efficiencyOnProperMaterial;
+ }
+ return super.getDigSpeed(stack, state);
+ }
+ /*===================================== FORGE END =================================*/
}
@@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/util/TabCompleter.java
+++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java
@@ -53,13 +53,14 @@
this.field_186844_a.deleteFromCursor(i - this.field_186844_a.getCursorPosition());
}
- this.field_186844_a.writeText((String)this.field_186849_f.get(this.field_186848_e++));
+ this.field_186844_a.writeText(net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(this.field_186849_f.get(this.field_186848_e++)));
}
private void func_186838_a(String p_186838_1_)
{
if (p_186838_1_.length() >= 1)
{
+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_);
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b));
this.field_186847_d = true;
}
@@ -74,6 +75,12 @@
this.field_186846_c = false;
this.field_186849_f.clear();
+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete;
+ if (complete != null)
+ {
+ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class);
+ }
+
for (String s : p_186840_1_)
{
if (!s.isEmpty())
@@ -84,6 +91,7 @@
String s1 = this.field_186844_a.getText().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.getCursorPosition(), false));
String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_);
+ s2 = net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(s2);
if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2))
{
@@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java
+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java
@@ -37,28 +37,20 @@
@@ -2,6 +2,7 @@
import java.util.Random;
import net.minecraft.block.BlockSilverfish;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -37,28 +38,20 @@
public void decorate(World worldIn, Random rand, BlockPos pos)
{
super.decorate(worldIn, rand, pos);
@@ -36,7 +44,7 @@
}
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
@@ -86,4 +78,23 @@
@@ -86,4 +79,24 @@
EXTRA_TREES,
MUTATED;
}
@@ -51,7 +59,8 @@
+ {
+ BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16));
+
+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone)))
+ IBlockState state = worldIn.getBlockState(blockpos);
+ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone)))
+ {
+ worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2);
+ }
@@ -1,25 +0,0 @@
++++ REJECTED PATCH 3
}
else
{
+ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound);
+ if (sound == null) return;
+
SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation());
if (soundeventaccessorcomposite == null)
++++ END PATCH
++++ REJECTED PATCH 4
if (soundpoolentry.isStreamingSound())
{
this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s));
}
else
{
this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s));
}
logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s});
++++ END PATCH
@@ -1,14 +0,0 @@
++++ REJECTED PATCH 3
public void playSound(String name, float volume, float pitch)
{
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch);
+ if (event.isCanceled() || event.name == null) return;
+ name = event.name;
+ volume = event.newVolume;
+ pitch = event.newPitch;
+
this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false);
}
++++ END PATCH
@@ -1,40 +0,0 @@
++++ REJECTED PATCH 1
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1);
}
- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++));
+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++)));
}
private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_)
{
if (p_146405_1_.length() >= 1)
{
+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_);
BlockPos blockpos = null;
if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
++++ END PATCH
++++ REJECTED PATCH 2
this.playerNamesFound = false;
this.foundPlayerNames.clear();
+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete;
+ if (complete != null)
+ {
+ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class);
+ }
+
for (String s : p_146406_1_)
{
if (s.length() > 0)
++++ END PATCH
++++ REJECTED PATCH 3
String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false));
String s2 = StringUtils.getCommonPrefix(p_146406_1_);
+ s2 = net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(s2);
if (s2.length() > 0 && !s1.equalsIgnoreCase(s2))
{
++++ END PATCH
@@ -1,46 +0,0 @@
++++ REJECTED PATCH 2
int j = 141;
this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12);
this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2);
+ minecraftAchievements.clear();
+ for (Achievement achievement : AchievementList.achievementList)
+ {
+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement))
+ {
+ minecraftAchievements.add(achievement);
+ }
+ }
}
public void initGui()
++++ END PATCH
++++ REJECTED PATCH 6
GlStateManager.depthFunc(515);
this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5)
+ java.util.List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements());
+ for (int j5 = 0; j5 < achievementList.size(); ++j5)
{
- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5);
+ Achievement achievement1 = achievementList.get(j5);
- if (achievement1.parentAchievement != null)
+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement))
{
int k5 = achievement1.displayColumn * 24 - i + 11;
int l5 = achievement1.displayRow * 24 - j + 11;
++++ END PATCH
++++ REJECTED PATCH 7
GlStateManager.enableRescaleNormal();
GlStateManager.enableColorMaterial();
- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6)
+ for (int i6 = 0; i6 < achievementList.size(); ++i6)
{
- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6);
+ Achievement achievement2 = achievementList.get(i6);
int l6 = achievement2.displayColumn * 24 - i;
int j7 = achievement2.displayRow * 24 - j;
++++ END PATCH
@@ -1,77 +0,0 @@
++++ REJECTED PATCH 1
}
}
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer))
+ {
+ return false;
+ }
+
if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)
{
return false;
++++ END PATCH
++++ REJECTED PATCH 2
else
{
world.playAuxSFX(2001, pos, Block.getStateId(iblockstate));
- boolean flag = world.setBlockToAir(pos);
- if (flag)
- {
- block1.onBlockDestroyedByPlayer(world, pos, iblockstate);
- }
-
this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());
if (!this.currentGameType.isCreative())
++++ END PATCH
++++ REJECTED PATCH 4
{
if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
+
+ if (heldStack != null &&
+ heldStack.getItem() != null &&
+ heldStack.getItem().onItemUseFirst(heldStack, player, worldIn, hitPos, side, f, f1, f2))
+ {
+ return true;
+ }
+
IBlockState iblockstate = worldIn.getBlockState(hitPos);
- if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2))
+ if ((!player.isSneaking() || player.getHeldItem() == null || player.getHeldItem().getItem().doesSneakBypassUse(worldIn, hitPos, player)))
{
- flag = true;
+ flag = iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2);
}
if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock)
++++ END PATCH
++++ REJECTED PATCH 5
}
else
{
- return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
+ if (!heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2)) return false;
+ if (heldStack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack);
+ return true;
}
}
else
++++ END PATCH
++++ REJECTED PATCH 6
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;
- if (itemstack.stackSize == 0)
+ if (itemstack.stackSize <= 0)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack);
}
return true;
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 1
public void addEffect(EntityFX effect)
{
+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
int i = effect.getFXLayer();
int j = effect.getAlpha() != 1.0F ? 0 : 1;
++++ END PATCH
++++ REJECTED PATCH 2
public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
{
- if (state.getBlock().getMaterial() != Material.air)
+ if (!state.getBlock().isAir(worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this))
{
state = state.getBlock().getActualState(state, this.worldObj, pos);
int i = 4;
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 13
if (recordName != null)
{
ItemRecord itemrecord = ItemRecord.getRecord(recordName);
+ ResourceLocation resource = null;
if (itemrecord != null)
{
this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal());
+ resource = itemrecord.getRecordResource(recordName);
}
- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ());
+ if (resource == null) resource = new ResourceLocation(recordName);
+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ());
this.mapSoundPositions.put(blockPosIn, positionedsoundrecord);
this.mc.getSoundHandler().playSound(positionedsoundrecord);
}
++++ END PATCH
@@ -1,13 +0,0 @@
++++ REJECTED PATCH 7
this.mipmapLevels = k1;
}
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size());
for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values())
{
+ if (skipFirst) break;
+ bar.step(textureatlassprite1.getIconName());
try
{
textureatlassprite1.generateMipmaps(this.mipmapLevels);
++++ END PATCH
@@ -59,6 +59,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketBlockChange;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityNote;
@@ -671,7 +672,7 @@ public class ForgeHooks
// Tell client the block is gone immediately then process events
if (world.getTileEntity(pos) == null)
{
S23PacketBlockChange packet = new S23PacketBlockChange(world, pos);
SPacketBlockChange packet = new SPacketBlockChange(world, pos);
packet.blockState = Blocks.air.getDefaultState();
entityPlayer.playerNetServerHandler.sendPacket(packet);
}
@@ -937,4 +938,4 @@ public class ForgeHooks
MovingObjectPosition movingObjectPosition = rayTraceEyes(entity, length);
return movingObjectPosition == null ? null : movingObjectPosition.hitVec;
}
}
}
@@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -335,18 +336,7 @@ public class ForgeEventFactory
return event.canUpdate;
}
/**
* Use {@link #onPlaySoundAtEntity(Entity,String,float,float)}
*/
@Deprecated
public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch)
{
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
MinecraftForge.EVENT_BUS.post(event);
return event.name;
}
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, String name, float volume, float pitch)
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch)
{
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
MinecraftForge.EVENT_BUS.post(event);
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.util.SoundEvent;
/**
* PlaySoundAtEntityEvent is fired a sound is to be played at an Entity<br>
@@ -25,14 +26,14 @@ import net.minecraft.entity.Entity;
**/
@Cancelable
public class PlaySoundAtEntityEvent extends EntityEvent
{
public String name;
public final float volume;
public final float pitch;
public float newVolume;
public float newPitch;
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
{
private SoundEvent name;
private final float volume;
private final float pitch;
private float newVolume;
private float newPitch;
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch)
{
super(entity);
this.name = name;
@@ -41,4 +42,13 @@ public class PlaySoundAtEntityEvent extends EntityEvent
this.newVolume = volume;
this.newPitch = pitch;
}
public SoundEvent getSound(){ return this.name; }
public float getDefaultVolume() { return this.volume; }
public float getDefaultPitch() { return this.pitch; }
public float getVolume() { return this.newVolume; }
public float getPitch() { return this.newPitch; }
public void setSound(SoundEvent value) { this.name = value; }
public void setVolume(float value) { this.newVolume = value; }
public void setPitch(float value) { this.newPitch = value; }
}
@@ -6,6 +6,7 @@ import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
@@ -78,14 +79,14 @@ public class BlockEvent extends Event
this.player = player;
if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))) // If the block is being silk harvested, the exp dropped is 0
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, player.func_184614_ca()) > 0)) // If the block is being silk harvested, the exp dropped is 0
{
this.exp = 0;
}
else
{
int bonusLevel = EnchantmentHelper.getFortuneModifier(player);
this.exp = state.getBlock().getExpDrop(world, pos, bonusLevel);
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, player.func_184614_ca());
this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel);
}
}
@@ -133,13 +134,13 @@ public class BlockEvent extends Event
{
super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock());
this.player = player;
this.itemInHand = player.getCurrentEquippedItem();
this.itemInHand = player.func_184614_ca();
this.blockSnapshot = blockSnapshot;
this.placedBlock = blockSnapshot.getCurrentBlock();
this.placedAgainst = placedAgainst;
if (DEBUG)
{
System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, player.getCurrentEquippedItem(), player);
System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, itemInHand, player);
}
}
}