-
Notifications
You must be signed in to change notification settings - Fork 81
/
NetherClientProxy.java
253 lines (203 loc) · 14.6 KB
/
NetherClientProxy.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
package com.progwml6.natura.nether;
import static com.progwml6.natura.common.ModelRegisterUtil.registerItemBlockMeta;
import static com.progwml6.natura.common.ModelRegisterUtil.registerItemModel;
import javax.annotation.Nonnull;
import com.progwml6.natura.common.ClientProxy;
import com.progwml6.natura.common.block.BlockEnumBerryBush;
import com.progwml6.natura.common.client.LeavesColorizer;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.library.client.state.CustomStateMap;
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves;
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves2;
import com.progwml6.natura.nether.block.logs.BlockNetherLog;
import com.progwml6.natura.nether.block.logs.BlockNetherLog2;
import com.progwml6.natura.nether.block.saplings.BlockNetherSapling;
import com.progwml6.natura.nether.block.saplings.BlockNetherSapling2;
import com.progwml6.natura.nether.block.shrooms.BlockNetherGlowshroom;
import com.progwml6.natura.nether.block.shrooms.BlockNetherLargeGlowshroom;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockHopper;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.ModelLoader;
public class NetherClientProxy extends ClientProxy
{
public static Minecraft minecraft = Minecraft.getMinecraft();
@Override
public void preInit()
{
super.preInit();
}
@Override
public void init()
{
final BlockColors blockColors = minecraft.getBlockColors();
blockColors.registerBlockColorHandler(new IBlockColor()
{
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex)
{
return LeavesColorizer.noColor;
}
}, NaturaNether.netherLeaves);
blockColors.registerBlockColorHandler(new IBlockColor()
{
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex)
{
return LeavesColorizer.noColor;
}
}, NaturaNether.netherLeaves2);
minecraft.getItemColors().registerItemColorHandler(new IItemColor()
{
@Override
public int colorMultiplier(@Nonnull ItemStack stack, int tintIndex)
{
@SuppressWarnings("deprecation")
IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
return blockColors.colorMultiplier(iblockstate, null, null, tintIndex);
}
}, NaturaNether.netherLeaves, NaturaNether.netherLeaves2);
super.init();
}
@Override
protected void registerModels()
{
// blocks
ModelLoader.setCustomStateMapper(NaturaNether.netherLeaves, (new StateMap.Builder()).ignore(BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE).build());
ModelLoader.setCustomStateMapper(NaturaNether.netherLeaves2, (new StateMap.Builder()).ignore(BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE).build());
ModelLoader.setCustomStateMapper(NaturaNether.netherSapling, (new StateMap.Builder()).ignore(BlockNetherSapling.STAGE, BlockSapling.TYPE).build());
ModelLoader.setCustomStateMapper(NaturaNether.netherSapling2, (new StateMap.Builder()).ignore(BlockNetherSapling2.STAGE, BlockSapling.TYPE).build());
ModelLoader.setCustomStateMapper(NaturaNether.ghostwoodDoor, (new StateMap.Builder()).ignore(BlockDoor.POWERED).build());
ModelLoader.setCustomStateMapper(NaturaNether.bloodwoodDoor, (new StateMap.Builder()).ignore(BlockDoor.POWERED).build());
ModelLoader.setCustomStateMapper(NaturaNether.blazeHopper, (new StateMap.Builder()).ignore(BlockHopper.ENABLED).build());
registerItemBlockMeta(NaturaNether.netherPlanks);
registerItemBlockMeta(NaturaNether.netherTaintedSoil);
registerItemBlockMeta(NaturaNether.netherGlass);
registerItemBlockMeta(NaturaNether.netherSlab);
registerItemBlockMeta(NaturaNether.respawnObelisk);
registerItemModel(NaturaNether.netherStairsGhostwood);
registerItemModel(NaturaNether.netherStairsBloodwood);
registerItemModel(NaturaNether.netherStairsDarkwood);
registerItemModel(NaturaNether.netherStairsFusewood);
Item heatSandItem = Item.getItemFromBlock(NaturaNether.netherHeatSand);
ModelLoader.setCustomModelResourceLocation(heatSandItem, 0, new ModelResourceLocation(Util.resource("nether_heat_sand"), "normal"));
ModelLoader.setCustomStateMapper(NaturaNether.netherThornVines, new CustomStateMap("nether_thorn_vine"));
this.registerItemModelNatura(new ItemStack(NaturaNether.netherThornVines), "nether_thorn_vine");
// logs
Item nether_log = Item.getItemFromBlock(NaturaNether.netherLog);
for (BlockNetherLog.LogType type : BlockNetherLog.LogType.values())
{
String variant = String.format("%s=%s,%s=%s", BlockNetherLog.LOG_AXIS.getName(),
BlockNetherLog.LOG_AXIS.getName(BlockNetherLog.EnumAxis.Y), BlockNetherLog.TYPE.getName(),
BlockNetherLog.TYPE.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_log, type.meta, new ModelResourceLocation(nether_log.getRegistryName(), variant));
}
Item nether_log2 = Item.getItemFromBlock(NaturaNether.netherLog2);
for (int meta = 0; meta <= 15; meta++)
{
String variant = String.format("%s=%s", BlockNetherLog2.META.getName(), Integer.valueOf(meta));
ModelLoader.setCustomModelResourceLocation(nether_log2, meta, new ModelResourceLocation(nether_log2.getRegistryName(), variant));
}
// leaves
Item nether_leaves = Item.getItemFromBlock(NaturaNether.netherLeaves);
for (BlockNetherLeaves.LeavesType type : BlockNetherLeaves.LeavesType.values())
{
String variant = String.format("%s=%s", BlockNetherLeaves.TYPE.getName(), BlockNetherLeaves.TYPE.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_leaves, type.getMeta(), new ModelResourceLocation(nether_leaves.getRegistryName(), variant));
}
Item nether_leaves2 = Item.getItemFromBlock(NaturaNether.netherLeaves2);
for (BlockNetherLeaves2.LeavesType type : BlockNetherLeaves2.LeavesType.values())
{
String variant = String.format("%s=%s", BlockNetherLeaves2.TYPE.getName(), BlockNetherLeaves2.TYPE.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_leaves2, type.getMeta(), new ModelResourceLocation(nether_leaves2.getRegistryName(), variant));
}
// saplings
ItemStack stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.GHOSTWOOD)));
this.registerItemModelNatura(stack, "nether_sapling_ghostwood");
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.FUSEWOOD)));
this.registerItemModelNatura(stack, "nether_sapling_fusewood");
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.DARKWOOD)));
this.registerItemModelNatura(stack, "nether_sapling_darkwood");
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling2), 1, NaturaNether.netherSapling2.getMetaFromState(NaturaNether.netherSapling2.getDefaultState().withProperty(BlockNetherSapling2.FOLIAGE, BlockNetherSapling2.SaplingType.BLOODWOOD)));
this.registerItemModelNatura(stack, "nether_sapling_bloodwood");
// Bushes
Item blightberry_berrybush = Item.getItemFromBlock(NaturaNether.netherBerryBushBlightberry);
for (int meta = 0; meta <= 3; meta++)
{
String variant = String.format("%s=%s", BlockEnumBerryBush.AGE.getName(), Integer.valueOf(meta));
ModelLoader.setCustomModelResourceLocation(blightberry_berrybush, meta, new ModelResourceLocation(blightberry_berrybush.getRegistryName(), variant));
}
Item duskberry_berrybush = Item.getItemFromBlock(NaturaNether.netherBerryBushDuskberry);
for (int meta = 0; meta <= 3; meta++)
{
String variant = String.format("%s=%s", BlockEnumBerryBush.AGE.getName(), Integer.valueOf(meta));
ModelLoader.setCustomModelResourceLocation(duskberry_berrybush, meta, new ModelResourceLocation(duskberry_berrybush.getRegistryName(), variant));
}
Item skyberry_berrybush = Item.getItemFromBlock(NaturaNether.netherBerryBushSkyberry);
for (int meta = 0; meta <= 3; meta++)
{
String variant = String.format("%s=%s", BlockEnumBerryBush.AGE.getName(), Integer.valueOf(meta));
ModelLoader.setCustomModelResourceLocation(skyberry_berrybush, meta, new ModelResourceLocation(skyberry_berrybush.getRegistryName(), variant));
}
Item stingberry_berrybush = Item.getItemFromBlock(NaturaNether.netherBerryBushStingberry);
for (int meta = 0; meta <= 3; meta++)
{
String variant = String.format("%s=%s", BlockEnumBerryBush.AGE.getName(), Integer.valueOf(meta));
ModelLoader.setCustomModelResourceLocation(stingberry_berrybush, meta, new ModelResourceLocation(stingberry_berrybush.getRegistryName(), variant));
}
// glowshrooms
ItemStack glowshroom = new ItemStack(Item.getItemFromBlock(NaturaNether.netherGlowshroom), 1, NaturaNether.netherGlowshroom.getMetaFromState(NaturaNether.netherGlowshroom.getDefaultState().withProperty(BlockNetherGlowshroom.TYPE, BlockNetherGlowshroom.GlowshroomType.GREEN)));
this.registerItemModelNatura(glowshroom, "nether_glowshroom_green");
glowshroom = new ItemStack(Item.getItemFromBlock(NaturaNether.netherGlowshroom), 1, NaturaNether.netherGlowshroom.getMetaFromState(NaturaNether.netherGlowshroom.getDefaultState().withProperty(BlockNetherGlowshroom.TYPE, BlockNetherGlowshroom.GlowshroomType.BLUE)));
this.registerItemModelNatura(glowshroom, "nether_glowshroom_blue");
glowshroom = new ItemStack(Item.getItemFromBlock(NaturaNether.netherGlowshroom), 1, NaturaNether.netherGlowshroom.getMetaFromState(NaturaNether.netherGlowshroom.getDefaultState().withProperty(BlockNetherGlowshroom.TYPE, BlockNetherGlowshroom.GlowshroomType.PURPLE)));
this.registerItemModelNatura(glowshroom, "nether_glowshroom_purple");
Item nether_large_green_glowshroom = Item.getItemFromBlock(NaturaNether.netherLargeGreenGlowshroom);
for (BlockNetherLargeGlowshroom.EnumType type : BlockNetherLargeGlowshroom.EnumType.values())
{
String variant = String.format("%s=%s", BlockNetherLargeGlowshroom.VARIANT.getName(), BlockNetherLargeGlowshroom.VARIANT.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_large_green_glowshroom, type.getMeta(), new ModelResourceLocation(nether_large_green_glowshroom.getRegistryName(), variant));
}
Item nether_large_blue_glowshroom = Item.getItemFromBlock(NaturaNether.netherLargeBlueGlowshroom);
for (BlockNetherLargeGlowshroom.EnumType type : BlockNetherLargeGlowshroom.EnumType.values())
{
String variant = String.format("%s=%s", BlockNetherLargeGlowshroom.VARIANT.getName(), BlockNetherLargeGlowshroom.VARIANT.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_large_blue_glowshroom, type.getMeta(), new ModelResourceLocation(nether_large_blue_glowshroom.getRegistryName(), variant));
}
Item nether_large_purple_glowshroom = Item.getItemFromBlock(NaturaNether.netherLargePurpleGlowshroom);
for (BlockNetherLargeGlowshroom.EnumType type : BlockNetherLargeGlowshroom.EnumType.values())
{
String variant = String.format("%s=%s", BlockNetherLargeGlowshroom.VARIANT.getName(), BlockNetherLargeGlowshroom.VARIANT.getName(type));
ModelLoader.setCustomModelResourceLocation(nether_large_purple_glowshroom, type.getMeta(), new ModelResourceLocation(nether_large_purple_glowshroom.getRegistryName(), variant));
}
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.ghostwoodDoor), 1, NaturaNether.ghostwoodDoor.getMetaFromState(NaturaNether.ghostwoodDoor.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.EAST).withProperty(BlockDoor.OPEN, Boolean.valueOf(false)).withProperty(BlockDoor.HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)));
this.registerItemModelNatura(stack, "nether_door_ghostwood");
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.bloodwoodDoor), 1, NaturaNether.bloodwoodDoor.getMetaFromState(NaturaNether.bloodwoodDoor.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.EAST).withProperty(BlockDoor.OPEN, Boolean.valueOf(false)).withProperty(BlockDoor.HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)));
this.registerItemModelNatura(stack, "nether_door_bloodwood");
registerItemModel(NaturaNether.blazeHopper);
registerItemModel(NaturaNether.netherLever);
registerItemModel(NaturaNether.netherButton);
registerItemModel(NaturaNether.netherPressurePlate);
registerItemModel(NaturaNether.blazeRail);
registerItemModel(NaturaNether.blazeRailPowered);
registerItemModel(NaturaNether.blazeRailActivator);
registerItemModel(NaturaNether.blazeRailDetector);
registerItemModel(NaturaNether.netherrackFurnace);
registerItemModel(NaturaNether.litNetherrackFurnace);
NaturaNether.netherDoors.registerItemModels();
}
}