Sorting and renaming for cables and panels. Still not rendering
This commit is contained in:
parent
e068ca018c
commit
7a005f7494
14 changed files with 27 additions and 50 deletions
|
@ -28,10 +28,8 @@ import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -40,20 +38,17 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.ChunkCache;
|
import net.minecraft.world.ChunkCache;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import reborncore.api.ToolManager;
|
import reborncore.api.ToolManager;
|
||||||
import reborncore.common.RebornCoreConfig;
|
|
||||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||||
import reborncore.common.items.WrenchHelper;
|
import reborncore.common.items.WrenchHelper;
|
||||||
import reborncore.common.registration.RebornRegister;
|
import reborncore.common.registration.RebornRegister;
|
||||||
import reborncore.common.registration.impl.ConfigRegistry;
|
import reborncore.common.registration.impl.ConfigRegistry;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
import techreborn.init.ModSounds;
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
import techreborn.tiles.cable.TileCable;
|
import techreborn.tiles.cable.TileCable;
|
||||||
|
@ -61,7 +56,6 @@ import techreborn.utils.TechRebornCreativeTab;
|
||||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 19/05/2017.
|
* Created by modmuss50 on 19/05/2017.
|
||||||
|
|
|
@ -128,29 +128,10 @@ public class RegisterItemJsons {
|
||||||
}
|
}
|
||||||
|
|
||||||
register(ModBlocks.RUBBER_SAPLING, "misc/rubber_sapling");
|
register(ModBlocks.RUBBER_SAPLING, "misc/rubber_sapling");
|
||||||
|
|
||||||
for (TRContent.Cables cableType : TRContent.Cables.values()) {
|
|
||||||
BlockCable blockCable = cableType.block;
|
|
||||||
|
|
||||||
registerBlockstateMultiItem(Item.getItemFromBlock(blockCable), cableType.name().toLowerCase(), "cable_inv");
|
|
||||||
|
|
||||||
ModelLoader.setCustomStateMapper(blockCable, new DefaultStateMapper() {
|
|
||||||
@Override
|
|
||||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
|
||||||
Map<IProperty<?>, Comparable<?>> map = Maps.newLinkedHashMap(state.getProperties());
|
|
||||||
BlockCable cable = (BlockCable) state.getBlock();
|
|
||||||
String property = this.getPropertyString(map) + ",type=" + cable.type.name().toLowerCase();
|
|
||||||
return new ModelResourceLocation(new ResourceLocation(TechReborn.MOD_ID, "cable_" + (cable.type.cableThickness > 10 ? "thick" : "thin")), property);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBlocks() {
|
private static void registerBlocks() {
|
||||||
register(ModBlocks.REFINED_IRON_FENCE, "iron_fence");
|
register(ModBlocks.REFINED_IRON_FENCE, "iron_fence");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(Item item, int meta, String name) {
|
private static void register(Item item, int meta, String name) {
|
||||||
|
@ -163,13 +144,12 @@ public class RegisterItemJsons {
|
||||||
register(item, 0, name);
|
register(item, 0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static void register(Block block, int meta, String name) {
|
private static void register(Block block, int meta, String name) {
|
||||||
register(Item.getItemFromBlock(block), meta, name);
|
register(Item.getItemFromBlock(block), meta, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(Block block, String name) {
|
private static void register(Block block, String name) {
|
||||||
register(Item.getItemFromBlock(block), 0, name);
|
register(block, 0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -192,8 +172,7 @@ public class RegisterItemJsons {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBlockstateMultiItem(Item item, String variantName, String path) {
|
private static void registerBlockstateMultiItem(Item item, String variantName, String path) {
|
||||||
ResourceLocation loc = new ResourceLocation(TechReborn.MOD_ID, path);
|
registerBlockstateMultiItem(item, 0, variantName, path);
|
||||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "type=" + variantName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBlockstateMultiItem(Item item, int meta, String variantName, String path) {
|
private static void registerBlockstateMultiItem(Item item, int meta, String variantName, String path) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import reborncore.RebornRegistry;
|
import reborncore.RebornRegistry;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.blocks.*;
|
import techreborn.blocks.*;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
|
||||||
import techreborn.blocks.generator.*;
|
import techreborn.blocks.generator.*;
|
||||||
import techreborn.blocks.lighting.BlockLamp;
|
import techreborn.blocks.lighting.BlockLamp;
|
||||||
import techreborn.blocks.storage.*;
|
import techreborn.blocks.storage.*;
|
||||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import reborncore.common.util.OreUtil;
|
import reborncore.common.util.OreUtil;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
|
||||||
|
|
||||||
public class OreDict {
|
public class OreDict {
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,6 @@ package techreborn.init;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import techreborn.api.ISubItemRetriever;
|
import techreborn.api.ISubItemRetriever;
|
||||||
import techreborn.blocks.BlockOre;
|
|
||||||
import techreborn.blocks.BlockStorage;
|
|
||||||
import techreborn.items.*;
|
import techreborn.items.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,6 +129,20 @@ 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.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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum SolarPanels {
|
public static enum SolarPanels {
|
||||||
|
@ -141,6 +155,7 @@ public class TRContent {
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final Block block;
|
public final Block block;
|
||||||
|
|
||||||
// Generation of EU during Day
|
// Generation of EU during Day
|
||||||
public int generationRateD = 1;
|
public int generationRateD = 1;
|
||||||
// Generation of EU during Night
|
// Generation of EU during Night
|
||||||
|
@ -158,7 +173,7 @@ public class TRContent {
|
||||||
// Buffer for 2 mins of work
|
// Buffer for 2 mins of work
|
||||||
internalCapacity = generationRateD * 2_400;
|
internalCapacity = generationRateD * 2_400;
|
||||||
|
|
||||||
InitUtils.setup(block, "solar_panel_" + name);
|
InitUtils.setup(block, name + "_solar_panel");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -173,17 +188,19 @@ public class TRContent {
|
||||||
INSULATED_GOLD(512, 10.0, false, EnumPowerTier.HIGH),
|
INSULATED_GOLD(512, 10.0, false, EnumPowerTier.HIGH),
|
||||||
INSULATED_HV(2048, 10.0, false, EnumPowerTier.EXTREME);
|
INSULATED_HV(2048, 10.0, false, EnumPowerTier.EXTREME);
|
||||||
|
|
||||||
|
public final String name;
|
||||||
|
public final BlockCable block;
|
||||||
|
|
||||||
public int transferRate;
|
public int transferRate;
|
||||||
public int defaultTransferRate;
|
public int defaultTransferRate;
|
||||||
public double cableThickness;
|
public double cableThickness;
|
||||||
public boolean canKill;
|
public boolean canKill;
|
||||||
public boolean defaultCanKill;
|
public boolean defaultCanKill;
|
||||||
public EnumPowerTier tier;
|
public EnumPowerTier tier;
|
||||||
|
|
||||||
public final BlockCable block;
|
|
||||||
|
Cables(int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier) {
|
||||||
Cables(int transferRate, double cableThickness, boolean canKill,
|
name = this.toString().toLowerCase();
|
||||||
EnumPowerTier tier) {
|
|
||||||
this.transferRate = transferRate;
|
this.transferRate = transferRate;
|
||||||
this.defaultTransferRate = transferRate;
|
this.defaultTransferRate = transferRate;
|
||||||
this.cableThickness = cableThickness / 2;
|
this.cableThickness = cableThickness / 2;
|
||||||
|
@ -191,7 +208,7 @@ public class TRContent {
|
||||||
this.defaultCanKill = canKill;
|
this.defaultCanKill = canKill;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.block = new BlockCable(this);
|
this.block = new BlockCable(this);
|
||||||
InitUtils.setup(block, "cable_" + this.name().toLowerCase());
|
InitUtils.setup(block, name + "_cable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import reborncore.common.util.OreUtil;
|
import reborncore.common.util.OreUtil;
|
||||||
import reborncore.common.util.StringUtils;
|
import reborncore.common.util.StringUtils;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
|
||||||
import techreborn.items.*;
|
import techreborn.items.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,15 +8,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [
|
"inventory": [{} ],
|
||||||
{
|
|
||||||
"transform": "forge:default-block",
|
|
||||||
"model": "techreborn:cable",
|
|
||||||
"textures": {
|
|
||||||
"cable": "techreborn:blocks/cables/copper_cable"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"down": {
|
"down": {
|
||||||
"true": {
|
"true": {
|
||||||
"submodel": {
|
"submodel": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue