Remove old cables

This commit is contained in:
modmuss50 2017-06-12 10:55:26 +01:00
parent 007e8714fa
commit 624d8fb93a
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
32 changed files with 53 additions and 1733 deletions

View file

@ -34,7 +34,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
@ -50,10 +49,11 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.energy.CapabilityEnergy;
import techreborn.client.TechRebornCreativeTab;
import techreborn.parts.powerCables.EnumCableType;
import techreborn.init.ModBlocks;
import techreborn.tiles.cable.TileCable;
import javax.annotation.Nullable;
import java.security.InvalidParameterException;
/**
* Created by modmuss50 on 19/05/2017.
@ -76,6 +76,20 @@ public class BlockCable extends BlockContainer {
setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false).withProperty(TYPE, EnumCableType.COPPER));
}
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);
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return new ItemStack(this, 1, 0);

View file

@ -22,38 +22,37 @@
* SOFTWARE.
*/
package techreborn.parts.powerCables;
package techreborn.blocks.cable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import reborncore.api.power.EnumPowerTier;
import techreborn.parts.powerCables.types.*;
import techreborn.init.ModBlocks;
public enum EnumCableType implements IStringSerializable {
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW, CopperCable.class),
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM, TinCable.class),
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM, GoldCable.class),
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH, HVCable.class),
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH, GlassFiberCable.class),
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW, InsulatedCopperCable.class),
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.MEDIUM, InsulatedGoldCable.class),
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH, InsulatedHVCable.class);
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW),
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM),
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM),
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH),
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH),
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW),
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.MEDIUM),
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH);
public String textureName = "minecraft:blocks/iron_block";
public int transferRate = 128;
public double cableThickness = 3.0;
public boolean canKill = false;
public Class<? extends CableMultipart> cableClass;
public EnumPowerTier tier;
private String friendlyName;
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill,
EnumPowerTier tier, Class<? extends CableMultipart> cableClass) {
EnumPowerTier tier) {
this.friendlyName = friendlyName;
this.textureName = textureName;
this.transferRate = transferRate;
this.cableThickness = cableThickness / 2;
this.canKill = canKill;
this.cableClass = cableClass;
this.tier = tier;
}
@ -61,4 +60,8 @@ public enum EnumCableType implements IStringSerializable {
public String getName() {
return friendlyName.toLowerCase();
}
public ItemStack getStack(){
return new ItemStack(ModBlocks.CABLE,1, this.ordinal());
}
}

View file

@ -29,7 +29,6 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Loader;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockOre2;
import techreborn.blocks.BlockStorage;
@ -38,8 +37,6 @@ import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.*;
import techreborn.parts.TechRebornParts;
import techreborn.parts.powerCables.EnumCableType;
public class RegisterItemJsons {
public static void registerModels() {
@ -179,12 +176,6 @@ public class RegisterItemJsons {
String[] name = BlockStorage2.types.clone();
registerBlockstate(ModBlocks.STORAGE2, i, name[i]);
}
if (Loader.isModLoaded("reborncore-mcmultipart"))
for (EnumCableType i : EnumCableType.values()) {
String name = i.getName();
registerBlockstate(TechRebornParts.cables, i.ordinal(), name, "items/misc/");
}
}
private static void registerBlocks() {

View file

@ -1,58 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.client.render.parts;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class ClientPartLoader implements ICompatModule {
@Override
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new ClientPartModelBakery());
}
@Override
public void init(FMLInitializationEvent event) {
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,60 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.client.render.parts;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 04/03/2016.
*/
public class ClientPartModelBakery {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onModelBake(ModelBakeEvent event) {
for (EnumCableType type : EnumCableType.values()) {
event.getModelRegistry().putObject(
new ModelResourceLocation("techreborn:cable", "type=" + type.getName().toLowerCase()),
new RenderCablePart(type));
}
}
@SubscribeEvent
public void textureStichEvent(TextureStitchEvent event) {
for (EnumCableType type : EnumCableType.values()) {
event.getMap().registerSprite(new ResourceLocation(type.textureName));
}
}
}

View file

@ -1,126 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.client.render.parts;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
import reborncore.client.models.BakedModelUtils;
import reborncore.common.misc.vecmath.Vecs3dCube;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class RenderCablePart implements IBakedModel {
EnumCableType type;
private FaceBakery faceBakery = new FaceBakery();
private TextureAtlasSprite texture;
public RenderCablePart(EnumCableType type) {
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
this.type = type;
}
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
type = blockState.getValue(CableMultipart.TYPE);
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
ArrayList<BakedQuad> list = new ArrayList<>();
BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
double thickness = type.cableThickness;
double lastThickness = 16 - thickness;
IExtendedBlockState state = (IExtendedBlockState) blockState;
if (side != null) {
return Collections.emptyList();
}
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness),
list, face, ModelRotation.X0_Y0, texture, null, faceBakery);
if (state != null) {
if (state.getValue(CableMultipart.UP)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness),
list, face, ModelRotation.X0_Y0, texture, EnumFacing.UP, faceBakery);
}
if (state.getValue(CableMultipart.DOWN)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list,
face, ModelRotation.X0_Y0, texture, EnumFacing.DOWN, faceBakery);
}
if (state.getValue(CableMultipart.NORTH)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list,
face, ModelRotation.X0_Y90, texture, EnumFacing.NORTH, faceBakery);
}
if (state.getValue(CableMultipart.SOUTH)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness),
list, face, ModelRotation.X0_Y270, texture, EnumFacing.SOUTH, faceBakery);
}
if (state.getValue(CableMultipart.EAST)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(lastThickness, thickness, thickness, 16.0, lastThickness, lastThickness),
list, face, ModelRotation.X0_Y0, texture, EnumFacing.EAST, faceBakery);
}
if (state.getValue(CableMultipart.WEST)) {
BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list,
face, ModelRotation.X0_Y0, texture, EnumFacing.WEST, faceBakery);
}
}
return list;
}
@Override
public boolean isAmbientOcclusion() {
return true;
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return texture;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemOverrideList getOverrides() {
return null;
}
}

View file

@ -27,18 +27,14 @@ package techreborn.compat;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.relauncher.Side;
import techreborn.client.render.parts.ClientPartLoader;
import techreborn.compat.buildcraft.BuildcraftBuildersCompat;
import techreborn.compat.buildcraft.BuildcraftCompat;
import techreborn.compat.ic2.RecipesIC2;
import techreborn.compat.crafttweaker.CraftTweakerCompat;
import techreborn.compat.ic2.RecipesIC2;
import techreborn.compat.theoneprobe.TheOneProbeCompat;
import techreborn.compat.tinkers.CompatModuleTinkers;
import techreborn.compat.waila.CompatModuleWaila;
import techreborn.config.ConfigTechReborn;
import techreborn.parts.StandalonePartCompact;
import techreborn.parts.TechRebornParts;
import techreborn.parts.walia.WailaMcMultiPartCompact;
import java.util.ArrayList;
@ -53,10 +49,6 @@ public class CompatManager {
isIC2Loaded = Loader.isModLoaded("ic2");
isQuantumStorageLoaded = Loader.isModLoaded("quantumstorage");
register(CraftTweakerCompat.class, "crafttweaker");
registerCompact(TechRebornParts.class, false, "reborncore-mcmultipart");
registerCompact(ClientPartLoader.class, false, "reborncore-mcmultipart", "@client");
registerCompact(StandalonePartCompact.class, false, "!reborncore-mcmultipart");
registerCompact(WailaMcMultiPartCompact.class, false, "reborncore-mcmultipart", "Waila", "!IC2");
register(CompatModuleWaila.class, "Waila");
register(CompatModuleTinkers.class, "tconstruct");
register(TheOneProbeCompat.class, "theoneprobe");

View file

@ -41,6 +41,7 @@ import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.api.reactor.FusionReactorRecipeHelper;
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
import techreborn.blocks.cable.EnumCableType;
import techreborn.client.gui.*;
import techreborn.compat.CompatManager;
import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory;
@ -84,8 +85,6 @@ import techreborn.init.ModBlocks;
import techreborn.init.ModFluids;
import techreborn.init.ModItems;
import techreborn.items.ItemParts;
import techreborn.parts.TechRebornParts;
import techreborn.parts.powerCables.EnumCableType;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -162,11 +161,10 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(duplicate.getTrStack());
}
}
if (TechRebornParts.cables != null) {
for (int i = 0; i < EnumCableType.values().length; i++) {
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(TechRebornParts.cables, 1, i));
}
for (int i = 0; i < EnumCableType.values().length; i++) {
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.CABLE, 1, i));
}
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(ItemParts.getPartByName("rubber"));
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(ItemParts.getPartByName("rubberSap"));
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(ItemParts.getPartByName("electronicCircuit"));

View file

@ -25,15 +25,12 @@
package techreborn.init;
import net.minecraft.item.ItemStack;
import techreborn.blocks.cable.EnumCableType;
import techreborn.compat.CompatManager;
import techreborn.config.ConfigTechReborn;
import techreborn.items.ItemIngots;
import techreborn.items.ItemParts;
import techreborn.items.ItemUpgrades;
import techreborn.parts.powerCables.EnumStandaloneCableType;
import javax.annotation.Nonnull;
/**
* Created by Mark on 18/12/2016.
*/
@ -53,14 +50,14 @@ public enum IC2Duplicates {
LVT(new ItemStack(ModBlocks.LV_TRANSFORMER)),
MVT(new ItemStack(ModBlocks.MV_TRANSFORMER)),
HVT(new ItemStack(ModBlocks.HV_TRANSFORMER)),
CABLE_COPPER(EnumStandaloneCableType.COPPER.getStack()),
CABLE_GLASSFIBER(EnumStandaloneCableType.GLASSFIBER.getStack()),
CABLE_GOLD(EnumStandaloneCableType.GOLD.getStack()),
CABLE_HV(EnumStandaloneCableType.HV.getStack()),
CABLE_ICOPPER(EnumStandaloneCableType.ICOPPER.getStack()),
CABLE_IGOLD(EnumStandaloneCableType.IGOLD.getStack()),
CABLE_IHV(EnumStandaloneCableType.IHV.getStack()),
CABLE_IIHV(EnumStandaloneCableType.TIN.getStack()),
CABLE_COPPER(EnumCableType.COPPER.getStack()),
CABLE_GLASSFIBER(EnumCableType.GLASSFIBER.getStack()),
CABLE_GOLD(EnumCableType.GOLD.getStack()),
CABLE_HV(EnumCableType.HV.getStack()),
CABLE_ICOPPER(EnumCableType.ICOPPER.getStack()),
CABLE_IGOLD(EnumCableType.IGOLD.getStack()),
CABLE_IHV(EnumCableType.IHV.getStack()),
CABLE_IIHV(EnumCableType.TIN.getStack()),
UPGRADE_OVERCLOCKER(ItemUpgrades.getUpgradeByName("overclock")),
UPGRADE_TRANSFORMER(ItemUpgrades.getUpgradeByName("transformer")),
UPGRADE_STORAGE(ItemUpgrades.getUpgradeByName("energy_storage")),

View file

@ -47,7 +47,7 @@ import techreborn.blocks.transformers.BlockHVTransformer;
import techreborn.blocks.transformers.BlockLVTransformer;
import techreborn.blocks.transformers.BlockMVTransformer;
import techreborn.itemblocks.*;
import techreborn.parts.powerCables.EnumCableType;
import techreborn.blocks.cable.EnumCableType;
import techreborn.tiles.*;
import techreborn.tiles.cable.TileCable;
import techreborn.tiles.fusionReactor.TileEntityFusionController;

View file

@ -33,8 +33,8 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.Core;
import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.cable.BlockCable;
import techreborn.items.*;
import techreborn.parts.powerCables.ItemStandaloneCables;
public class OreDict {
@ -71,7 +71,7 @@ public class OreDict {
OreDictionary.registerOre("industrialTnt", Blocks.TNT);
OreDictionary.registerOre("craftingIndustrialDiamond", Items.DIAMOND);
OreDictionary.registerOre("insulatedGoldCableItem", ItemStandaloneCables.getCableByName("insulatedgold"));
OreDictionary.registerOre("insulatedGoldCableItem", BlockCable.getCableByName("insulatedgold"));
OreDictionary.registerOre("fertilizer", new ItemStack(Items.DYE, 1, 15));
OreDictionary.registerOre("ic2Generator", ModBlocks.SOLID_FUEL_GENEREATOR);

View file

@ -32,9 +32,9 @@ import reborncore.common.util.OreUtil;
import reborncore.common.util.StringUtils;
import techreborn.blocks.BlockMachineCasing;
import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.cable.BlockCable;
import techreborn.init.IC2Duplicates;
import techreborn.items.*;
import techreborn.parts.powerCables.ItemStandaloneCables;
/**
* Created by Prospector
@ -58,7 +58,7 @@ public abstract class RecipeMethods {
} else if (type == Type.PART) {
return ItemParts.getPartByName(name, count);
} else if (type == Type.CABLE) {
return ItemStandaloneCables.getCableByName(name, count);
return BlockCable.getCableByName(name, count);
} else if (type == Type.MACHINE_FRAME) {
return BlockMachineFrame.getFrameByName(name, count);
} else if (type == Type.MACHINE_CASING) {

View file

@ -3,7 +3,7 @@ package techreborn.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import techreborn.parts.powerCables.EnumCableType;
import techreborn.blocks.cable.EnumCableType;
/**
* Created by modmuss50 on 12/06/2017.

View file

@ -1,62 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;
import techreborn.init.ModItems;
import techreborn.parts.powerCables.ItemStandaloneCables;
/**
* Created by modmuss50 on 06/03/2016.
*/
public class StandalonePartCompact implements ICompatModule {
public static ItemStandaloneCables itemStandaloneCable;
@Override
public void preInit(FMLPreInitializationEvent event) {
}
@Override
public void init(FMLInitializationEvent event) {
itemStandaloneCable = new ItemStandaloneCables();
ModItems.registerItem(itemStandaloneCable, "cables");
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,88 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import reborncore.mcmultipart.multipart.MultipartRegistry;
import techreborn.compat.ICompatModule;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
import techreborn.parts.powerCables.ItemCables;
import javax.annotation.Nullable;
import java.util.HashMap;
/**
* Created by modmuss50 on 02/03/2016.
*/
public class TechRebornParts implements ICompatModule {
@Nullable
public static Item cables;
@Nullable
public static Item fluidPipe;
public static HashMap<EnumCableType, Class<? extends CableMultipart>> multipartHashMap = new HashMap<>();
@Override
public void preInit(FMLPreInitializationEvent event) {
for (EnumCableType cableType : EnumCableType.values()) {
multipartHashMap.put(cableType, cableType.cableClass);
MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name());
}
cables = new ItemCables();
cables.setRegistryName("cables");
GameRegistry.register(cables);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public void init(FMLInitializationEvent event) {
// MultipartRegistry.registerPart(EmptyFluidPipe.class, "techreborn:fluidpipe.empty");
// MultipartRegistry.registerPart(InsertingFluidPipe.class, "techreborn:fluidpipe.inserting");
// MultipartRegistry.registerPart(ExtractingFluidPipe.class, "techreborn:fluidpipe.extracting");
// fluidPipe = new ItemFluidPipe();
// fluidPipe.setRegistryName("fluidPipe");
// GameRegistry.register(fluidPipe);
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,436 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.common.property.Properties;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import reborncore.common.RebornCoreConfig;
import reborncore.common.misc.Functions;
import reborncore.common.misc.vecmath.Vecs3dCube;
import reborncore.common.util.WorldUtils;
import reborncore.mcmultipart.MCMultiPartMod;
import reborncore.mcmultipart.microblock.IMicroblock;
import reborncore.mcmultipart.multipart.*;
import reborncore.mcmultipart.raytrace.PartMOP;
import techreborn.parts.TechRebornParts;
import techreborn.parts.walia.IPartWaliaProvider;
import java.util.*;
/**
* Created by modmuss50 on 02/03/2016.
*/
public abstract class CableMultipart extends Multipart
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType, IPartWaliaProvider, IEnergyStorage {
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
public float center = 0.6F;
public float offset = 0.10F;
public Map<EnumFacing, BlockPos> connectedSides;
public int ticks = 0;
public ItemStack stack;
public int power = 0;
public CableMultipart() {
connectedSides = new HashMap<>();
refreshBounding();
}
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
if (world == null || pos == null) {
return null;
}
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
if (side != null && container != null) {
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
if (slottedPart instanceof IMicroblock.IFaceMicroblock
&& !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) {
return null;
}
}
if (container == null) {
return null;
}
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
if (part instanceof CableMultipart) {
return (CableMultipart) part;
}
return null;
}
public void refreshBounding() {
float centerFirst = center - offset;
double w = (getCableType().cableThickness / 16) - 0.5;
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
centerFirst + w, centerFirst + w);
int i = 0;
for (EnumFacing dir : EnumFacing.VALUES) {
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
: (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0
: (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0
: (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0
: (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0
: (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
i++;
}
}
@Override
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
for (EnumFacing dir : EnumFacing.VALUES) {
if (connectedSides.containsKey(dir)
&& mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
}
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
list.add(boundingBoxes[6].toAABB());
}
super.addCollisionBoxes(mask, list, collidingEntity);
}
@Override
public void addSelectionBoxes(List<AxisAlignedBB> list) {
for (EnumFacing dir : EnumFacing.VALUES) {
if (connectedSides.containsKey(dir))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
}
list.add(boundingBoxes[6].toAABB());
super.addSelectionBoxes(list);
}
@Override
public void onRemoved() {
super.onRemoved();
for (EnumFacing dir : EnumFacing.VALUES) {
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if (multipart != null) {
multipart.nearByChange();
}
}
}
@Override
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
for (EnumFacing dir : EnumFacing.VALUES) {
if (connectedSides.containsKey(dir))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
}
list.add(boundingBoxes[6].toAABB());
}
@Override
public void onNeighborBlockChange(Block block) {
super.onNeighborBlockChange(block);
nearByChange();
}
public void nearByChange() {
checkConnectedSides();
for (EnumFacing direction : EnumFacing.VALUES) {
BlockPos blockPos = getPos().offset(direction);
WorldUtils.updateBlock(getWorld(), blockPos);
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
if (part != null) {
part.checkConnectedSides();
}
}
}
@Override
public void onAdded() {
checkConnectedSides();
}
public boolean shouldConnectTo(EnumFacing dir) {
if (dir != null) {
if (internalShouldConnectTo(dir)) {
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) {
return true;
}
} else {
TileEntity tile = getNeighbourTile(dir);
if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, dir)) {
return true;
}
}
}
return false;
}
public boolean internalShouldConnectTo(EnumFacing dir) {
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
if (part instanceof IMicroblock.IFaceMicroblock) {
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
return false;
}
}
if (!OcclusionHelper.occlusionTest(getContainer().getParts(), p -> p == this, boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
return false;
}
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
return cableMultipart != null && cableMultipart.getCableType() == getCableType();
}
public TileEntity getNeighbourTile(EnumFacing side) {
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
}
public void checkConnectedSides() {
refreshBounding();
connectedSides = new HashMap<>();
for (EnumFacing dir : EnumFacing.values()) {
int d = Functions.getIntDirFromDirection(dir);
if (getWorld() == null) {
return;
}
TileEntity te = getNeighbourTile(dir);
if (shouldConnectTo(dir)) {
connectedSides.put(dir, te.getPos());
}
}
}
@Override
public EnumSet<PartSlot> getSlotMask() {
return EnumSet.of(PartSlot.CENTER);
}
@Override
public void update() {
if (getWorld() != null) {
ticks ++;
if (getWorld().getTotalWorldTime() % 80 == 0) {
checkConnectedSides();
}
tickPower();
}
}
public void tickPower(){
for (EnumFacing face : EnumFacing.VALUES) {
if (connectedSides.containsKey(face)) {
BlockPos offPos = getPos().offset(face);
TileEntity tile = getWorld().getTileEntity(offPos);
if(tile == null){
continue;
}
if (tile.hasCapability(CapabilityEnergy.ENERGY, face.getOpposite())) {
IEnergyStorage energy = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite());
if (energy.canReceive()) {
int move = energy.receiveEnergy(Math.min(getCableType().transferRate, power), false);
if (move != 0) {
power -= move;
}
}
}
CableMultipart pipe = getPartFromWorld(getWorld(), getPos().offset(face), face);
if (pipe != null) {
int averPower = (power + pipe.power) / 2;
pipe.power = averPower;
if(averPower % 2 != 0 && power != 0){
averPower ++;
}
power = averPower;
}
}
}
}
@Override
public IBlockState getExtendedState(IBlockState state) {
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST)).withProperty(TYPE, getCableType());
}
@Override
public BlockStateContainer createBlockState() {
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE },
new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
}
@Override
public float getHardness(PartMOP hit) {
return 0.5F;
}
public Material getMaterial() {
return Material.CLOTH;
}
@Override
public List<ItemStack> getDrops() {
List<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
return list;
}
@Override
public void onEntityStanding(Entity entity) {
}
@Override
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) {
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
}
@Override
public void addInfo(List<String> info) {
info.add(TextFormatting.GREEN + "EU Transfer: " +
TextFormatting.LIGHT_PURPLE + getCableType().transferRate);
if (getCableType().canKill) {
info.add(TextFormatting.RED + "Damages entity's!");
}
}
@Override
public ResourceLocation getModelPath() {
return new ResourceLocation("techreborn:cable");
}
@Override
public boolean canRenderInLayer(BlockRenderLayer layer) {
return layer == BlockRenderLayer.CUTOUT;
}
@Override
public int receiveEnergy(int maxReceive, boolean simulate) {
if (!canReceive()){
return 0;
}
int energyReceived = Math.min(getMaxEnergyStored() - power, Math.min(getCableType().transferRate * RebornCoreConfig.euPerFU, maxReceive));
if (!simulate)
power += energyReceived;
return energyReceived;
}
@Override
public int extractEnergy(int maxExtract, boolean simulate) {
if (!canExtract()){
return 0;
}
int energyExtracted = Math.min(power, Math.min(getCableType().transferRate * RebornCoreConfig.euPerFU, maxExtract));
if (!simulate)
power -= energyExtracted;
return energyExtracted;
}
@Override
public int getEnergyStored() {
return power;
}
@Override
public int getMaxEnergyStored() {
return getCableType().transferRate * 2;
}
@Override
public boolean canExtract() {
return true;
}
@Override
public boolean canReceive() {
return true;
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if(capability == CapabilityEnergy.ENERGY){
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if(capability == CapabilityEnergy.ENERGY){
return (T) this;
}
return super.getCapability(capability, facing);
}
}

View file

@ -1,66 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import reborncore.api.power.EnumPowerTier;
public enum EnumStandaloneCableType implements IStringSerializable {
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW),
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM),
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM),
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH),
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH),
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW),
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.MEDIUM),
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH);
public String textureName = "minecraft:blocks/iron_block";
public int transferRate = 128;
public double cableThickness = 3.0;
public boolean canKill = false;
public EnumPowerTier tier;
private String friendlyName;
EnumStandaloneCableType(String friendlyName, String textureName, int transferRate, double cableThickness,
boolean canKill, EnumPowerTier tier) {
this.friendlyName = friendlyName;
this.textureName = textureName;
this.transferRate = transferRate;
this.cableThickness = cableThickness / 2;
this.canKill = canKill;
this.tier = tier;
}
@Override
public String getName() {
return friendlyName.toLowerCase();
}
public ItemStack getStack() {
return ItemStandaloneCables.getCableByName(getName());
}
}

View file

@ -1,34 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables;
/**
* Created by modmuss50 on 05/03/2016.
*/
public interface ICableType {
EnumCableType getCableType();
}

View file

@ -1,122 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.StringUtils;
import reborncore.mcmultipart.item.ItemMultiPart;
import reborncore.mcmultipart.multipart.IMultipart;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.parts.TechRebornParts;
import java.util.List;
/**
* Created by modmuss50 on 27/02/2016.
*/
public class ItemCables extends ItemMultiPart implements ITexturedItem {
public ItemCables() {
setCreativeTab(TechRebornCreativeTab.instance);
setHasSubtypes(true);
setUnlocalizedName("techreborn.cable");
setNoRepair();
RebornCore.jsonDestroyer.registerObject(this);
ItemStandaloneCables.mcPartCable = this;
}
@Override
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack,
EntityPlayer player) {
try {
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@Override
// gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= EnumCableType.values().length) {
meta = 0;
}
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
for (int meta = 0; meta < EnumCableType.values().length; ++meta) {
subItems.add(new ItemStack(this, 1, meta));
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
}
@Override
public int getMaxMeta() {
return EnumCableType.values().length;
}
@Override
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
}
@Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("desc.transfer") + " " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(type.transferRate));
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("desc.tier") + " " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(type.tier.toString()));
if (type.canKill) {
tooltip.add(TextFormatting.RED + I18n.translateToLocal("desc.uninsulatedCable"));
}
}
}

View file

@ -1,116 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTab;
import techreborn.items.ItemTextureBase;
import techreborn.lib.ModInfo;
import techreborn.parts.StandalonePartCompact;
import java.security.InvalidParameterException;
import java.util.List;
/**
* Created by modmuss50 on 06/03/2016.
*/
public class ItemStandaloneCables extends ItemTextureBase {
public static Item mcPartCable;
public ItemStandaloneCables() {
setCreativeTab(TechRebornCreativeTab.instance);
setHasSubtypes(true);
setUnlocalizedName("techreborn.cable");
setNoRepair();
RebornCore.jsonDestroyer.registerObject(this);
}
public static ItemStack getCableByName(String name, int count) {
for (int i = 0; i < EnumStandaloneCableType.values().length; i++) {
if (EnumStandaloneCableType.values()[i].getName().equalsIgnoreCase(name)) {
return new ItemStack(mcPartCable != null ? mcPartCable : StandalonePartCompact.itemStandaloneCable,
count, i);
}
}
throw new InvalidParameterException("The cable " + name + " could not be found.");
}
public static ItemStack getCableByName(String name) {
return getCableByName(name, 1);
}
@Override
// gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= EnumStandaloneCableType.values().length) {
meta = 0;
}
return super.getUnlocalizedName() + "." + EnumStandaloneCableType.values()[meta];
}
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
for (int meta = 0; meta < EnumStandaloneCableType.values().length; ++meta) {
list.add(new ItemStack(item, 1, meta));
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/cables/" + EnumStandaloneCableType.values()[damage].getName();
}
@Override
public int getMaxMeta() {
return EnumStandaloneCableType.values().length;
}
// @Override
// public ModelResourceLocation getModel(ItemStack stack, EntityPlayer
// player, int useRemaining) {
// return new ModelResourceLocation(ModInfo.MOD_ID + ":" +
// getUnlocalizedName(stack).substring(5), "inventory");
// }
@Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
EnumStandaloneCableType type = EnumStandaloneCableType.values()[stack.getItemDamage()];
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
if (type.canKill) {
tooltip.add(TextFormatting.RED + "Damages entity's!");
}
tooltip.add(TextFormatting.RED + "!!INSTALL MCMP TO PLACE CABLES!!");
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class CopperCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.COPPER;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class GlassFiberCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.GLASSFIBER;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class GoldCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.GOLD;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class HVCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.HV;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class InsulatedCopperCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.ICOPPER;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class InsulatedGoldCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.IGOLD;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class InsulatedHVCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.IHV;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.powerCables.types;
import techreborn.parts.powerCables.CableMultipart;
import techreborn.parts.powerCables.EnumCableType;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class TinCable extends CableMultipart {
@Override
public EnumCableType getCableType() {
return EnumCableType.TIN;
}
}

