Fixed cables rendering

This commit is contained in:
drcrazy 2018-09-22 16:50:33 +03:00
parent 7a005f7494
commit f02b24f813
6 changed files with 112 additions and 108 deletions

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.generator.solarpanel;
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

View file

@ -24,24 +24,17 @@
package techreborn.client;
import com.google.common.collect.Maps;
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.statemap.DefaultStateMapper;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import techreborn.TechReborn;
import techreborn.blocks.cable.BlockCable;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.init.TRContent;
import techreborn.init.TRItems;
import java.util.Map;
public class RegisterItemJsons {
public static void registerModels() {
TRContent.registerModel();

View file

@ -1,6 +1,7 @@
package techreborn.init;
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.statemap.DefaultStateMapper;
@ -23,13 +24,16 @@ import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockStorage;
import techreborn.blocks.cable.BlockCable;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.blocks.tier1.BlockElectricFurnace;
import techreborn.config.ConfigTechReborn;
import techreborn.items.ItemUpgrade;
import techreborn.utils.InitUtils;
import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.Maps;
@RebornRegister(modID = TechReborn.MOD_ID)
public class TRContent {
@ -132,16 +136,18 @@ public class TRContent {
ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv");
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() {
@Override
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);
}
});
}
}

View file

@ -35,7 +35,7 @@ import reborncore.api.power.EnumPowerTier;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.StringUtils;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.init.TRContent.SolarPanels;
import java.util.List;

View file

@ -62,7 +62,7 @@
"false": {
}
},
"type": {
"ztype": {
"insulated_copper": {
"textures": {
"cable": "techreborn:blocks/cables/copper_insulated_cable"

View file

@ -8,7 +8,6 @@
}
},
"variants": {
"inventory": [{} ],
"down": {
"true": {
"submodel": {
@ -19,6 +18,7 @@
}
},
"false": {
}
},
"east": {
@ -27,6 +27,7 @@
"y": 90
},
"false": {
}
},
"north": {
@ -34,6 +35,7 @@
"submodel": "techreborn:cable_connection_thin"
},
"false": {
}
},
"south": {
@ -41,6 +43,7 @@
"submodel": "techreborn:cable_connection_alt_thin"
},
"false": {
}
},
"up": {
@ -53,6 +56,7 @@
}
},
"false": {
}
},
"west": {
@ -61,9 +65,10 @@
"y": 90
},
"false": {
}
},
"type": {
"ztype": {
"copper": {
"textures": {
"cable": "techreborn:blocks/cables/copper_cable"