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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
package lance5057.tDefense.proxy;
import javax.annotation.Nonnull;
import lance5057.tDefense.Reference;
import lance5057.tDefense.TD_Commands;
import lance5057.tDefense.baubles.BaublesClientProxy;
import lance5057.tDefense.core.CoreBlocks;
import lance5057.tDefense.core.CoreClientProxy;
import lance5057.tDefense.core.CoreItems;
import lance5057.tDefense.core.blocks.TDMetalBlock;
import lance5057.tDefense.core.tools.TDTools;
import lance5057.tDefense.holiday.HolidayClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fluids.Fluid;
import slimeknights.tconstruct.common.ModelRegisterUtil;
import slimeknights.tconstruct.library.TinkerRegistryClient;
import slimeknights.tconstruct.library.client.ToolBuildGuiInfo;
//import lance5057.tDefense.core.renderer.TestSkinChanger;
public class ClientProxy extends CommonProxy {
// static final ToolModelLoader toolmodel = new ToolModelLoader();
// public static final ModelSheath sheath = new ModelSheath();
// ModifierSoulHandler SoulHandler;
// public static ModelTinkersTabard sheath;
public static BaublesClientProxy baubles = new BaublesClientProxy();
ToolBuildGuiInfo roundshieldGUI;
ToolBuildGuiInfo heatershieldGUI;
ToolBuildGuiInfo zweihanderGUI;
ToolBuildGuiInfo shearsGUI;
ToolBuildGuiInfo fishingRodGUI;
ToolBuildGuiInfo hoodGUI;
ToolBuildGuiInfo shawlGUI;
ToolBuildGuiInfo robeGUI;
ToolBuildGuiInfo shoesGUI;
ToolBuildGuiInfo coifGUI;
ToolBuildGuiInfo hauberkGUI;
ToolBuildGuiInfo chaussesGUI;
ToolBuildGuiInfo bootsGUI;
ToolBuildGuiInfo helmGUI;
ToolBuildGuiInfo breastplateGUI;
ToolBuildGuiInfo grievesGUI;
ToolBuildGuiInfo sabatonsGUI;
public static CoreClientProxy coreProxy = new CoreClientProxy();
public static HolidayClientProxy holiProxy = new HolidayClientProxy();
// public static ArmorClientProxy armorProxy = new ArmorClientProxy();
@Override
public void preInit() {
ClientCommandHandler.instance.registerCommand(new TD_Commands());
registerToolRenderers();
coreProxy.preInit();
// armorProxy.preInit();
baubles.preInit();
}
@Override
public void init() {
// Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
// .register(TDTools.heatershield, 0, new
// ModelResourceLocation("modid:itemname", "inventory"));
//
createToolGuis();
setToolGuis();
registerToolGuis();
registerItemRenderer(CoreBlocks.metalItemBlock, TDMetalBlock.EnumMetal.AEONSTEEL.getID(), "aeonsteelblock");
registerItemRenderer(CoreBlocks.metalItemBlock, TDMetalBlock.EnumMetal.QUEENSGOLD.getID(), "queensgoldblock");
registerItemRenderer(CoreBlocks.metalItemBlock, TDMetalBlock.EnumMetal.DOGBEARIUM.getID(), "dogbeariumblock");
registerItemRenderer(CoreItems.item_aeonsteelIngot, 0, CoreItems.item_aeonsteelIngot.getUnlocalizedName());
registerItemRenderer(CoreItems.item_dogbeariumIngot, 0, CoreItems.item_dogbeariumIngot.getUnlocalizedName());
registerItemRenderer(CoreItems.item_queensgoldIngot, 0, CoreItems.item_queensgoldIngot.getUnlocalizedName());
coreProxy.init();
// armorProxy.init();
holiProxy.Init();
baubles.init();
}
public void registerToolRenderers() {
ModelRegisterUtil.registerToolModel(TDTools.roundshield);
ModelRegisterUtil.registerToolModel(TDTools.heatershield);
ModelRegisterUtil.registerToolModel(TDTools.zweihander);
ModelRegisterUtil.registerToolModel(TDTools.shears);
ModelRegisterUtil.registerToolModel(TDTools.fishingRod);
ModelRegisterUtil.registerToolModel(TDTools.hood);
ModelRegisterUtil.registerToolModel(TDTools.shawl);
ModelRegisterUtil.registerToolModel(TDTools.robe);
ModelRegisterUtil.registerToolModel(TDTools.shoes);
}
public void createToolGuis() {
roundshieldGUI = new ToolBuildGuiInfo(TDTools.roundshield);
heatershieldGUI = new ToolBuildGuiInfo(TDTools.heatershield);
zweihanderGUI = new ToolBuildGuiInfo(TDTools.zweihander);
shearsGUI = new ToolBuildGuiInfo(TDTools.shears);
fishingRodGUI = new ToolBuildGuiInfo(TDTools.fishingRod);
hoodGUI = new ToolBuildGuiInfo(TDTools.hood);
shawlGUI = new ToolBuildGuiInfo(TDTools.shawl);
robeGUI = new ToolBuildGuiInfo(TDTools.robe);
shoesGUI = new ToolBuildGuiInfo(TDTools.shoes);
}
public void setupToolGuis() {
roundshieldGUI.addSlotPosition(34, 15 + 8);
roundshieldGUI.addSlotPosition(34, 33 + 8);
roundshieldGUI.addSlotPosition(34, 51 + 8);
heatershieldGUI.addSlotPosition(34, 15 + 8);
heatershieldGUI.addSlotPosition(25, 33 + 8);
heatershieldGUI.addSlotPosition(43, 33 + 8);
heatershieldGUI.addSlotPosition(34, 51 + 8);
zweihanderGUI.addSlotPosition(34, 15 + 8);
zweihanderGUI.addSlotPosition(25, 33 + 8);
zweihanderGUI.addSlotPosition(43, 33 + 8);
zweihanderGUI.addSlotPosition(34, 51 + 8);
hoodGUI.addSlotPosition(34, 15 + 8);
hoodGUI.addSlotPosition(43, 33 + 8);
hoodGUI.addSlotPosition(34, 51 + 8);
shawlGUI.addSlotPosition(34, 15 + 8);
shawlGUI.addSlotPosition(43, 33 + 8);
shawlGUI.addSlotPosition(34, 51 + 8);
robeGUI.addSlotPosition(34, 15 + 8);
robeGUI.addSlotPosition(43, 33 + 8);
robeGUI.addSlotPosition(34, 51 + 8);
shoesGUI.addSlotPosition(34, 15 + 8);
shoesGUI.addSlotPosition(43, 33 + 8);
shoesGUI.addSlotPosition(34, 51 + 8);
shearsGUI.addSlotPosition(34, 15 + 8);
shearsGUI.addSlotPosition(43, 33 + 8);
shearsGUI.addSlotPosition(34, 51 + 8);
}
public void registerToolGuis() {
TinkerRegistryClient.addToolBuilding(roundshieldGUI);
TinkerRegistryClient.addToolBuilding(heatershieldGUI);
TinkerRegistryClient.addToolBuilding(zweihanderGUI);
TinkerRegistryClient.addToolBuilding(shearsGUI);
TinkerRegistryClient.addToolBuilding(fishingRodGUI);
TinkerRegistryClient.addToolBuilding(hoodGUI);
TinkerRegistryClient.addToolBuilding(shawlGUI);
TinkerRegistryClient.addToolBuilding(robeGUI);
TinkerRegistryClient.addToolBuilding(shoesGUI);
}
@Override
public void reloadRenderers() {
setToolGuis();
baubles.reloadRenderers();
}
public void setToolGuis() {
roundshieldGUI.positions.clear();
roundshieldGUI.addSlotPosition(34, 15);
roundshieldGUI.addSlotPosition(34, 33);
roundshieldGUI.addSlotPosition(34, 51);
heatershieldGUI.positions.clear();
heatershieldGUI.addSlotPosition(34, 15);
heatershieldGUI.addSlotPosition(25, 33);
heatershieldGUI.addSlotPosition(43, 33);
heatershieldGUI.addSlotPosition(34, 51);
zweihanderGUI.positions.clear();
zweihanderGUI.addSlotPosition(34, 15);
zweihanderGUI.addSlotPosition(25, 33);
zweihanderGUI.addSlotPosition(43, 33);
zweihanderGUI.addSlotPosition(34, 51);
hoodGUI.positions.clear();
hoodGUI.addSlotPosition(34, 15 + 8);
hoodGUI.addSlotPosition(43, 33 + 8);
hoodGUI.addSlotPosition(34, 51 + 8);
shawlGUI.positions.clear();
shawlGUI.addSlotPosition(34, 15 + 8);
shawlGUI.addSlotPosition(43, 33 + 8);
shawlGUI.addSlotPosition(34, 51 + 8);
robeGUI.positions.clear();
robeGUI.addSlotPosition(34, 15 + 8);
robeGUI.addSlotPosition(43, 33 + 8);
robeGUI.addSlotPosition(34, 51 + 8);
shoesGUI.positions.clear();
shoesGUI.addSlotPosition(34, 15 + 8);
shoesGUI.addSlotPosition(43, 33 + 8);
shoesGUI.addSlotPosition(34, 51 + 8);
shearsGUI.positions.clear();
shearsGUI.addSlotPosition(34, 15 + 8);
shearsGUI.addSlotPosition(43, 33 + 8);
shearsGUI.addSlotPosition(34, 51 + 8);
fishingRodGUI.positions.clear();
fishingRodGUI.addSlotPosition(34, 15 + 8);
fishingRodGUI.addSlotPosition(43, 33 + 8);
fishingRodGUI.addSlotPosition(34, 51 + 8);
}
@Override
public void registerItemRenderer(Item item, int meta, String id) {
ModelLoader.setCustomModelResourceLocation(item, meta,
new ModelResourceLocation(Reference.MOD_ID + ":" + id, "inventory"));
}
@Override
public void registerFluidModels(Fluid fluid) {
if (fluid == null) {
return;
}
Block block = fluid.getBlock();
if (block != null) {
Item item = Item.getItemFromBlock(block);
FluidStateMapper mapper = new FluidStateMapper(fluid);
// item-model
if (item != null) {
ModelLoader.registerItemVariants(item);
ModelLoader.setCustomMeshDefinition(item, mapper);
}
// block-model
ModelLoader.setCustomStateMapper(block, mapper);
}
}
@Override
public void registerItemBlockRenderer(Block block, int meta, String file) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(block), meta, new ModelResourceLocation(Reference.MOD_ID + ":" + file, "inventory"));
}
public static class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition {
public final Fluid fluid;
public final ModelResourceLocation location;
public FluidStateMapper(Fluid fluid) {
this.fluid = fluid;
// have each block hold its fluid per nbt? hm
this.location = new ModelResourceLocation(new ResourceLocation(Reference.MOD_ID, "fluid_block"), fluid.getName());
}
@Nonnull
@Override
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
return location;
}
@Nonnull
@Override
public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) {
return location;
}
}
}
|