View file

@ -1,35 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.walia;
import java.util.List;
/**
* Created by modmuss50 on 07/03/2016.
*/
public interface IPartWaliaProvider {
void addInfo(List<String> info);
}

View file

@ -1,59 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.walia;
import mcp.mobius.waila.api.IWailaRegistrar;
import net.minecraftforge.fml.common.event.*;
import reborncore.mcmultipart.block.TileMultipartContainer;
import techreborn.compat.ICompatModule;
/**
* Created by modmuss50 on 07/03/2016.
*/
public class WailaMcMultiPartCompact implements ICompatModule {
public static void callbackRegister(IWailaRegistrar registrar) {
registrar.registerBodyProvider(new WaliaPartProvider(), TileMultipartContainer.class);
}
@Override
public void preInit(FMLPreInitializationEvent event) {
}
@Override
public void init(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,109 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 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.parts.walia;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import reborncore.mcmultipart.block.TileMultipartContainer;
import reborncore.mcmultipart.raytrace.PartMOP;
import reborncore.mcmultipart.raytrace.RayTraceUtils;
import techreborn.parts.powerCables.CableMultipart;
import java.util.ArrayList;
import java.util.List;
/**
* Created by modmuss50 on 07/03/2016.
*/
public class WaliaPartProvider implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
if (mop != null) {
if (mop.partHit instanceof CableMultipart) {
return mop.partHit.getDrops().get(0);
}
}
return ItemStack.EMPTY;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
List<String> data = new ArrayList<>();
if (mop != null) {
if (mop.partHit instanceof IPartWaliaProvider) {
((IPartWaliaProvider) mop.partHit).addInfo(data);
}
}
return data;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world,
BlockPos pos) {
return null;
}
// Stolen from
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player) {
Vec3d start = RayTraceUtils.getStart(player);
Vec3d end = RayTraceUtils.getEnd(player);
RayTraceUtils.AdvancedRayTraceResultPart result = getMultipartTile(world, pos).getPartContainer()
.collisionRayTrace(start, end);
return result == null ? null : result.hit;
}
// Stolen from
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
private TileMultipartContainer getMultipartTile(IBlockAccess world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
return tile instanceof TileMultipartContainer ? (TileMultipartContainer) tile : null;
}
}

View file

@ -33,7 +33,7 @@ import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import reborncore.common.RebornCoreConfig;
import techreborn.blocks.cable.BlockCable;
import techreborn.parts.powerCables.EnumCableType;
import techreborn.blocks.cable.EnumCableType;
/**
* Created by modmuss50 on 19/05/2017.