Added CTM integration for Reader and Writer

This commit is contained in:
raoulvdberge
2017-07-30 20:52:29 +02:00
parent 66b9825894
commit a6e45ee8fa
9 changed files with 428 additions and 50 deletions

View File

@@ -203,8 +203,6 @@ public class ProxyClient extends ProxyCommon {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.EXTERNAL_STORAGE), 0, new ModelResourceLocation("refinedstorage:external_storage", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.CONSTRUCTOR), 0, new ModelResourceLocation("refinedstorage:constructor", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.DESTRUCTOR), 0, new ModelResourceLocation("refinedstorage:destructor", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.READER), 0, new ModelResourceLocation("refinedstorage:reader", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.WRITER), 0, new ModelResourceLocation("refinedstorage:writer", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.SOLDERER), 0, new ModelResourceLocation("refinedstorage:solderer", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.INTERFACE), 0, new ModelResourceLocation("refinedstorage:interface", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.FLUID_INTERFACE), 0, new ModelResourceLocation("refinedstorage:fluid_interface", "inventory"));
@@ -230,68 +228,34 @@ public class ProxyClient extends ProxyCommon {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.GRID), GridType.CRAFTING.getId(), new ModelResourceLocation("refinedstorage:grid", "connected=false,direction=north,type=crafting"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.GRID), GridType.PATTERN.getId(), new ModelResourceLocation("refinedstorage:grid", "connected=false,direction=north,type=pattern"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.GRID), GridType.FLUID.getId(), new ModelResourceLocation("refinedstorage:grid", "connected=false,direction=north,type=fluid"));
ModelLoader.setCustomStateMapper(RSBlocks.GRID, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:grid" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.GRID, new StateMapperCTM("refinedstorage:grid"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.CRAFTING_MONITOR), 0, new ModelResourceLocation("refinedstorage:crafting_monitor", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.CRAFTING_MONITOR, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:crafting_monitor" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.CRAFTING_MONITOR, new StateMapperCTM("refinedstorage:crafting_monitor"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.WIRELESS_TRANSMITTER), 0, new ModelResourceLocation("refinedstorage:wireless_transmitter", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.WIRELESS_TRANSMITTER, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:wireless_transmitter" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.WIRELESS_TRANSMITTER, new StateMapperCTM("refinedstorage:wireless_transmitter"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.NETWORK_TRANSMITTER), 0, new ModelResourceLocation("refinedstorage:network_transmitter", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.NETWORK_TRANSMITTER, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:network_transmitter" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.NETWORK_TRANSMITTER, new StateMapperCTM("refinedstorage:network_transmitter"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.NETWORK_RECEIVER), 0, new ModelResourceLocation("refinedstorage:network_receiver", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.NETWORK_RECEIVER, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:network_receiver" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.NETWORK_RECEIVER, new StateMapperCTM("refinedstorage:network_receiver"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.DETECTOR), 0, new ModelResourceLocation("refinedstorage:detector", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.DETECTOR, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:detector" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.DETECTOR, new StateMapperCTM("refinedstorage:detector"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.RELAY), 0, new ModelResourceLocation("refinedstorage:relay", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.RELAY, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:relay" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.RELAY, new StateMapperCTM("refinedstorage:relay"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.SECURITY_MANAGER), 0, new ModelResourceLocation("refinedstorage:security_manager", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.SECURITY_MANAGER, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("refinedstorage:security_manager" + (Loader.isModLoaded("ctm") ? "_glow" : ""), getPropertyString(state.getProperties()));
}
});
ModelLoader.setCustomStateMapper(RSBlocks.SECURITY_MANAGER, new StateMapperCTM("refinedstorage:security_manager"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.READER), 0, new ModelResourceLocation("refinedstorage:reader", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.READER, new StateMapperCTM("refinedstorage:reader"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.WRITER), 0, new ModelResourceLocation("refinedstorage:writer", "inventory"));
ModelLoader.setCustomStateMapper(RSBlocks.WRITER, new StateMapperCTM("refinedstorage:writer"));
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(RSBlocks.CONTROLLER), stack -> {
ControllerEnergyType energyType = stack.getItemDamage() == ControllerType.CREATIVE.getId() ? ControllerEnergyType.ON : TileController.getEnergyType(ItemBlockController.getEnergyStored(stack), ItemBlockController.getEnergyCapacity(stack));

View File

@@ -0,0 +1,21 @@
package com.raoulvdberge.refinedstorage.render;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraftforge.fml.common.Loader;
public class StateMapperCTM extends StateMapperBase {
private static final String CTM_MOD_ID = "ctm";
private String location;
public StateMapperCTM(String location) {
this.location = location;
}
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation(location + (Loader.isModLoaded(CTM_MOD_ID) ? "_glow" : ""), getPropertyString(state.getProperties()));
}
}

View File

@@ -0,0 +1,104 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"cable": "refinedstorage:blocks/cable",
"particle": "refinedstorage:blocks/cable",
"front": "refinedstorage:blocks/reader",
"line": "refinedstorage:blocks/generic_grey",
"glow": "refinedstorage:blocks/none"
},
"model": "refinedstorage:cable_core",
"uvlock": true
},
"variants": {
"inventory": [
{
"model": "refinedstorage:constructor_destructor_item",
"transform": "forge:default-block"
}
],
"connected": {
"true": {
"textures": {
"front": "refinedstorage:blocks/reader_connected",
"glow": "refinedstorage:blocks/reader_connected_glow"
}
},
"false": {
}
},
"direction": {
"north": {
"submodel": "refinedstorage:constructor_destructor_glow"
},
"east": {
"submodel": "refinedstorage:constructor_destructor_glow",
"y": 90
},
"south": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 180
},
"west": {
"submodel": "refinedstorage:constructor_destructor_glow",
"y": 270
},
"up": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 270
},
"down": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 90
}
},
"north": {
"true": {
"submodel": "refinedstorage:cable_extension"
},
"false": {
}
},
"east": {
"true": {
"submodel": "refinedstorage:cable_extension",
"y": 90
},
"false": {
}
},
"south": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 180
},
"false": {
}
},
"west": {
"true": {
"submodel": "refinedstorage:cable_extension",
"y": 270
},
"false": {
}
},
"up": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 270
},
"false": {
}
},
"down": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 90
},
"false": {
}
}
}
}

View File

@@ -0,0 +1,104 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"cable": "refinedstorage:blocks/cable",
"particle": "refinedstorage:blocks/cable",
"front": "refinedstorage:blocks/writer",
"line": "refinedstorage:blocks/generic_grey",
"glow": "refinedstorage:blocks/none"
},
"model": "refinedstorage:cable_core",
"uvlock": true
},
"variants": {
"inventory": [
{
"model": "refinedstorage:constructor_destructor_item",
"transform": "forge:default-block"
}
],
"connected": {
"true": {
"textures": {
"front": "refinedstorage:blocks/writer_connected",
"glow": "refinedstorage:blocks/writer_connected_glow"
}
},
"false": {
}
},
"direction": {
"north": {
"submodel": "refinedstorage:constructor_destructor_glow"
},
"east": {
"submodel": "refinedstorage:constructor_destructor_glow",
"y": 90
},
"south": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 180
},
"west": {
"submodel": "refinedstorage:constructor_destructor_glow",
"y": 270
},
"up": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 270
},
"down": {
"submodel": "refinedstorage:constructor_destructor_glow",
"x": 90
}
},
"north": {
"true": {
"submodel": "refinedstorage:cable_extension"
},
"false": {
}
},
"east": {
"true": {
"submodel": "refinedstorage:cable_extension",
"y": 90
},
"false": {
}
},
"south": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 180
},
"false": {
}
},
"west": {
"true": {
"submodel": "refinedstorage:cable_extension",
"y": 270
},
"false": {
}
},
"up": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 270
},
"false": {
}
},
"down": {
"true": {
"submodel": "refinedstorage:cable_extension",
"x": 90
},
"false": {
}
}
}
}

View File

@@ -0,0 +1,167 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"elements": [
{
"name": "Line1",
"from": [
7.0,
7.0,
2.0
],
"to": [
9.0,
9.0,
6.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
0.0
],
"to": [
16.0,
16.0,
2.0
],
"faces": {
"north": {
"texture": "#front",
"uv": [
0.0,
0.0,
16.0,
16.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
16.0,
16.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
16.0,
16.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
16.0,
16.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
16.0,
16.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
16.0,
16.0
]
}
}
},
{
"name": "Line3",
"from": [
0.0,
0.0,
0.0
],
"to": [
16.0,
16.0,
2.0
],
"faces": {
"north": {
"texture": "#glow",
"uv": [
0.0,
0.0,
16.0,
16.0
]
}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -0,0 +1,9 @@
{
"ctm": {
"ctm_version": 1,
"layer": "CUTOUT",
"extra": {
"light": 15
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -0,0 +1,9 @@
{
"ctm": {
"ctm_version": 1,
"layer": "CUTOUT",
"extra": {
"light": 15
}
}
}