Fixed cables rendering
This commit is contained in:
parent
7a005f7494
commit
f02b24f813
6 changed files with 112 additions and 108 deletions
|
@ -22,7 +22,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package techreborn.blocks.generator.solarpanel;
|
package techreborn.blocks.generator;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
|
@ -24,24 +24,17 @@
|
||||||
|
|
||||||
package techreborn.client;
|
package techreborn.client;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
import techreborn.init.TRItems;
|
import techreborn.init.TRItems;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class RegisterItemJsons {
|
public class RegisterItemJsons {
|
||||||
public static void registerModels() {
|
public static void registerModels() {
|
||||||
TRContent.registerModel();
|
TRContent.registerModel();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package techreborn.init;
|
package techreborn.init;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||||
|
@ -23,13 +24,16 @@ import techreborn.blocks.BlockMachineFrame;
|
||||||
import techreborn.blocks.BlockOre;
|
import techreborn.blocks.BlockOre;
|
||||||
import techreborn.blocks.BlockStorage;
|
import techreborn.blocks.BlockStorage;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
import techreborn.blocks.cable.BlockCable;
|
||||||
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
import techreborn.blocks.generator.BlockSolarPanel;
|
||||||
import techreborn.blocks.tier1.BlockElectricFurnace;
|
import techreborn.blocks.tier1.BlockElectricFurnace;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.items.ItemUpgrade;
|
import techreborn.items.ItemUpgrade;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||||
public class TRContent {
|
public class TRContent {
|
||||||
|
@ -132,16 +136,18 @@ public class TRContent {
|
||||||
|
|
||||||
ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv");
|
ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv");
|
||||||
for (Cables value : Cables.values()) {
|
for (Cables value : Cables.values()) {
|
||||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(cableRL, "type=" + value.name));
|
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0,
|
||||||
|
new ModelResourceLocation(cableRL, "type=" + value.name));
|
||||||
ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() {
|
ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() {
|
||||||
@Override
|
@Override
|
||||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||||
return new ModelResourceLocation(new ResourceLocation(TechReborn.MOD_ID, "cable_" + (value.cableThickness == 5 ? "thick" : "thin")), "type=" + value.name);
|
Map<IProperty<?>, Comparable<?>> map = Maps.newLinkedHashMap(state.getProperties());
|
||||||
|
String property = this.getPropertyString(map) + ",ztype=" + value.name;
|
||||||
|
|
||||||
|
return new ModelResourceLocation(new ResourceLocation(TechReborn.MOD_ID,
|
||||||
|
"cable_" + (value.cableThickness == 5 ? "thick" : "thin")), property);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.powerSystem.PowerSystem;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.StringUtils;
|
import reborncore.common.util.StringUtils;
|
||||||
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
import techreborn.blocks.generator.BlockSolarPanel;
|
||||||
import techreborn.init.TRContent.SolarPanels;
|
import techreborn.init.TRContent.SolarPanels;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
"false": {
|
"false": {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": {
|
"ztype": {
|
||||||
"insulated_copper": {
|
"insulated_copper": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/copper_insulated_cable"
|
"cable": "techreborn:blocks/cables/copper_insulated_cable"
|
||||||
|
|
|
@ -1,94 +1,99 @@
|
||||||
{
|
{
|
||||||
"forge_marker": 1,
|
"forge_marker": 1,
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"model": "techreborn:cable_thin",
|
"model": "techreborn:cable_thin",
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "#cable"
|
"particle": "#cable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [{} ],
|
"down": {
|
||||||
"down": {
|
"true": {
|
||||||
"true": {
|
"submodel": {
|
||||||
"submodel": {
|
"pipeDown": {
|
||||||
"pipeDown": {
|
"model": "techreborn:cable_connection_alt_thin",
|
||||||
"model": "techreborn:cable_connection_alt_thin",
|
"x": 270
|
||||||
"x": 270
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"false": {
|
||||||
"false": {
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"east": {
|
"east": {
|
||||||
"true": {
|
"true": {
|
||||||
"submodel": "techreborn:cable_connection_thin",
|
"submodel": "techreborn:cable_connection_thin",
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
}
|
|
||||||
},
|
}
|
||||||
"north": {
|
},
|
||||||
"true": {
|
"north": {
|
||||||
"submodel": "techreborn:cable_connection_thin"
|
"true": {
|
||||||
},
|
"submodel": "techreborn:cable_connection_thin"
|
||||||
"false": {
|
},
|
||||||
}
|
"false": {
|
||||||
},
|
|
||||||
"south": {
|
}
|
||||||
"true": {
|
},
|
||||||
"submodel": "techreborn:cable_connection_alt_thin"
|
"south": {
|
||||||
},
|
"true": {
|
||||||
"false": {
|
"submodel": "techreborn:cable_connection_alt_thin"
|
||||||
}
|
},
|
||||||
},
|
"false": {
|
||||||
"up": {
|
|
||||||
"true": {
|
}
|
||||||
"submodel": {
|
},
|
||||||
"pipeUp": {
|
"up": {
|
||||||
"model": "techreborn:cable_connection_thin",
|
"true": {
|
||||||
"x": 270
|
"submodel": {
|
||||||
}
|
"pipeUp": {
|
||||||
}
|
"model": "techreborn:cable_connection_thin",
|
||||||
},
|
"x": 270
|
||||||
"false": {
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"west": {
|
"false": {
|
||||||
"true": {
|
|
||||||
"submodel": "techreborn:cable_connection_alt_thin",
|
}
|
||||||
"y": 90
|
},
|
||||||
},
|
"west": {
|
||||||
"false": {
|
"true": {
|
||||||
}
|
"submodel": "techreborn:cable_connection_alt_thin",
|
||||||
},
|
"y": 90
|
||||||
"type": {
|
},
|
||||||
"copper": {
|
"false": {
|
||||||
"textures": {
|
|
||||||
"cable": "techreborn:blocks/cables/copper_cable"
|
}
|
||||||
}
|
},
|
||||||
},
|
"ztype": {
|
||||||
"tin": {
|
"copper": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/tin_cable"
|
"cable": "techreborn:blocks/cables/copper_cable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gold": {
|
"tin": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/gold_cable"
|
"cable": "techreborn:blocks/cables/tin_cable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hv": {
|
"gold": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/hv_cable"
|
"cable": "techreborn:blocks/cables/gold_cable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"glassfiber": {
|
"hv": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/glass_fiber_cable"
|
"cable": "techreborn:blocks/cables/hv_cable"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
"glassfiber": {
|
||||||
}
|
"textures": {
|
||||||
|
"cable": "techreborn:blocks/cables/glass_fiber_cable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue