ItemBlock, ItemBow, ItemMonsterPlacer, ItemReed, ItemSign rejects fixed.
This commit is contained in:
parent
a8a69775a1
commit
bf63855292
8 changed files with 72 additions and 129 deletions
|
@ -1,6 +1,24 @@
|
|||
--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java
|
||||
@@ -163,4 +163,26 @@
|
||||
@@ -55,16 +55,8 @@
|
||||
int i = this.getMetadata(stack.getMetadata());
|
||||
IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn);
|
||||
|
||||
- if (worldIn.setBlockState(pos, iblockstate1, 3))
|
||||
+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1))
|
||||
{
|
||||
- iblockstate1 = worldIn.getBlockState(pos);
|
||||
-
|
||||
- if (iblockstate1.getBlock() == this.block)
|
||||
- {
|
||||
- setTileEntityNBT(worldIn, playerIn, pos, stack);
|
||||
- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack);
|
||||
- }
|
||||
-
|
||||
worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F);
|
||||
--stack.stackSize;
|
||||
}
|
||||
@@ -163,4 +155,26 @@
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
|
@ -20,7 +38,7 @@
|
|||
+ IBlockState state = world.getBlockState(pos);
|
||||
+ if (state.getBlock() == this.block)
|
||||
+ {
|
||||
+ setTileEntityNBT(world, pos, stack, player);
|
||||
+ setTileEntityNBT(world, player, pos, stack);
|
||||
+ this.block.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
--- ../src-base/minecraft/net/minecraft/item/ItemBow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java
|
||||
@@ -105,6 +105,9 @@
|
||||
@@ -28,6 +28,9 @@
|
||||
if (flag || playerIn.inventory.hasItem(Items.arrow))
|
||||
{
|
||||
int i = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
+ i = event.charge;
|
||||
float f = (float)i / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
|
||||
@@ -105,6 +108,9 @@
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
|
||||
if (s1 != null)
|
||||
{
|
||||
@@ -51,7 +51,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata()));
|
||||
+ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack);
|
||||
return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
if (tileentity instanceof TileEntityMobSpawner)
|
||||
{
|
||||
|
@ -36,7 +45,38 @@
|
|||
|
||||
if (entity != null)
|
||||
{
|
||||
@@ -209,5 +209,28 @@
|
||||
@@ -172,19 +172,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated // Use string version below.
|
||||
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
|
||||
{
|
||||
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z)
|
||||
+ {
|
||||
+ if (!EntityList.stringToClassMapping.containsKey(name))
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
Entity entity = null;
|
||||
|
||||
for (int i = 0; i < 1; ++i)
|
||||
{
|
||||
- entity = EntityList.createEntityByID(entityID, worldIn);
|
||||
+ entity = EntityList.createEntityByName(name, worldIn);
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
@@ -209,5 +219,28 @@
|
||||
{
|
||||
subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID));
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
int i = this.getMetadata(stack.getMetadata());
|
||||
IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn);
|
||||
|
||||
- if (worldIn.setBlockState(pos, iblockstate1, 3))
|
||||
+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1))
|
||||
{
|
||||
- iblockstate1 = worldIn.getBlockState(pos);
|
||||
-
|
||||
- if (iblockstate1.getBlock() == this.block)
|
||||
- {
|
||||
- setTileEntityNBT(worldIn, pos, stack);
|
||||
- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack);
|
||||
- }
|
||||
-
|
||||
worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F);
|
||||
--stack.stackSize;
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 2
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Use player sensitive version
|
||||
public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack)
|
||||
{
|
||||
+ return setTileEntityNBT(worldIn, pos, stack, null);
|
||||
+ }
|
||||
+ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player)
|
||||
+ {
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity != null)
|
||||
{
|
||||
+ //Forge: Fixes MC-75630 - Exploit with signs and command blocks
|
||||
+ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer();
|
||||
+ if (!worldIn.isRemote && tileentity.restrictNBTCopy() &&
|
||||
+ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile())))
|
||||
+ return false;
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy();
|
||||
tileentity.writeToNBT(nbttagcompound);
|
||||
++++ END PATCH
|
|
@ -1,18 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
|
||||
{
|
||||
+ int j = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
+ j = event.charge;
|
||||
+
|
||||
boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
|
||||
if (flag || playerIn.inventory.hasItem(Items.arrow))
|
||||
{
|
||||
- int j = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
float f = (float)j / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
|
||||
++++ END PATCH
|
|
@ -1,42 +0,0 @@
|
|||
++++ REJECTED PATCH 2
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata()));
|
||||
+ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack);
|
||||
return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215;
|
||||
}
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 6
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated // Use string version below.
|
||||
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
|
||||
{
|
||||
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z)
|
||||
+ {
|
||||
+ if (!EntityList.stringToClassMapping.containsKey(name))
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
Entity entity = null;
|
||||
|
||||
for (int j = 0; j < 1; ++j)
|
||||
{
|
||||
- entity = EntityList.createEntityByID(entityID, worldIn);
|
||||
+ entity = EntityList.createEntityByName(name, worldIn);
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
++++ END PATCH
|
|
@ -1,10 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
|
||||
if (iblockstate1.getBlock() == this.block)
|
||||
{
|
||||
- ItemBlock.setTileEntityNBT(worldIn, pos, stack);
|
||||
+ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn);
|
||||
iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack);
|
||||
}
|
||||
|
||||
++++ END PATCH
|
|
@ -1,10 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
--stack.stackSize;
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack))
|
||||
+ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn))
|
||||
{
|
||||
playerIn.openEditSign((TileEntitySign)tileentity);
|
||||
}
|
||||
++++ END PATCH
|
Loading…
Reference in a new issue