flatten cables, they dont render correctly in world yet
This commit is contained in:
parent
a5a0d03591
commit
e068ca018c
13 changed files with 92 additions and 237 deletions
|
@ -57,7 +57,6 @@ import reborncore.common.network.RegisterPacketEvent;
|
|||
import reborncore.common.util.StringUtils;
|
||||
import reborncore.common.util.Torus;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.blocks.cable.EnumCableType;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.command.TechRebornDevCommand;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
|
@ -107,8 +106,6 @@ public class TechReborn {
|
|||
public TechReborn() {
|
||||
//Forge says to call it here, so yeah
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
//Done here so its loaded before RC's config manager
|
||||
MinecraftForge.EVENT_BUS.register(EnumCableType.class);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
|
|
@ -55,6 +55,7 @@ import reborncore.common.registration.impl.ConfigRegistry;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.tiles.cable.TileCable;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||
|
@ -74,7 +75,6 @@ public class BlockCable extends BlockContainer {
|
|||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
|
||||
|
||||
@ConfigRegistry(config = "misc", category = "cable", key = "uninsulatedElectrocutionDamage", comment = "When true an uninsulated cable will cause damage to entities")
|
||||
public static boolean uninsulatedElectrocutionDamage = true;
|
||||
|
@ -85,29 +85,18 @@ public class BlockCable extends BlockContainer {
|
|||
@ConfigRegistry(config = "misc", category = "cable", key = "uninsulatedElectrocutionParticles", comment = "When true an uninsulated cable will create a spark when an entity touches it")
|
||||
public static boolean uninsulatedElectrocutionParticles = true;
|
||||
|
||||
public BlockCable() {
|
||||
public final TRContent.Cables type;
|
||||
|
||||
public BlockCable(TRContent.Cables type) {
|
||||
super(Material.ROCK);
|
||||
this.type = type;
|
||||
setHardness(1F);
|
||||
setResistance(8F);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false).withProperty(TYPE, EnumCableType.COPPER));
|
||||
setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
public static ItemStack getCableByName(String name, int count) {
|
||||
for (int i = 0; i < EnumCableType.values().length; i++) {
|
||||
if (EnumCableType.values()[i].getName().equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.CABLE,
|
||||
count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The cable " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getCableByName(String name) {
|
||||
return getCableByName(name, 1);
|
||||
}
|
||||
|
||||
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
|
||||
public TileEntity getTileEntitySafely(IBlockAccess blockAccess, BlockPos pos) {
|
||||
if (blockAccess instanceof ChunkCache) {
|
||||
|
@ -166,32 +155,6 @@ public class BlockCable extends BlockContainer {
|
|||
}
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
if (state.getValue(TYPE) == EnumCableType.ICOPPER) {
|
||||
drops.add(getCableByName("copper", 1));
|
||||
}
|
||||
else if (state.getValue(TYPE) == EnumCableType.IGOLD) {
|
||||
drops.add(getCableByName("gold", 1));
|
||||
}
|
||||
else if (state.getValue(TYPE) == EnumCableType.IHV) {
|
||||
drops.add(getCableByName("hv", 1));
|
||||
}
|
||||
else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return state.getValue(TYPE).getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
|
@ -210,7 +173,7 @@ public class BlockCable extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
if (blockState.getValue(TYPE) == EnumCableType.GLASSFIBER)
|
||||
if (type == TRContent.Cables.GLASSFIBER)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -223,7 +186,7 @@ public class BlockCable extends BlockContainer {
|
|||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, EAST, WEST, NORTH, SOUTH, UP, DOWN, TYPE);
|
||||
return new BlockStateContainer(this, EAST, WEST, NORTH, SOUTH, UP, DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -231,21 +194,14 @@ public class BlockCable extends BlockContainer {
|
|||
return getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (EnumCableType cableType : EnumCableType.values()) {
|
||||
list.add(new ItemStack(this, 1, cableType.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(TYPE, EnumCableType.values()[meta]);
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,7 +214,7 @@ public class BlockCable extends BlockContainer {
|
|||
state = state.getActualState(source, pos);
|
||||
float minSize = 0.3125F;
|
||||
float maxSize = 0.6875F;
|
||||
int thinkness = (int) state.getValue(TYPE).cableThickness;
|
||||
int thinkness = (int) type.cableThickness;
|
||||
if(thinkness == 6){
|
||||
minSize = 0.35F;
|
||||
maxSize = 0.65F;
|
||||
|
@ -287,13 +243,13 @@ public class BlockCable extends BlockContainer {
|
|||
@Override
|
||||
public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entity) {
|
||||
super.onEntityCollision(worldIn, pos, state, entity);
|
||||
if (state.getValue(TYPE).canKill && entity instanceof EntityLivingBase) {
|
||||
if (type.canKill && entity instanceof EntityLivingBase) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
if (tileEntity != null && tileEntity instanceof TileCable) {
|
||||
TileCable tileCable = (TileCable) tileEntity;
|
||||
if (tileCable.power != 0) {
|
||||
if (uninsulatedElectrocutionDamage) {
|
||||
if (state.getValue(TYPE) == EnumCableType.HV) {
|
||||
if (type == TRContent.Cables.HV) {
|
||||
entity.setFire(1);
|
||||
}
|
||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.blocks.cable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.registration.impl.ConfigRegistryFactory;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public enum EnumCableType implements IStringSerializable {
|
||||
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.MEDIUM),
|
||||
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.LOW),
|
||||
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.HIGH),
|
||||
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.EXTREME),
|
||||
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.INSANE),
|
||||
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.MEDIUM),
|
||||
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.HIGH),
|
||||
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.EXTREME);
|
||||
|
||||
public String textureName = "minecraft:blocks/iron_block";
|
||||
public int transferRate = 128;
|
||||
public int defaultTransferRate = 128;
|
||||
public double cableThickness = 3.0;
|
||||
public boolean canKill = false;
|
||||
public boolean defaultCanKill = false;
|
||||
public EnumPowerTier tier;
|
||||
private String friendlyName;
|
||||
|
||||
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill,
|
||||
EnumPowerTier tier) {
|
||||
this.friendlyName = friendlyName;
|
||||
this.textureName = textureName;
|
||||
this.transferRate = transferRate;
|
||||
this.defaultTransferRate = transferRate;
|
||||
this.cableThickness = cableThickness / 2;
|
||||
this.canKill = canKill;
|
||||
this.defaultCanKill = canKill;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return friendlyName.toLowerCase();
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(ModBlocks.CABLE, 1, this.ordinal());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleConfig(ConfigRegistryFactory.RebornRegistryEvent event){
|
||||
Configuration config = event.getConfiguration(TechReborn.MOD_ID, "misc");
|
||||
for(EnumCableType cableType : values()){
|
||||
cableType.transferRate = config.getInt(cableType.friendlyName + "_transfer_rate", "cable", cableType.defaultTransferRate, 0, Integer.MAX_VALUE, "Cable transfer rate");
|
||||
cableType.canKill = config.getBoolean(cableType.friendlyName + "_do_damage", "cable", cableType.defaultCanKill, "Set to true to allow cable to do damge to enties that come in contact with it");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,7 +35,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blocks.cable.BlockCable;
|
||||
import techreborn.blocks.cable.EnumCableType;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -130,20 +129,23 @@ public class RegisterItemJsons {
|
|||
|
||||
register(ModBlocks.RUBBER_SAPLING, "misc/rubber_sapling");
|
||||
|
||||
for (EnumCableType cableType : EnumCableType.values()) {
|
||||
registerBlockstateMultiItem(Item.getItemFromBlock(ModBlocks.CABLE), cableType.ordinal(), cableType.getName().toLowerCase(), "cable_inv");
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.CABLE, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>>newLinkedHashMap(state.getProperties());
|
||||
if (state.getValue(BlockCable.TYPE).ordinal() <= 4) {
|
||||
return new ModelResourceLocation(new ResourceLocation(ModBlocks.CABLE.getRegistryName().getNamespace(), ModBlocks.CABLE.getRegistryName().getPath()) + "_thin", this.getPropertyString(map));
|
||||
}
|
||||
return new ModelResourceLocation(new ResourceLocation(ModBlocks.CABLE.getRegistryName().getNamespace(), ModBlocks.CABLE.getRegistryName().getPath()) + "_thick", this.getPropertyString(map));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
|
|
|
@ -52,7 +52,6 @@ import techreborn.itemblocks.*;
|
|||
public class ModBlocks {
|
||||
|
||||
// Misc Blocks
|
||||
public static Block CABLE;
|
||||
public static Block COMPUTER_CUBE;
|
||||
public static Block FLARE;
|
||||
public static Block MACHINE_CASINGS_ADVANCED;
|
||||
|
@ -150,9 +149,6 @@ public class ModBlocks {
|
|||
COMPUTER_CUBE = new BlockComputerCube();
|
||||
registerBlock(COMPUTER_CUBE, "computer_cube");
|
||||
|
||||
CABLE = new BlockCable();
|
||||
registerBlock(CABLE, ItemBlockCable.class, "cable");
|
||||
|
||||
NUKE = new BlockNuke();
|
||||
registerBlock(NUKE, "nuke");
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public class OreDict {
|
|||
OreUtil.registerOre("crafterWood", Blocks.CRAFTING_TABLE);
|
||||
OreUtil.registerOre("craftingIndustrialDiamond", Items.DIAMOND);
|
||||
OreUtil.registerOre("fertilizer", new ItemStack(Items.DYE, 1, 15));
|
||||
OreUtil.registerOre("insulatedGoldCableItem", BlockCable.getCableByName("insulatedgold"));
|
||||
//OreUtil.registerOre("insulatedGoldCableItem", BlockCable.getCableByName("insulatedgold"));
|
||||
OreUtil.registerOre("pulpWood", TRContent.Dusts.SAW.getStack());
|
||||
|
||||
//OreUtil.registerOre("uran235", nothing);
|
||||
|
|
|
@ -22,6 +22,7 @@ import techreborn.blocks.BlockMachineCasing;
|
|||
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.tier1.BlockElectricFurnace;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -41,6 +42,7 @@ public class TRContent {
|
|||
RebornRegistry.registerBlock(value.casing);
|
||||
});
|
||||
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block));
|
||||
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block));
|
||||
}
|
||||
|
||||
public static void registerItems() {
|
||||
|
@ -158,7 +160,39 @@ public class TRContent {
|
|||
|
||||
InitUtils.setup(block, "solar_panel_" + name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static enum Cables {
|
||||
COPPER(128, 12.0, true, EnumPowerTier.MEDIUM),
|
||||
TIN(32, 12.0, true, EnumPowerTier.LOW),
|
||||
GOLD(512, 12.0, true, EnumPowerTier.HIGH),
|
||||
HV(2048, 12.0, true, EnumPowerTier.EXTREME),
|
||||
GLASSFIBER(8192, 12.0, false, EnumPowerTier.INSANE),
|
||||
INSULATED_COPPER(128, 10.0, false, EnumPowerTier.MEDIUM),
|
||||
INSULATED_GOLD(512, 10.0, false, EnumPowerTier.HIGH),
|
||||
INSULATED_HV(2048, 10.0, false, EnumPowerTier.EXTREME);
|
||||
|
||||
public int transferRate;
|
||||
public int defaultTransferRate;
|
||||
public double cableThickness;
|
||||
public boolean canKill;
|
||||
public boolean defaultCanKill;
|
||||
public EnumPowerTier tier;
|
||||
|
||||
public final BlockCable block;
|
||||
|
||||
Cables(int transferRate, double cableThickness, boolean canKill,
|
||||
EnumPowerTier tier) {
|
||||
this.transferRate = transferRate;
|
||||
this.defaultTransferRate = transferRate;
|
||||
this.cableThickness = cableThickness / 2;
|
||||
this.canKill = canKill;
|
||||
this.defaultCanKill = canKill;
|
||||
this.tier = tier;
|
||||
this.block = new BlockCable(this);
|
||||
InitUtils.setup(block, "cable_" + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Ores implements IItemProvider {
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.common.util.RebornCraftingHelper;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blocks.cable.EnumCableType;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -76,14 +75,14 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerShaped(getStack(TRItems.INDUSTRIAL_JACKHAMMER), "NDN", "OCO", " I ", 'I', "plateIridiumAlloy", 'N', "nuggetIridium", 'D', getStack(TRItems.ADVANCED_JACKHAMMER, 1, OreDictionary.WILDCARD_VALUE), 'C', "circuitMaster", 'O', getMaterial("overclock", Type.UPGRADE));
|
||||
registerShaped(getStack(TRItems.CLOAKING_DEVICE), "CIC", "IOI", "CIC", 'C', "ingotChrome", 'I', "plateIridiumAlloy", 'O', getStack(TRItems.LAPOTRONIC_ORB));
|
||||
registerShaped(getStack(TRItems.LAPOTRONIC_ORBPACK), "FOF", "SPS", "FIF", 'F', "circuitMaster", 'O', getStack(TRItems.LAPOTRONIC_ORB), 'S', "craftingSuperconductor", 'I', "ingotIridium", 'P', getStack(TRItems.LITHIUM_ION_BATPACK));
|
||||
registerShaped(getStack(TRItems.RED_CELL_BATTERY), " W ", "TRT", "TRT", 'T', "ingotTin", 'R', "dustRedstone", 'W', EnumCableType.ICOPPER.getStack());
|
||||
registerShaped(getStack(TRItems.LITHIUM_ION_BATTERY), " C ", "PFP", "PFP", 'F', getCell("lithium"), 'P', "plateAluminum", 'C', EnumCableType.IGOLD.getStack());
|
||||
// registerShaped(getStack(TRItems.RED_CELL_BATTERY), " W ", "TRT", "TRT", 'T', "ingotTin", 'R', "dustRedstone", 'W', EnumCableType.ICOPPER.getStack());
|
||||
// registerShaped(getStack(TRItems.LITHIUM_ION_BATTERY), " C ", "PFP", "PFP", 'F', getCell("lithium"), 'P', "plateAluminum", 'C', EnumCableType.IGOLD.getStack());
|
||||
registerShaped(getStack(TRItems.LITHIUM_ION_BATPACK), "BCB", "BPB", "B B", 'B', getStack(TRItems.LITHIUM_ION_BATTERY), 'P', "plateAluminum", 'C', "circuitAdvanced");
|
||||
registerShaped(getStack(TRItems.ENERGY_CRYSTAL), "RRR", "RDR", "RRR", 'R', "dustRedstone", 'D', "gemDiamond");
|
||||
registerShaped(getStack(TRItems.LAPOTRON_CRYSTAL), "LCL", "LEL", "LCL", 'L', "dyeBlue", 'E', "energyCrystal", 'C', "circuitBasic");
|
||||
registerShaped(getStack(TRItems.LAPOTRONIC_ORB), "LLL", "LPL", "LLL", 'L', "lapotronCrystal", 'P', "plateIridiumAlloy");
|
||||
registerShaped(getStack(TRItems.SCRAP_BOX), "SSS", "SSS", "SSS", 'S', TRContent.Parts.SCRAP.getStack());
|
||||
registerShapeless(getStack(TRItems.FREQUENCY_TRANSMITTER), EnumCableType.ICOPPER.getStack(), "circuitBasic");
|
||||
//registerShapeless(getStack(TRItems.FREQUENCY_TRANSMITTER), EnumCableType.ICOPPER.getStack(), "circuitBasic");
|
||||
|
||||
if (ConfigTechReborn.enableGemArmorAndTools) {
|
||||
addToolAndArmourRecipes(getStack(TRItems.RUBY_SWORD), getStack(TRItems.RUBY_PICKAXE), getStack(TRItems.RUBY_AXE), getStack(TRItems.RUBY_HOE), getStack(TRItems.RUBY_SPADE), getStack(TRItems.RUBY_HELMET), getStack(TRItems.RUBY_CHESTPLATE), getStack(TRItems.RUBY_LEGGINGS), getStack(TRItems.RUBY_BOOTS), "gemRuby");
|
||||
|
@ -152,12 +151,12 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', "machineBlockElite");
|
||||
// registerShaped(getStack(ModBlocks.ALARM, 1, 0), "ICI", "SRS", "ICI", 'I', "ingotIron", 'C', getMaterial("copper", Type.CABLE), 'S', getMaterial("insulatedcopper", Type.CABLE), 'R', "blockRedstone" );
|
||||
registerShaped(getStack(ModBlocks.FLUID_REPLICATOR), "PCP", "CFC", "ESR", 'P', "plateTungstensteel", 'F', "machineBlockElite", 'C', "circuitMaster", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), 'S', "craftingSuperconductor",'R', getStack(ModBlocks.CHEMICAL_REACTOR));
|
||||
registerShaped(getStack(ModBlocks.HV_TRANSFORMER), " H ", " M ", " H ", 'M', getStack(ModBlocks.MV_TRANSFORMER), 'H', EnumCableType.IHV.getStack());
|
||||
registerShaped(getStack(ModBlocks.MV_TRANSFORMER), " G ", " M ", " G ", 'M', "machineBlockBasic", 'G', EnumCableType.IGOLD.getStack());
|
||||
registerShaped(getStack(ModBlocks.LV_TRANSFORMER), "PWP", "CCC", "PPP", 'P', "plankWood", 'C', "ingotCopper", 'W', EnumCableType.ICOPPER.getStack());
|
||||
registerShaped(getStack(ModBlocks.LOW_VOLTAGE_SU), "WCW", "BBB", "WWW", 'W', "plankWood", 'B', "reBattery", 'C', EnumCableType.ICOPPER.getStack());
|
||||
registerShaped(getStack(ModBlocks.MEDIUM_VOLTAGE_SU), "GEG", "EME", "GEG", 'M', "machineBlockBasic", 'E', "energyCrystal", 'G', EnumCableType.IGOLD.getStack());
|
||||
registerShaped(getStack(ModBlocks.HIGH_VOLTAGE_SU), "LAL", "LML", "LOL", 'A', "circuitAdvanced", 'L', "lapotronCrystal", 'M', getStack(ModBlocks.MEDIUM_VOLTAGE_SU), 'O', "machineBlockAdvanced");
|
||||
// registerShaped(getStack(ModBlocks.HV_TRANSFORMER), " H ", " M ", " H ", 'M', getStack(ModBlocks.MV_TRANSFORMER), 'H', EnumCableType.IHV.getStack());
|
||||
// registerShaped(getStack(ModBlocks.MV_TRANSFORMER), " G ", " M ", " G ", 'M', "machineBlockBasic", 'G', EnumCableType.IGOLD.getStack());
|
||||
// registerShaped(getStack(ModBlocks.LV_TRANSFORMER), "PWP", "CCC", "PPP", 'P', "plankWood", 'C', "ingotCopper", 'W', EnumCableType.ICOPPER.getStack());
|
||||
// registerShaped(getStack(ModBlocks.LOW_VOLTAGE_SU), "WCW", "BBB", "WWW", 'W', "plankWood", 'B', "reBattery", 'C', EnumCableType.ICOPPER.getStack());
|
||||
// registerShaped(getStack(ModBlocks.MEDIUM_VOLTAGE_SU), "GEG", "EME", "GEG", 'M', "machineBlockBasic", 'E', "energyCrystal", 'G', EnumCableType.IGOLD.getStack());
|
||||
// registerShaped(getStack(ModBlocks.HIGH_VOLTAGE_SU), "LAL", "LML", "LOL", 'A', "circuitAdvanced", 'L', "lapotronCrystal", 'M', getStack(ModBlocks.MEDIUM_VOLTAGE_SU), 'O', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.COMPRESSOR), "S S", "SCS", "SMS", 'C', "circuitBasic", 'M', "machineBlockBasic", 'S', "stone");
|
||||
registerShaped(getStack(ModBlocks.ELECTRIC_FURNACE), " C ", "RFR", " ", 'C', "circuitBasic", 'F', getStack(ModBlocks.IRON_FURNACE), 'R', "dustRedstone");
|
||||
registerShaped(getStack(ModBlocks.RECYCLER), " E ", "DCD", "GDG", 'D', "dirt", 'C', getStack(ModBlocks.COMPRESSOR), 'G', "dustGlowstone", 'E', "circuitBasic");
|
||||
|
|
|
@ -57,8 +57,8 @@ public abstract class RecipeMethods {
|
|||
return ItemCells.getCellByName(name, count);
|
||||
// } else if (type == Type.PART) {
|
||||
// return ItemParts.getPartByName(name, count);
|
||||
} else if (type == Type.CABLE) {
|
||||
return BlockCable.getCableByName(name, count);
|
||||
// } else if (type == Type.CABLE) {
|
||||
// return BlockCable.getCableByName(name, count);
|
||||
// } else if (type == Type.MACHINE_FRAME) {
|
||||
// return BlockMachineFrames.getFrameByName(name, count);
|
||||
// } else if (type == Type.MACHINE_CASING) {
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.itemblocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.blocks.cable.EnumCableType;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 12/06/2017.
|
||||
*/
|
||||
public class ItemBlockCable extends ItemBlock {
|
||||
|
||||
public ItemBlockCable(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
return super.getTranslationKey() + "." + EnumCableType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.tiles.cable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -42,7 +43,7 @@ import reborncore.common.RebornCoreConfig;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.blocks.cable.BlockCable;
|
||||
import techreborn.blocks.cable.EnumCableType;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -56,12 +57,17 @@ public class TileCable extends TileEntity
|
|||
|
||||
public int power = 0;
|
||||
private int transferRate = 0;
|
||||
private EnumCableType cableType = null;
|
||||
private TRContent.Cables cableType = null;
|
||||
private ArrayList<EnumFacing> sendingFace = new ArrayList<EnumFacing>();
|
||||
int ticksSinceLastChange = 0;
|
||||
|
||||
private EnumCableType getCableType() {
|
||||
return world.getBlockState(pos).getValue(BlockCable.TYPE);
|
||||
private TRContent.Cables getCableType() {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if(block instanceof BlockCable){
|
||||
return ((BlockCable) block).type;
|
||||
}
|
||||
//Something has gone wrong if this happens
|
||||
return TRContent.Cables.COPPER;
|
||||
}
|
||||
|
||||
public boolean canReceiveFromFace(EnumFacing face) {
|
||||
|
@ -245,6 +251,6 @@ public class TileCable extends TileEntity
|
|||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return getCableType().getStack();
|
||||
return new ItemStack(getCableType().block);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,17 +31,17 @@
|
|||
"layer0": "techreborn:items/cables/glassfiber"
|
||||
}
|
||||
},
|
||||
"insulatedcopper": {
|
||||
"insulated_copper": {
|
||||
"textures": {
|
||||
"layer0": "techreborn:items/cables/insulatedcopper"
|
||||
}
|
||||
},
|
||||
"insulatedgold": {
|
||||
"insulated_gold": {
|
||||
"textures": {
|
||||
"layer0": "techreborn:items/cables/insulatedgold"
|
||||
}
|
||||
},
|
||||
"insulatedhv": {
|
||||
"insulated_hv": {
|
||||
"textures": {
|
||||
"layer0": "techreborn:items/cables/insulatedhv"
|
||||
}
|
||||
|
|
|
@ -63,17 +63,17 @@
|
|||
}
|
||||
},
|
||||
"type": {
|
||||
"insulatedcopper": {
|
||||
"insulated_copper": {
|
||||
"textures": {
|
||||
"cable": "techreborn:blocks/cables/copper_insulated_cable"
|
||||
}
|
||||
},
|
||||
"insulatedgold": {
|
||||
"insulated_gold": {
|
||||
"textures": {
|
||||
"cable": "techreborn:blocks/cables/gold_insulated_cable"
|
||||
}
|
||||
},
|
||||
"insulatedhv": {
|
||||
"insulated_hv": {
|
||||
"textures": {
|
||||
"cable": "techreborn:blocks/cables/hv_insulated_cable"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue