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"
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [{} ],
|
|
||||||
"down": {
|
"down": {
|
||||||
"true": {
|
"true": {
|
||||||
"submodel": {
|
"submodel": {
|
||||||
|
@ -19,6 +18,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"east": {
|
"east": {
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"north": {
|
"north": {
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
"submodel": "techreborn:cable_connection_thin"
|
"submodel": "techreborn:cable_connection_thin"
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"south": {
|
"south": {
|
||||||
|
@ -41,6 +43,7 @@
|
||||||
"submodel": "techreborn:cable_connection_alt_thin"
|
"submodel": "techreborn:cable_connection_alt_thin"
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"up": {
|
"up": {
|
||||||
|
@ -53,6 +56,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"west": {
|
"west": {
|
||||||
|
@ -61,9 +65,10 @@
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": {
|
"ztype": {
|
||||||
"copper": {
|
"copper": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"cable": "techreborn:blocks/cables/copper_cable"
|
"cable": "techreborn:blocks/cables/copper_cable"
|
||||||
|
|
Loading…
Add table
Reference in a new issue