Skip to content

Commit d4fd12b

Browse files
Clenup hunks in creativetab & enchantment
1 parent 28ecdb5 commit d4fd12b

File tree

6 files changed

+20
-613
lines changed

6 files changed

+20
-613
lines changed

patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch

Lines changed: 3 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,6 @@
11
--- before/net/minecraft/creativetab/CreativeTabs.java
22
+++ after/net/minecraft/creativetab/CreativeTabs.java
3-
@@ -19,7 +19,6 @@
4-
public static final CreativeTabs BUILDING_BLOCKS = new CreativeTabs(0, "buildingBlocks")
5-
{
6-
@SideOnly(Side.CLIENT)
7-
- @Override
8-
public ItemStack createIcon()
9-
{
10-
return new ItemStack(Item.getItemFromBlock(Blocks.BRICK_BLOCK));
11-
@@ -28,7 +27,6 @@
12-
public static final CreativeTabs DECORATIONS = new CreativeTabs(1, "decorations")
13-
{
14-
@SideOnly(Side.CLIENT)
15-
- @Override
16-
public ItemStack createIcon()
17-
{
18-
return new ItemStack(Item.getItemFromBlock(Blocks.DOUBLE_PLANT), 1, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta());
19-
@@ -37,7 +35,6 @@
20-
public static final CreativeTabs REDSTONE = new CreativeTabs(2, "redstone")
21-
{
22-
@SideOnly(Side.CLIENT)
23-
- @Override
24-
public ItemStack createIcon()
25-
{
26-
return new ItemStack(Items.REDSTONE);
27-
@@ -46,7 +43,6 @@
28-
public static final CreativeTabs TRANSPORTATION = new CreativeTabs(3, "transportation")
29-
{
30-
@SideOnly(Side.CLIENT)
31-
- @Override
32-
public ItemStack createIcon()
33-
{
34-
return new ItemStack(Item.getItemFromBlock(Blocks.GOLDEN_RAIL));
35-
@@ -55,7 +51,6 @@
36-
public static final CreativeTabs MISC = new CreativeTabs(6, "misc")
37-
{
38-
@SideOnly(Side.CLIENT)
39-
- @Override
40-
public ItemStack createIcon()
41-
{
42-
return new ItemStack(Items.LAVA_BUCKET);
43-
@@ -64,7 +59,6 @@
44-
public static final CreativeTabs SEARCH = (new CreativeTabs(5, "search")
45-
{
46-
@SideOnly(Side.CLIENT)
47-
- @Override
48-
public ItemStack createIcon()
49-
{
50-
return new ItemStack(Items.COMPASS);
51-
@@ -73,7 +67,6 @@
52-
public static final CreativeTabs FOOD = new CreativeTabs(7, "food")
53-
{
54-
@SideOnly(Side.CLIENT)
55-
- @Override
56-
public ItemStack createIcon()
57-
{
58-
return new ItemStack(Items.APPLE);
59-
@@ -82,43 +75,22 @@
60-
public static final CreativeTabs TOOLS = (new CreativeTabs(8, "tools")
61-
{
62-
@SideOnly(Side.CLIENT)
63-
- @Override
64-
public ItemStack createIcon()
65-
{
66-
return new ItemStack(Items.IRON_AXE);
67-
}
68-
- })
69-
- .setRelevantEnchantmentTypes(
70-
- new EnumEnchantmentType[] {EnumEnchantmentType.ALL, EnumEnchantmentType.DIGGER, EnumEnchantmentType.FISHING_ROD, EnumEnchantmentType.BREAKABLE}
71-
- );
72-
+ }).setRelevantEnchantmentTypes(new EnumEnchantmentType[] {EnumEnchantmentType.ALL, EnumEnchantmentType.DIGGER, EnumEnchantmentType.FISHING_ROD, EnumEnchantmentType.BREAKABLE});
73-
public static final CreativeTabs COMBAT = (new CreativeTabs(9, "combat")
74-
{
75-
@SideOnly(Side.CLIENT)
76-
- @Override
77-
public ItemStack createIcon()
78-
{
79-
return new ItemStack(Items.GOLDEN_SWORD);
80-
}
81-
- })
82-
- .setRelevantEnchantmentTypes(
83-
- new EnumEnchantmentType[]
84-
- {
85-
- EnumEnchantmentType.ALL,
86-
- EnumEnchantmentType.ARMOR,
87-
- EnumEnchantmentType.ARMOR_FEET,
88-
- EnumEnchantmentType.ARMOR_HEAD,
89-
- EnumEnchantmentType.ARMOR_LEGS,
90-
- EnumEnchantmentType.ARMOR_CHEST,
91-
- EnumEnchantmentType.BOW,
92-
- EnumEnchantmentType.WEAPON,
93-
- EnumEnchantmentType.WEARABLE,
94-
- EnumEnchantmentType.BREAKABLE
95-
- }
96-
- );
97-
+ }).setRelevantEnchantmentTypes(new EnumEnchantmentType[] {EnumEnchantmentType.ALL, EnumEnchantmentType.ARMOR, EnumEnchantmentType.ARMOR_FEET, EnumEnchantmentType.ARMOR_HEAD, EnumEnchantmentType.ARMOR_LEGS, EnumEnchantmentType.ARMOR_CHEST, EnumEnchantmentType.BOW, EnumEnchantmentType.WEAPON, EnumEnchantmentType.WEARABLE, EnumEnchantmentType.BREAKABLE});
98-
public static final CreativeTabs BREWING = new CreativeTabs(10, "brewing")
99-
{
100-
@SideOnly(Side.CLIENT)
101-
- @Override
102-
public ItemStack createIcon()
103-
{
104-
return PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER);
105-
@@ -128,19 +100,16 @@
106-
public static final CreativeTabs HOTBAR = new CreativeTabs(4, "hotbar")
107-
{
108-
@SideOnly(Side.CLIENT)
109-
- @Override
110-
public ItemStack createIcon()
111-
{
112-
return new ItemStack(Blocks.BOOKSHELF);
113-
}
114-
@SideOnly(Side.CLIENT)
115-
- @Override
116-
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_)
117-
{
118-
throw new RuntimeException("Implement exception client-side.");
119-
}
120-
@SideOnly(Side.CLIENT)
121-
- @Override
122-
public boolean isAlignedRight()
123-
{
124-
return true;
125-
@@ -149,7 +118,6 @@
126-
public static final CreativeTabs INVENTORY = (new CreativeTabs(11, "inventory")
127-
{
128-
@SideOnly(Side.CLIENT)
129-
- @Override
130-
public ItemStack createIcon()
131-
{
132-
return new ItemStack(Item.getItemFromBlock(Blocks.CHEST));
133-
@@ -163,8 +131,22 @@
3+
@@ -163,8 +163,22 @@
1344
private EnumEnchantmentType[] enchantmentTypes = new EnumEnchantmentType[0];
1355
private ItemStack icon;
1366

@@ -153,33 +23,7 @@
15323
this.index = index;
15424
this.tabLabel = label;
15525
this.icon = ItemStack.EMPTY;
156-
@@ -177,6 +159,12 @@
157-
return this.index;
158-
}
159-
160-
+ public CreativeTabs setBackgroundImageName(String texture)
161-
+ {
162-
+ this.backgroundTexture = texture;
163-
+ return this;
164-
+ }
165-
+
166-
@SideOnly(Side.CLIENT)
167-
public String getTabLabel()
168-
{
169-
@@ -209,12 +197,6 @@
170-
return this.backgroundTexture;
171-
}
172-
173-
- public CreativeTabs setBackgroundImageName(String texture)
174-
- {
175-
- this.backgroundTexture = texture;
176-
- return this;
177-
- }
178-
-
179-
@SideOnly(Side.CLIENT)
180-
public boolean drawInForegroundOfTab()
181-
{
182-
@@ -242,12 +224,20 @@
26+
@@ -242,12 +256,20 @@
18327
@SideOnly(Side.CLIENT)
18428
public int getColumn()
18529
{
@@ -200,7 +44,7 @@
20044
return this.index < 6;
20145
}
20246

203-
@@ -291,5 +281,51 @@
47+
@@ -291,5 +313,51 @@
20448
{
20549
item.getSubItems(this, p_78018_1_);
20650
}

patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch

Lines changed: 6 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212
private final EntityEquipmentSlot[] applicableEquipmentTypes;
1313
private final Enchantment.Rarity rarity;
1414
@Nullable
15-
@@ -49,7 +49,7 @@
16-
17-
public List<ItemStack> getEntityEquipment(EntityLivingBase entityIn)
18-
{
19-
- List<ItemStack> list = Lists.newArrayList();
20-
+ List<ItemStack> list = Lists.<ItemStack>newArrayList();
21-
22-
for (EntityEquipmentSlot entityequipmentslot : this.applicableEquipmentTypes)
23-
{
2415
@@ -134,7 +134,7 @@
2516

2617
public boolean canApply(ItemStack stack)
@@ -30,10 +21,12 @@
3021
}
3122

3223
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
33-
@@ -155,78 +155,59 @@
24+
@@ -153,6 +153,26 @@
25+
public boolean isCurse()
26+
{
3427
return false;
35-
}
36-
28+
+ }
29+
+
3730
+ /**
3831
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
3932
+ * applies for <i>all possible</i> enchantments.
@@ -52,105 +45,6 @@
5245
+ public boolean isAllowedOnBooks()
5346
+ {
5447
+ return true;
55-
+ }
56-
+
57-
public static void registerEnchantments()
58-
{
59-
- EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[]
60-
- {
61-
- EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET
62-
- };
63-
- REGISTRY.register(
64-
- 0, new ResourceLocation("protection"), new EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.ALL, aentityequipmentslot)
65-
- );
66-
- REGISTRY.register(
67-
- 1,
68-
- new ResourceLocation("fire_protection"),
69-
- new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FIRE, aentityequipmentslot)
70-
- );
71-
- REGISTRY.register(
72-
- 2,
73-
- new ResourceLocation("feather_falling"),
74-
- new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FALL, aentityequipmentslot)
75-
- );
76-
- REGISTRY.register(
77-
- 3,
78-
- new ResourceLocation("blast_protection"),
79-
- new EnchantmentProtection(Enchantment.Rarity.RARE, EnchantmentProtection.Type.EXPLOSION, aentityequipmentslot)
80-
- );
81-
- REGISTRY.register(
82-
- 4,
83-
- new ResourceLocation("projectile_protection"),
84-
- new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.PROJECTILE, aentityequipmentslot)
85-
- );
86-
+ EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
87-
+ REGISTRY.register(0, new ResourceLocation("protection"), new EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.ALL, aentityequipmentslot));
88-
+ REGISTRY.register(1, new ResourceLocation("fire_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FIRE, aentityequipmentslot));
89-
+ REGISTRY.register(2, new ResourceLocation("feather_falling"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FALL, aentityequipmentslot));
90-
+ REGISTRY.register(3, new ResourceLocation("blast_protection"), new EnchantmentProtection(Enchantment.Rarity.RARE, EnchantmentProtection.Type.EXPLOSION, aentityequipmentslot));
91-
+ REGISTRY.register(4, new ResourceLocation("projectile_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.PROJECTILE, aentityequipmentslot));
92-
REGISTRY.register(5, new ResourceLocation("respiration"), new EnchantmentOxygen(Enchantment.Rarity.RARE, aentityequipmentslot));
93-
REGISTRY.register(6, new ResourceLocation("aqua_affinity"), new EnchantmentWaterWorker(Enchantment.Rarity.RARE, aentityequipmentslot));
94-
REGISTRY.register(7, new ResourceLocation("thorns"), new EnchantmentThorns(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
95-
REGISTRY.register(8, new ResourceLocation("depth_strider"), new EnchantmentWaterWalker(Enchantment.Rarity.RARE, aentityequipmentslot));
96-
- REGISTRY.register(9, new ResourceLocation("frost_walker"), new EnchantmentFrostWalker(Enchantment.Rarity.RARE, EntityEquipmentSlot.FEET));
97-
+ REGISTRY.register(9, new ResourceLocation("frost_walker"), new EnchantmentFrostWalker(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.FEET}));
98-
REGISTRY.register(10, new ResourceLocation("binding_curse"), new EnchantmentBindingCurse(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
99-
- REGISTRY.register(16, new ResourceLocation("sharpness"), new EnchantmentDamage(Enchantment.Rarity.COMMON, 0, EntityEquipmentSlot.MAINHAND));
100-
- REGISTRY.register(17, new ResourceLocation("smite"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 1, EntityEquipmentSlot.MAINHAND));
101-
- REGISTRY.register(
102-
- 18, new ResourceLocation("bane_of_arthropods"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 2, EntityEquipmentSlot.MAINHAND)
103-
- );
104-
- REGISTRY.register(19, new ResourceLocation("knockback"), new EnchantmentKnockback(Enchantment.Rarity.UNCOMMON, EntityEquipmentSlot.MAINHAND));
105-
- REGISTRY.register(20, new ResourceLocation("fire_aspect"), new EnchantmentFireAspect(Enchantment.Rarity.RARE, EntityEquipmentSlot.MAINHAND));
106-
- REGISTRY.register(
107-
- 21, new ResourceLocation("looting"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.WEAPON, EntityEquipmentSlot.MAINHAND)
108-
- );
109-
- REGISTRY.register(22, new ResourceLocation("sweeping"), new EnchantmentSweepingEdge(Enchantment.Rarity.RARE, EntityEquipmentSlot.MAINHAND));
110-
- REGISTRY.register(32, new ResourceLocation("efficiency"), new EnchantmentDigging(Enchantment.Rarity.COMMON, EntityEquipmentSlot.MAINHAND));
111-
- REGISTRY.register(
112-
- 33, new ResourceLocation("silk_touch"), new EnchantmentUntouching(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.MAINHAND)
113-
- );
114-
- REGISTRY.register(34, new ResourceLocation("unbreaking"), new EnchantmentDurability(Enchantment.Rarity.UNCOMMON, EntityEquipmentSlot.MAINHAND));
115-
- REGISTRY.register(
116-
- 35, new ResourceLocation("fortune"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.DIGGER, EntityEquipmentSlot.MAINHAND)
117-
- );
118-
- REGISTRY.register(48, new ResourceLocation("power"), new EnchantmentArrowDamage(Enchantment.Rarity.COMMON, EntityEquipmentSlot.MAINHAND));
119-
- REGISTRY.register(49, new ResourceLocation("punch"), new EnchantmentArrowKnockback(Enchantment.Rarity.RARE, EntityEquipmentSlot.MAINHAND));
120-
- REGISTRY.register(50, new ResourceLocation("flame"), new EnchantmentArrowFire(Enchantment.Rarity.RARE, EntityEquipmentSlot.MAINHAND));
121-
- REGISTRY.register(
122-
- 51, new ResourceLocation("infinity"), new EnchantmentArrowInfinite(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.MAINHAND)
123-
- );
124-
- REGISTRY.register(
125-
- 61,
126-
- new ResourceLocation("luck_of_the_sea"),
127-
- new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, EntityEquipmentSlot.MAINHAND)
128-
- );
129-
- REGISTRY.register(
130-
- 62, new ResourceLocation("lure"), new EnchantmentFishingSpeed(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, EntityEquipmentSlot.MAINHAND)
131-
- );
132-
+ REGISTRY.register(16, new ResourceLocation("sharpness"), new EnchantmentDamage(Enchantment.Rarity.COMMON, 0, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
133-
+ REGISTRY.register(17, new ResourceLocation("smite"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 1, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
134-
+ REGISTRY.register(18, new ResourceLocation("bane_of_arthropods"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 2, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
135-
+ REGISTRY.register(19, new ResourceLocation("knockback"), new EnchantmentKnockback(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
136-
+ REGISTRY.register(20, new ResourceLocation("fire_aspect"), new EnchantmentFireAspect(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
137-
+ REGISTRY.register(21, new ResourceLocation("looting"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
138-
+ REGISTRY.register(22, new ResourceLocation("sweeping"), new EnchantmentSweepingEdge(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
139-
+ REGISTRY.register(32, new ResourceLocation("efficiency"), new EnchantmentDigging(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
140-
+ REGISTRY.register(33, new ResourceLocation("silk_touch"), new EnchantmentUntouching(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
141-
+ REGISTRY.register(34, new ResourceLocation("unbreaking"), new EnchantmentDurability(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
142-
+ REGISTRY.register(35, new ResourceLocation("fortune"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
143-
+ REGISTRY.register(48, new ResourceLocation("power"), new EnchantmentArrowDamage(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
144-
+ REGISTRY.register(49, new ResourceLocation("punch"), new EnchantmentArrowKnockback(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
145-
+ REGISTRY.register(50, new ResourceLocation("flame"), new EnchantmentArrowFire(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
146-
+ REGISTRY.register(51, new ResourceLocation("infinity"), new EnchantmentArrowInfinite(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
147-
+ REGISTRY.register(61, new ResourceLocation("luck_of_the_sea"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
148-
+ REGISTRY.register(62, new ResourceLocation("lure"), new EnchantmentFishingSpeed(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
149-
REGISTRY.register(70, new ResourceLocation("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EntityEquipmentSlot.values()));
150-
- REGISTRY.register(
151-
- 71, new ResourceLocation("vanishing_curse"), new EnchantmentVanishingCurse(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.values())
152-
- );
153-
+ REGISTRY.register(71, new ResourceLocation("vanishing_curse"), new EnchantmentVanishingCurse(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.values()));
15448
}
15549

156-
public static enum Rarity
50+
public static void registerEnchantments()

0 commit comments

Comments
 (0)