Skip to content

Commit 47f1071

Browse files
Cleanup item
1 parent 9fc88a3 commit 47f1071

27 files changed

+247
-3285
lines changed

patches/minecraft/net/minecraft/item/Item.java.patch

Lines changed: 18 additions & 854 deletions
Large diffs are not rendered by default.

patches/minecraft/net/minecraft/item/ItemArmor.java.patch

Lines changed: 7 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,7 @@
11
--- before/net/minecraft/item/ItemArmor.java
22
+++ after/net/minecraft/item/ItemArmor.java
3-
@@ -21,6 +21,7 @@
4-
import net.minecraft.util.ActionResult;
5-
import net.minecraft.util.EntitySelectors;
6-
import net.minecraft.util.EnumActionResult;
7-
+import net.minecraft.util.EnumFacing;
8-
import net.minecraft.util.EnumHand;
9-
import net.minecraft.util.SoundEvent;
10-
import net.minecraft.util.math.AxisAlignedBB;
11-
@@ -32,23 +33,10 @@
12-
public class ItemArmor extends Item
13-
{
14-
private static final int[] MAX_DAMAGE_ARRAY = new int[] {13, 15, 16, 11};
15-
- private static final UUID[] ARMOR_MODIFIERS = new UUID[]
16-
- {
17-
- UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"),
18-
- UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"),
19-
- UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"),
20-
- UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")
21-
- };
22-
- public static final String[] EMPTY_SLOT_NAMES = new String[]
23-
- {
24-
- "minecraft:items/empty_armor_slot_boots",
25-
- "minecraft:items/empty_armor_slot_leggings",
26-
- "minecraft:items/empty_armor_slot_chestplate",
27-
- "minecraft:items/empty_armor_slot_helmet"
28-
- };
29-
+ private static final UUID[] ARMOR_MODIFIERS = new UUID[] {UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
30-
+ public static final String[] EMPTY_SLOT_NAMES = new String[] {"minecraft:items/empty_armor_slot_boots", "minecraft:items/empty_armor_slot_leggings", "minecraft:items/empty_armor_slot_chestplate", "minecraft:items/empty_armor_slot_helmet"};
31-
public static final IBehaviorDispenseItem DISPENSER_BEHAVIOR = new BehaviorDefaultDispenseItem()
32-
{
33-
- @Override
34-
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
35-
{
36-
ItemStack itemstack = ItemArmor.dispenseArmor(source, stack);
37-
@@ -63,11 +51,8 @@
38-
39-
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
40-
{
41-
- BlockPos blockpos = blockSource.getBlockPos().offset(blockSource.getBlockState().getValue(BlockDispenser.FACING));
42-
- List<EntityLivingBase> list = blockSource.getWorld()
43-
- .getEntitiesWithinAABB(
44-
- EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack))
45-
- );
46-
+ BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
47-
+ List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));
48-
49-
if (list.isEmpty())
50-
{
51-
@@ -108,7 +93,6 @@
52-
return this.armorType;
53-
}
54-
55-
- @Override
56-
public int getItemEnchantability()
57-
{
58-
return this.material.getEnchantability();
59-
@@ -128,9 +112,7 @@
60-
else
61-
{
62-
NBTTagCompound nbttagcompound = stack.getTagCompound();
63-
- return nbttagcompound != null && nbttagcompound.hasKey("display", 10)
64-
- ? nbttagcompound.getCompoundTag("display").hasKey("color", 3)
65-
- : false;
66-
+ return nbttagcompound != null && nbttagcompound.hasKey("display", 10) ? nbttagcompound.getCompoundTag("display").hasKey("color", 3) : false;
67-
}
68-
}
69-
70-
@@ -203,13 +185,13 @@
71-
}
72-
}
73-
74-
- @Override
3+
@@ -206,7 +206,9 @@
4+
@Override
755
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
766
{
777
- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
@@ -80,43 +10,8 @@
8010
+ return super.getIsRepairable(toRepair, repair);
8111
}
8212

83-
- @Override
84-
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
85-
{
86-
ItemStack itemstack = playerIn.getHeldItem(handIn);
87-
@@ -220,34 +202,40 @@
88-
{
89-
playerIn.setItemStackToSlot(entityequipmentslot, itemstack.copy());
90-
itemstack.setCount(0);
91-
- return new ActionResult<>(EnumActionResult.SUCCESS, itemstack);
92-
+ return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
93-
}
94-
else
95-
{
96-
- return new ActionResult<>(EnumActionResult.FAIL, itemstack);
97-
+ return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemstack);
98-
}
99-
}
100-
101-
- @Override
102-
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
103-
{
104-
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
105-
106-
if (equipmentSlot == this.armorType)
107-
{
108-
- multimap.put(
109-
- SharedMonsterAttributes.ARMOR.getName(),
110-
- new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", this.damageReduceAmount, 0)
111-
- );
112-
- multimap.put(
113-
- SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(),
114-
- new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", this.toughness, 0)
115-
- );
116-
+ multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", (double)this.damageReduceAmount, 0));
117-
+ multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", (double)this.toughness, 0));
118-
}
119-
13+
@Override
14+
@@ -248,6 +250,19 @@
12015
return multimap;
12116
}
12217

@@ -136,7 +31,7 @@
13631
public static enum ArmorMaterial
13732
{
13833
LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F),
139-
@@ -262,6 +250,8 @@
34+
@@ -262,6 +277,8 @@
14035
private final int enchantability;
14136
private final SoundEvent soundEvent;
14237
private final float toughness;
@@ -145,15 +40,15 @@
14540

14641
private ArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountArrayIn, int enchantabilityIn, SoundEvent soundEventIn, float toughnessIn)
14742
{
148-
@@ -293,6 +283,7 @@
43+
@@ -293,6 +310,7 @@
14944
return this.soundEvent;
15045
}
15146

15247
+ @Deprecated // Use getRepairItemStack below
15348
public Item getRepairItem()
15449
{
15550
if (this == LEATHER)
156-
@@ -326,6 +317,22 @@
51+
@@ -326,6 +344,22 @@
15752
public float getToughness()
15853
{
15954
return this.toughness;
Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
--- before/net/minecraft/item/ItemAxe.java
22
+++ after/net/minecraft/item/ItemAxe.java
3-
@@ -9,19 +9,7 @@
4-
5-
public class ItemAxe extends ItemTool
6-
{
7-
- private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(
8-
- Blocks.PLANKS,
9-
- Blocks.BOOKSHELF,
10-
- Blocks.LOG,
11-
- Blocks.LOG2,
12-
- Blocks.CHEST,
13-
- Blocks.PUMPKIN,
14-
- Blocks.LIT_PUMPKIN,
15-
- Blocks.MELON_BLOCK,
16-
- Blocks.LADDER,
17-
- Blocks.WOODEN_BUTTON,
18-
- Blocks.WOODEN_PRESSURE_PLATE
19-
- );
20-
+ private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
21-
private static final float[] ATTACK_DAMAGES = new float[] {6.0F, 8.0F, 8.0F, 8.0F, 6.0F};
22-
private static final float[] ATTACK_SPEEDS = new float[] { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F};
23-
24-
@@ -32,12 +20,16 @@
3+
@@ -32,7 +32,13 @@
254
this.attackSpeed = ATTACK_SPEEDS[material.ordinal()];
265
}
276

@@ -36,9 +15,3 @@
3615
public float getDestroySpeed(ItemStack stack, IBlockState state)
3716
{
3817
Material material = state.getMaterial();
39-
- return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE
40-
- ? super.getDestroySpeed(stack, state)
41-
- : this.efficiency;
42-
+ return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getDestroySpeed(stack, state) : this.efficiency;
43-
}
44-
}
Lines changed: 5 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,11 @@
11
--- before/net/minecraft/item/ItemBed.java
22
+++ after/net/minecraft/item/ItemBed.java
3-
@@ -29,17 +29,7 @@
4-
this.setHasSubtypes(true);
5-
}
6-
7-
- @Override
8-
- public EnumActionResult onItemUse(
9-
- EntityPlayer player,
10-
- World worldIn,
11-
- BlockPos pos,
12-
- EnumHand hand,
13-
- EnumFacing facing,
14-
- float hitX,
15-
- float hitY,
16-
- float hitZ
17-
- )
18-
+ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
19-
{
20-
if (worldIn.isRemote)
21-
{
22-
@@ -60,7 +50,7 @@
23-
pos = pos.up();
24-
}
25-
26-
- int i = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5) & 3;
27-
+ int i = MathHelper.floor((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
28-
EnumFacing enumfacing = EnumFacing.byHorizontalIndex(i);
29-
BlockPos blockpos = pos.offset(enumfacing);
30-
ItemStack itemstack = player.getHeldItem(hand);
31-
@@ -72,27 +62,13 @@
32-
boolean flag2 = flag || worldIn.isAirBlock(pos);
33-
boolean flag3 = flag1 || worldIn.isAirBlock(blockpos);
34-
35-
- if (flag2
36-
- && flag3
37-
- && worldIn.getBlockState(pos.down()).isTopSolid()
38-
- && worldIn.getBlockState(blockpos.down()).isTopSolid())
39-
+ if (flag2 && flag3 && worldIn.getBlockState(pos.down()).isTopSolid() && worldIn.getBlockState(blockpos.down()).isTopSolid())
40-
{
41-
- IBlockState iblockstate2 = Blocks.BED
42-
- .getDefaultState()
43-
- .withProperty(BlockBed.OCCUPIED, false)
44-
- .withProperty(BlockBed.FACING, enumfacing)
45-
- .withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
46-
+ IBlockState iblockstate2 = Blocks.BED.getDefaultState().withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)).withProperty(BlockBed.FACING, enumfacing).withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
3+
@@ -84,7 +84,7 @@
4+
.withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
475
worldIn.setBlockState(pos, iblockstate2, 10);
486
worldIn.setBlockState(blockpos, iblockstate2.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD), 10);
497
- SoundType soundtype = iblockstate2.getBlock().getSoundType();
50-
- worldIn.playSound(
51-
- null,
52-
- pos,
53-
- soundtype.getPlaceSound(),
54-
- SoundCategory.BLOCKS,
55-
- (soundtype.getVolume() + 1.0F) / 2.0F,
56-
- soundtype.getPitch() * 0.8F
57-
- );
588
+ SoundType soundtype = iblockstate2.getBlock().getSoundType(iblockstate2, worldIn, pos, player);
59-
+ worldIn.playSound((EntityPlayer)null, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
60-
TileEntity tileentity = worldIn.getTileEntity(blockpos);
61-
62-
if (tileentity instanceof TileEntityBed)
63-
@@ -130,18 +106,16 @@
64-
}
65-
}
66-
67-
- @Override
68-
public String getTranslationKey(ItemStack stack)
69-
{
70-
return super.getTranslationKey() + "." + EnumDyeColor.byMetadata(stack.getMetadata()).getTranslationKey();
71-
}
72-
73-
- @Override
74-
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
75-
{
76-
if (this.isInCreativeTab(tab))
77-
{
78-
- for (int i = 0; i < 16; i++)
79-
+ for (int i = 0; i < 16; ++i)
80-
{
81-
items.add(new ItemStack(this, 1, i));
82-
}
9+
worldIn.playSound(
10+
null,
11+
pos,

0 commit comments

Comments
 (0)