Revert "Power system re-write, recipe fixes."
This reverts commit d982cc4028
.
# Conflicts:
# src/main/java/techreborn/init/ModRecipes.java
This commit is contained in:
parent
aa05d906f9
commit
d96149fc97
47 changed files with 937 additions and 1361 deletions
|
@ -15,6 +15,7 @@ import techreborn.tiles.generator.*;
|
||||||
import techreborn.tiles.idsu.TileIDSU;
|
import techreborn.tiles.idsu.TileIDSU;
|
||||||
import techreborn.tiles.lesu.TileLesu;
|
import techreborn.tiles.lesu.TileLesu;
|
||||||
import techreborn.tiles.multiblock.*;
|
import techreborn.tiles.multiblock.*;
|
||||||
|
import techreborn.tiles.multiblock.TileImplosionCompressor;
|
||||||
import techreborn.tiles.storage.TileBatBox;
|
import techreborn.tiles.storage.TileBatBox;
|
||||||
import techreborn.tiles.storage.TileMFE;
|
import techreborn.tiles.storage.TileMFE;
|
||||||
import techreborn.tiles.storage.TileMFSU;
|
import techreborn.tiles.storage.TileMFSU;
|
||||||
|
|
|
@ -54,15 +54,9 @@ public class GuiIndustrialSawmill extends GuiContainer
|
||||||
if(!sawmill.tank.isEmpty()) {
|
if(!sawmill.tank.isEmpty()) {
|
||||||
drawFluid(sawmill.tank.getFluid(), k + 11, l + 66, 12, 47, sawmill.tank.getCapacity());
|
drawFluid(sawmill.tank.getFluid(), k + 11, l + 66, 12, 47, sawmill.tank.getCapacity());
|
||||||
|
|
||||||
<<<<<<< HEAD
|
int j = sawmill.getEnergyScaled(12);
|
||||||
mc.renderEngine.bindTexture(texture);
|
if (j > 0) {
|
||||||
drawTexturedModalRect(k + 14, l + 24, 179, 88, 9, 37);
|
|
||||||
=======
|
|
||||||
j = sawmill.getEnergyScaled(12);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sawmill.getMutliBlock()) {
|
if (!sawmill.getMutliBlock()) {
|
||||||
|
@ -70,7 +64,7 @@ public class GuiIndustrialSawmill extends GuiContainer
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||||
l + 52 + 12, -1);
|
l + 52 + 12, -1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawFluid(FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
|
public void drawFluid(FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class GuiThermalGenerator extends GuiContainer
|
||||||
String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.name");
|
String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.name");
|
||||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||||
4210752);
|
4210752);
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8,
|
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.ySize - 96 + 2, 4210752);
|
||||||
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
||||||
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
|
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
|
||||||
|
|
|
@ -43,15 +43,12 @@ public class GuiVacuumFreezer extends GuiContainer {
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
j = crafter.getEnergyScaled(12);
|
j = crafter.getEnergyScaled(12);
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||||
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||||
|
|
|
@ -4,10 +4,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
import techreborn.init.ModItems;
|
import techreborn.init.ModItems;
|
||||||
|
import techreborn.power.PowerTickEvent;
|
||||||
|
|
||||||
public class TRTickHandler
|
public class TRTickHandler
|
||||||
{
|
{
|
||||||
|
@ -30,4 +32,14 @@ public class TRTickHandler
|
||||||
previouslyWearing = chestslot;
|
previouslyWearing = chestslot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void worldTick(TickEvent.WorldTickEvent e)
|
||||||
|
{
|
||||||
|
if (e.world.isRemote)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MinecraftForge.EVENT_BUS.post(new PowerTickEvent());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,9 @@ import techreborn.tiles.idsu.TileIDSU;
|
||||||
import techreborn.tiles.lesu.TileLesu;
|
import techreborn.tiles.lesu.TileLesu;
|
||||||
import techreborn.tiles.lesu.TileLesuStorage;
|
import techreborn.tiles.lesu.TileLesuStorage;
|
||||||
import techreborn.tiles.multiblock.*;
|
import techreborn.tiles.multiblock.*;
|
||||||
|
import techreborn.tiles.multiblock.TileImplosionCompressor;
|
||||||
|
import techreborn.tiles.multiblock.TileIndustrialSawmill;
|
||||||
|
import techreborn.tiles.multiblock.TileVacuumFreezer;
|
||||||
import techreborn.tiles.storage.TileBatBox;
|
import techreborn.tiles.storage.TileBatBox;
|
||||||
import techreborn.tiles.storage.TileMFE;
|
import techreborn.tiles.storage.TileMFE;
|
||||||
import techreborn.tiles.storage.TileMFSU;
|
import techreborn.tiles.storage.TileMFSU;
|
||||||
|
|
|
@ -832,10 +832,10 @@ public class ModRecipes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TechRebornAPI.addRollingOreMachinceRecipe(ItemParts.getPartByName("nichromeHeatingCoil"), " N ", "NCN", " N ", 'N',
|
CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("nichromeHeatingCoil"), " N ", "NCN", " N ", 'N',
|
||||||
"ingotNickel", 'C', "ingotChrome");
|
"ingotNickel", 'C', "ingotChrome");
|
||||||
|
|
||||||
TechRebornAPI.addRollingOreMachinceRecipe(ItemParts.getPartByName("kanthalHeatingCoil"), "III", "CAA", "AAA", 'I',
|
CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("kanthalHeatingCoil"), "III", "CAA", "AAA", 'I',
|
||||||
"ingotSteel", 'C', "ingotChrome", 'A', "ingotAluminum");
|
"ingotSteel", 'C', "ingotChrome", 'A', "ingotAluminum");
|
||||||
|
|
||||||
CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("heliumCoolantSimple"), " T ", "TCT", " T ", 'T',
|
CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("heliumCoolantSimple"), " T ", "TCT", " T ", 'T',
|
||||||
|
@ -1015,8 +1015,19 @@ public class ModRecipes
|
||||||
.addShapedOreRecipe(new ItemStack(ModBlocks.LesuStorage), "LLL", "LCL", "LLL", 'L', "blockLapis", 'C',
|
.addShapedOreRecipe(new ItemStack(ModBlocks.LesuStorage), "LLL", "LCL", "LLL", 'L', "blockLapis", 'C',
|
||||||
"circuitBasic");
|
"circuitBasic");
|
||||||
|
|
||||||
TechRebornAPI.addRollingOreMachinceRecipe(ItemParts.getPartByName("cupronickelHeatingCoil"), "NCN", "CAC", "NCN",
|
TechRebornAPI
|
||||||
'N', "ingotNickel", 'C', "ingotCopper");
|
.addRollingOreMachinceRecipe(ItemParts.getPartByName("cupronickelHeatingCoil"), "NCN", "C C", "NCN",
|
||||||
|
'N', "ingotCupronickel", 'C', "ingotCopper");
|
||||||
|
|
||||||
|
RecipeHandler.addRecipe(new VacuumFreezerRecipe(ItemIngots.getIngotByName("hotTungstensteel"),
|
||||||
|
ItemIngots.getIngotByName("tungstensteel"), 440, 128));
|
||||||
|
|
||||||
|
RecipeHandler.addRecipe(new VacuumFreezerRecipe(ItemCells.getCellByName("heliumplasma"),
|
||||||
|
ItemCells.getCellByName("helium"), 440, 128));
|
||||||
|
|
||||||
|
RecipeHandler.addRecipe(
|
||||||
|
new VacuumFreezerRecipe(ItemCells.getCellByName("water"),
|
||||||
|
ItemCells.getCellByName("cell"), 60, 128));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addVacuumFreezerRecipes() {
|
static void addVacuumFreezerRecipes() {
|
||||||
|
@ -2141,7 +2152,7 @@ public class ModRecipes
|
||||||
getOre("ic2Extractor"));
|
getOre("ic2Extractor"));
|
||||||
|
|
||||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.BlastFurnace), "CHC", "HBH", "FHF", 'H',
|
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.BlastFurnace), "CHC", "HBH", "FHF", 'H',
|
||||||
ItemParts.getPartByName("cupronickelHeatingCoil"), 'C', "circuitAdvanced", 'B',
|
new ItemStack(ModItems.parts, 1, 17), 'C', "circuitAdvanced", 'B',
|
||||||
BlockMachineFrame.getFrameByName("advancedMachine", 1), 'F', ModBlocks.ElectricFurnace);
|
BlockMachineFrame.getFrameByName("advancedMachine", 1), 'F', ModBlocks.ElectricFurnace);
|
||||||
|
|
||||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.IndustrialGrinder), "ECP", "GGG", "CBC", 'E',
|
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.IndustrialGrinder), "ECP", "GGG", "CBC", 'E',
|
||||||
|
@ -2174,7 +2185,7 @@ public class ModRecipes
|
||||||
CraftingHelper
|
CraftingHelper
|
||||||
.addShapedOreRecipe(new ItemStack(ModBlocks.RollingMachine), "PCP", "MBM", "PCP", 'P', Blocks.PISTON,
|
.addShapedOreRecipe(new ItemStack(ModBlocks.RollingMachine), "PCP", "MBM", "PCP", 'P', Blocks.PISTON,
|
||||||
'C', "circuitAdvanced", 'M', ModBlocks.Compressor, 'B',
|
'C', "circuitAdvanced", 'M', ModBlocks.Compressor, 'B',
|
||||||
"machineBlockAdvanced");
|
BlockMachineFrame.getFrameByName("machine", 1));
|
||||||
|
|
||||||
// CraftingHelper.addShapedOreRecipe(new
|
// CraftingHelper.addShapedOreRecipe(new
|
||||||
// ItemStack(ModBlocks.ElectricCraftingTable),
|
// ItemStack(ModBlocks.ElectricCraftingTable),
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class TechRebornParts implements ICompatModule
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Item fluidPipe;
|
public static Item fluidPipe;
|
||||||
|
|
||||||
|
public static HashMap<EnumCableType, Class<? extends CableMultipart>> multipartHashMap = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
|
@ -37,13 +39,17 @@ public class TechRebornParts implements ICompatModule
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event)
|
||||||
|
{
|
||||||
|
for (EnumCableType cableType : EnumCableType.values())
|
||||||
|
{
|
||||||
|
multipartHashMap.put(cableType, cableType.cableClass);
|
||||||
|
MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name());
|
||||||
|
}
|
||||||
cables = new ItemCables();
|
cables = new ItemCables();
|
||||||
cables.setRegistryName("cables");
|
cables.setRegistryName("cables");
|
||||||
GameRegistry.register(cables);
|
GameRegistry.register(cables);
|
||||||
|
|
||||||
MultipartRegistry.registerPart(CableMultipart.class, "techreborn:cable");
|
|
||||||
MultipartRegistry.registerPart(EmptyFluidPipe.class, "techreborn:fluidpipe.empty");
|
MultipartRegistry.registerPart(EmptyFluidPipe.class, "techreborn:fluidpipe.empty");
|
||||||
MultipartRegistry.registerPart(InsertingFluidPipe.class, "techreborn:fluidpipe.inserting");
|
MultipartRegistry.registerPart(InsertingFluidPipe.class, "techreborn:fluidpipe.inserting");
|
||||||
MultipartRegistry.registerPart(ExtractingFluidPipe.class, "techreborn:fluidpipe.extracting");
|
MultipartRegistry.registerPart(ExtractingFluidPipe.class, "techreborn:fluidpipe.extracting");
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package techreborn.parts.powerCables;
|
package techreborn.parts.powerCables;
|
||||||
|
|
||||||
|
import reborncore.mcmultipart.MCMultiPartMod;
|
||||||
|
import reborncore.mcmultipart.microblock.IMicroblock;
|
||||||
|
import reborncore.mcmultipart.multipart.*;
|
||||||
|
import reborncore.mcmultipart.raytrace.PartMOP;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
@ -11,13 +15,8 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.network.PacketBuffer;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.*;
|
||||||
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
@ -30,12 +29,11 @@ import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
import reborncore.common.misc.Functions;
|
import reborncore.common.misc.Functions;
|
||||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||||
import reborncore.common.util.WorldUtils;
|
import reborncore.common.util.WorldUtils;
|
||||||
import reborncore.mcmultipart.MCMultiPartMod;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import reborncore.mcmultipart.microblock.IMicroblock;
|
import techreborn.init.ModSounds;
|
||||||
import reborncore.mcmultipart.multipart.*;
|
|
||||||
import reborncore.mcmultipart.raytrace.PartMOP;
|
|
||||||
import techreborn.parts.TechRebornParts;
|
import techreborn.parts.TechRebornParts;
|
||||||
import techreborn.parts.walia.IPartWaliaProvider;
|
import techreborn.parts.walia.IPartWaliaProvider;
|
||||||
|
import techreborn.power.TRPowerNet;
|
||||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -43,7 +41,7 @@ import java.util.*;
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 02/03/2016.
|
* Created by modmuss50 on 02/03/2016.
|
||||||
*/
|
*/
|
||||||
public class CableMultipart extends Multipart
|
public abstract class CableMultipart extends Multipart
|
||||||
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType, IPartWaliaProvider {
|
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType, IPartWaliaProvider {
|
||||||
|
|
||||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||||
|
@ -57,14 +55,10 @@ public class CableMultipart extends Multipart
|
||||||
public float center = 0.6F;
|
public float center = 0.6F;
|
||||||
public float offset = 0.10F;
|
public float offset = 0.10F;
|
||||||
public Map<EnumFacing, BlockPos> connectedSides;
|
public Map<EnumFacing, BlockPos> connectedSides;
|
||||||
public double lastEnergyPacket;
|
public int ticks = 0;
|
||||||
public EnumCableType cableType = EnumCableType.ICOPPER;
|
public ItemStack stack;
|
||||||
|
public TRPowerNet mergeWith = null;
|
||||||
public CableMultipart(EnumCableType cableType) {
|
private TRPowerNet network;
|
||||||
this.cableType = cableType;
|
|
||||||
connectedSides = new HashMap<>();
|
|
||||||
refreshBounding();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CableMultipart() {
|
public CableMultipart() {
|
||||||
connectedSides = new HashMap<>();
|
connectedSides = new HashMap<>();
|
||||||
|
@ -150,6 +144,7 @@ public class CableMultipart extends Multipart
|
||||||
@Override
|
@Override
|
||||||
public void onRemoved() {
|
public void onRemoved() {
|
||||||
super.onRemoved();
|
super.onRemoved();
|
||||||
|
removeFromNetwork();
|
||||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||||
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||||
if (multipart != null) {
|
if (multipart != null) {
|
||||||
|
@ -158,6 +153,12 @@ public class CableMultipart extends Multipart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnloaded() {
|
||||||
|
super.onUnloaded();
|
||||||
|
removeFromNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
||||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||||
|
@ -171,9 +172,13 @@ public class CableMultipart extends Multipart
|
||||||
public void onNeighborBlockChange(Block block) {
|
public void onNeighborBlockChange(Block block) {
|
||||||
super.onNeighborBlockChange(block);
|
super.onNeighborBlockChange(block);
|
||||||
nearByChange();
|
nearByChange();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nearByChange() {
|
public void nearByChange() {
|
||||||
|
if (network == null) {
|
||||||
|
findAndJoinNetwork(getWorld(), getPos());
|
||||||
|
}
|
||||||
checkConnectedSides();
|
checkConnectedSides();
|
||||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||||
BlockPos blockPos = getPos().offset(direction);
|
BlockPos blockPos = getPos().offset(direction);
|
||||||
|
@ -183,6 +188,7 @@ public class CableMultipart extends Multipart
|
||||||
part.checkConnectedSides();
|
part.checkConnectedSides();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TRPowerNet.buildEndpoint(network);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -252,14 +258,18 @@ public class CableMultipart extends Multipart
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (getWorld() != null) {
|
if (getWorld() != null) {
|
||||||
if(lastEnergyPacket > 0)
|
|
||||||
--lastEnergyPacket;
|
|
||||||
|
|
||||||
if (getWorld().getTotalWorldTime() % 80 == 0) {
|
if (getWorld().getTotalWorldTime() % 80 == 0) {
|
||||||
checkConnectedSides();
|
checkConnectedSides();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (network == null) {
|
||||||
|
this.findAndJoinNetwork(getWorld(), getPos());
|
||||||
|
} else {
|
||||||
|
if (mergeWith != null) {
|
||||||
|
getNetwork().merge(mergeWith);
|
||||||
|
mergeWith = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -284,7 +294,7 @@ public class CableMultipart extends Multipart
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
return getCableType().material;
|
return Material.CLOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,8 +307,32 @@ public class CableMultipart extends Multipart
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollided(Entity entity) {
|
public void onEntityCollided(Entity entity) {
|
||||||
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
||||||
entity.attackEntityFrom(new ElectrialShockSource(), (float) (lastEnergyPacket / 16F));
|
if (network != null) {
|
||||||
|
if (network.getEnergy() != 0) {
|
||||||
|
if (ConfigTechReborn.UninsulatedElectocutionDamage) {
|
||||||
|
if (getCableType() == EnumCableType.HV) {
|
||||||
|
entity.setFire(1);
|
||||||
}
|
}
|
||||||
|
network.setEnergy(-1);
|
||||||
|
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||||
|
}
|
||||||
|
if (ConfigTechReborn.UninsulatedElectocutionSound) {
|
||||||
|
getWorld().playSound(null, entity.posX, entity.posY,
|
||||||
|
entity.posZ, ModSounds.shock,
|
||||||
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
|
}
|
||||||
|
if (ConfigTechReborn.UninsulatedElectocutionParticle) {
|
||||||
|
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
|
||||||
|
0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityStanding(Entity entity) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +341,63 @@ public class CableMultipart extends Multipart
|
||||||
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void findAndJoinNetwork(World world, BlockPos pos) {
|
||||||
|
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||||
|
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||||
|
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
|
||||||
|
TRPowerNet net = cableMultipart.getNetwork();
|
||||||
|
if (net != null) {
|
||||||
|
network = net;
|
||||||
|
network.addElement(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (network == null) {
|
||||||
|
network = new TRPowerNet(getCableType());
|
||||||
|
network.addElement(this);
|
||||||
|
}
|
||||||
|
network.endpoints.clear();
|
||||||
|
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||||
|
TileEntity te = getNeighbourTile(dir);
|
||||||
|
if (te != null && te instanceof IEnergyInterfaceTile) {
|
||||||
|
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final TRPowerNet getNetwork() {
|
||||||
|
return network;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setNetwork(TRPowerNet n) {
|
||||||
|
if (n == null) {
|
||||||
|
} else {
|
||||||
|
network = n;
|
||||||
|
network.addElement(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void removeFromNetwork() {
|
||||||
|
if (network == null) {
|
||||||
|
} else
|
||||||
|
network.removeElement(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void rebuildNetwork() {
|
||||||
|
this.removeFromNetwork();
|
||||||
|
this.resetNetwork();
|
||||||
|
this.findAndJoinNetwork(getWorld(), getPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void resetNetwork() {
|
||||||
|
if (network != null) {
|
||||||
|
network.removeElement(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
network = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info) {
|
public void addInfo(List<String> info) {
|
||||||
info.add(TextFormatting.GREEN + "EU Transfer: " +
|
info.add(TextFormatting.GREEN + "EU Transfer: " +
|
||||||
|
@ -325,35 +416,4 @@ public class CableMultipart extends Multipart
|
||||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||||
return layer == BlockRenderLayer.CUTOUT;
|
return layer == BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
|
||||||
tag.setString("CableType", cableType.name());
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
|
||||||
if(tag.hasKey("CableType")) {
|
|
||||||
cableType = EnumCableType.valueOf(tag.getString("CableType"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeUpdatePacket(PacketBuffer buf) {
|
|
||||||
super.writeUpdatePacket(buf);
|
|
||||||
buf.writeInt(cableType.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readUpdatePacket(PacketBuffer buf) {
|
|
||||||
super.readUpdatePacket(buf);
|
|
||||||
cableType = EnumCableType.values()[buf.readInt()];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumCableType getCableType() {
|
|
||||||
return cableType;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,44 @@
|
||||||
package techreborn.parts.powerCables;
|
package techreborn.parts.powerCables;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
|
import techreborn.parts.powerCables.types.CopperCable;
|
||||||
|
import techreborn.parts.powerCables.types.GlassFiberCable;
|
||||||
|
import techreborn.parts.powerCables.types.GoldCable;
|
||||||
|
import techreborn.parts.powerCables.types.HVCable;
|
||||||
|
import techreborn.parts.powerCables.types.InsulatedCopperCable;
|
||||||
|
import techreborn.parts.powerCables.types.InsulatedGoldCable;
|
||||||
|
import techreborn.parts.powerCables.types.InsulatedHVCable;
|
||||||
|
import techreborn.parts.powerCables.types.TinCable;
|
||||||
|
|
||||||
public enum EnumCableType implements IStringSerializable
|
public enum EnumCableType implements IStringSerializable
|
||||||
{
|
{
|
||||||
COPPER("copper", "techreborn:blocks/cables/copper_cable", Material.IRON, 128, 12.0, true, EnumPowerTier.LOW),
|
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW, CopperCable.class),
|
||||||
TIN("tin", "techreborn:blocks/cables/tin_cable", Material.IRON, 32, 12.0, true, EnumPowerTier.MEDIUM),
|
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM, TinCable.class),
|
||||||
GOLD("gold", "techreborn:blocks/cables/gold_cable", Material.IRON, 512, 12.0, true, EnumPowerTier.MEDIUM),
|
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM, GoldCable.class),
|
||||||
HV("hv", "techreborn:blocks/cables/hv_cable", Material.IRON, 2048, 12.0, true, EnumPowerTier.HIGH),
|
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH, HVCable.class),
|
||||||
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", Material.GLASS, 8192, 12.0, false, EnumPowerTier.HIGH),
|
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH, GlassFiberCable.class),
|
||||||
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", Material.CLOTH, 128, 10.0, false, EnumPowerTier.LOW),
|
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW, InsulatedCopperCable.class),
|
||||||
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", Material.CLOTH, 512, 10.0, false, EnumPowerTier.MEDIUM),
|
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.MEDIUM, InsulatedGoldCable.class),
|
||||||
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", Material.CLOTH, 2048, 10.0, false, EnumPowerTier.HIGH);
|
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH, InsulatedHVCable.class);
|
||||||
|
|
||||||
public Material material;
|
|
||||||
public String textureName = "minecraft:blocks/iron_block";
|
public String textureName = "minecraft:blocks/iron_block";
|
||||||
public int transferRate = 128;
|
public int transferRate = 128;
|
||||||
public double cableThickness = 3.0;
|
public double cableThickness = 3.0;
|
||||||
public boolean canKill = false;
|
public boolean canKill = false;
|
||||||
|
public Class<? extends CableMultipart> cableClass;
|
||||||
public EnumPowerTier tier;
|
public EnumPowerTier tier;
|
||||||
private String friendlyName;
|
private String friendlyName;
|
||||||
|
|
||||||
EnumCableType(String friendlyName, String textureName, Material material, int transferRate, double cableThickness, boolean canKill,
|
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill,
|
||||||
EnumPowerTier tier)
|
EnumPowerTier tier, Class<? extends CableMultipart> cableClass)
|
||||||
{
|
{
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
this.material = material;
|
|
||||||
this.transferRate = transferRate;
|
this.transferRate = transferRate;
|
||||||
this.cableThickness = cableThickness / 2;
|
this.cableThickness = cableThickness / 2;
|
||||||
this.canKill = canKill;
|
this.canKill = canKill;
|
||||||
|
this.cableClass = cableClass;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,17 @@ public class ItemCables extends ItemMultiPart implements ITexturedItem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack, EntityPlayer player) {
|
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack,
|
||||||
return new CableMultipart(EnumCableType.values()[stack.getItemDamage()]);
|
EntityPlayer player)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
|
||||||
|
} catch (InstantiationException | IllegalAccessException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,241 +0,0 @@
|
||||||
package techreborn.power;
|
|
||||||
|
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import ic2.api.energy.tile.IEnergySink;
|
|
||||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
|
||||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
|
||||||
import reborncore.common.RebornCoreConfig;
|
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.mcmultipart.block.TileMultipartContainer;
|
|
||||||
import reborncore.mcmultipart.multipart.ISlottedPart;
|
|
||||||
import reborncore.mcmultipart.multipart.PartSlot;
|
|
||||||
import techreborn.parts.powerCables.CableMultipart;
|
|
||||||
import techreborn.parts.powerCables.EnumCableType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
public class PowerNet {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as {@link #dispatchEnergyPacketRecursively(World, ArrayList, BlockPos, boolean, double)}
|
|
||||||
* But not simulated and excluding source block
|
|
||||||
* @param world the world to dispatch in
|
|
||||||
* @param energyAmount energy units to dispatch
|
|
||||||
* @return dispatched energy units
|
|
||||||
*/
|
|
||||||
public static double dispatchEnergyPacket(World world, BlockPos source, double energyAmount) {
|
|
||||||
return dispatchEnergyPacketRecursively(world, Lists.newArrayList(source), source, false, energyAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatches energy packet recursively through wires to all connected decives
|
|
||||||
* @param world the world to dispatch in
|
|
||||||
* @param excludes blocks to exclude from checking. as example, start block
|
|
||||||
* @param blockPos block pos to start checking
|
|
||||||
* @param maxEnergy energy units to dispatch
|
|
||||||
* @param simulate true if dispatch is only simulated
|
|
||||||
* @return dispatched energy units
|
|
||||||
*/
|
|
||||||
public static double dispatchEnergyPacketRecursively(World world, ArrayList<BlockPos> excludes, BlockPos blockPos, boolean simulate, final double maxEnergy) {
|
|
||||||
double energyLeft = maxEnergy;
|
|
||||||
Collection<EnumFacing> connections = Lists.newArrayList(EnumFacing.VALUES);
|
|
||||||
|
|
||||||
//Workaround for multipart cables
|
|
||||||
CableMultipart selfCable = getWire(world, blockPos);
|
|
||||||
|
|
||||||
if(selfCable != null) {
|
|
||||||
connections = selfCable.connectedSides.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
|
||||||
if(tileEntity instanceof TilePowerAcceptor) {
|
|
||||||
for(EnumFacing facing : EnumFacing.VALUES) {
|
|
||||||
if(!((TilePowerAcceptor) tileEntity).canProvideEnergy(facing))
|
|
||||||
connections.remove(facing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(EnumFacing facing : connections) {
|
|
||||||
BlockPos offsetPos = blockPos.offset(facing);
|
|
||||||
if(!excludes.contains(offsetPos)) {
|
|
||||||
excludes.add(offsetPos);
|
|
||||||
if(isWire(world, offsetPos)) {
|
|
||||||
CableMultipart cable = getWire(world, offsetPos);
|
|
||||||
EnumCableType cableType = cable.getCableType();
|
|
||||||
double transferRate = cableType.transferRate;
|
|
||||||
double maxPacket = transferRate > maxEnergy ? maxEnergy : transferRate;
|
|
||||||
energyLeft -= dispatchEnergyPacketRecursively(world, excludes, offsetPos, simulate, maxPacket);
|
|
||||||
if(energyLeft == 0) {
|
|
||||||
if(selfCable != null)
|
|
||||||
selfCable.lastEnergyPacket = maxEnergy * 1.3F;
|
|
||||||
return maxEnergy;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PowerNetReceiver receiver = getReceiver(world, facing.getOpposite(), offsetPos);
|
|
||||||
if(receiver != null) {
|
|
||||||
energyLeft -= receiver.receiveEnergy(energyLeft, simulate);
|
|
||||||
if(energyLeft == 0) {
|
|
||||||
if(selfCable != null)
|
|
||||||
selfCable.lastEnergyPacket = maxEnergy * 1.3F;
|
|
||||||
return maxEnergy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double energyDispatched = maxEnergy - energyLeft;
|
|
||||||
if(selfCable != null)
|
|
||||||
selfCable.lastEnergyPacket = energyDispatched * 1.3F;
|
|
||||||
return energyDispatched;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////// Wire utilities ////////////////////
|
|
||||||
|
|
||||||
public static boolean isWire(World world, BlockPos blockPos) {
|
|
||||||
return getWire(world, blockPos) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CableMultipart getWire(World world, BlockPos pos) {
|
|
||||||
TileEntity tileEntity = world.getTileEntity(pos);
|
|
||||||
if(tileEntity instanceof TileMultipartContainer) {
|
|
||||||
TileMultipartContainer multipart = (TileMultipartContainer) tileEntity;
|
|
||||||
ISlottedPart centerPart = multipart.getPartInSlot(PartSlot.CENTER);
|
|
||||||
if(centerPart instanceof CableMultipart)
|
|
||||||
return (CableMultipart) centerPart;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////// Power Net Sources functionality ////////////////////
|
|
||||||
//TODO
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////// Power Net Receivers functionality ////////////////////
|
|
||||||
|
|
||||||
public static PowerNetReceiver getReceiver(World world, EnumFacing side, BlockPos pos) {
|
|
||||||
TileEntity tileEntity = world.getTileEntity(pos);
|
|
||||||
if(Loader.isModLoaded("IC2") && RebornCoreConfig.getRebornPower().eu()) {
|
|
||||||
PowerNetReceiver ic2receiver = getIC2Receiver(tileEntity, side);
|
|
||||||
if(ic2receiver != null) return ic2receiver;
|
|
||||||
}
|
|
||||||
if(Loader.isModLoaded("Tesla") && RebornCoreConfig.getRebornPower().tesla()) {
|
|
||||||
PowerNetReceiver teslaReceiver = getTeslaReceiver(tileEntity, side);
|
|
||||||
if(teslaReceiver != null) return teslaReceiver;
|
|
||||||
}
|
|
||||||
if(RebornCoreConfig.getRebornPower().rf()) {
|
|
||||||
PowerNetReceiver rfReceiver = getRFReceiver(tileEntity, side);
|
|
||||||
if(rfReceiver != null) return rfReceiver;
|
|
||||||
}
|
|
||||||
if(RebornCoreConfig.getRebornPower().internal()) {
|
|
||||||
PowerNetReceiver internalReceiver = getInternalReceiver(tileEntity, side);
|
|
||||||
if(internalReceiver != null) return internalReceiver;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PowerNetReceiver getInternalReceiver(TileEntity tileEntity, EnumFacing side) {
|
|
||||||
if(tileEntity instanceof IEnergyInterfaceTile) {
|
|
||||||
IEnergyInterfaceTile energyInterface = (IEnergyInterfaceTile) tileEntity;
|
|
||||||
return new PowerNetReceiver(
|
|
||||||
(energy, simulated) -> {
|
|
||||||
if(energyInterface.canAcceptEnergy(side))
|
|
||||||
return energyInterface.addEnergy(energy, simulated);
|
|
||||||
return 0.0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PowerNetReceiver getIC2Receiver(TileEntity tileEntity, EnumFacing side) {
|
|
||||||
if(tileEntity instanceof IEnergySink) {
|
|
||||||
IEnergySink acceptor = (IEnergySink) tileEntity;
|
|
||||||
return new PowerNetReceiver(
|
|
||||||
(energy, simulated) -> {
|
|
||||||
if(simulated) {
|
|
||||||
double max = acceptor.getDemandedEnergy();
|
|
||||||
return max > energy ? energy : max;
|
|
||||||
}
|
|
||||||
return energy - acceptor.injectEnergy(side, energy, acceptor.getSinkTier());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PowerNetReceiver getTeslaReceiver(TileEntity tileEntity, EnumFacing side) {
|
|
||||||
if(tileEntity.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, side)) {
|
|
||||||
ITeslaConsumer consumer = tileEntity.getCapability(TeslaCapabilities.CAPABILITY_CONSUMER, side);
|
|
||||||
return new PowerNetReceiver(
|
|
||||||
(energy, simulated) -> {
|
|
||||||
long teslaEnergy = eu2tesla(energy);
|
|
||||||
return tesla2eu(consumer.givePower(teslaEnergy, simulated));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PowerNetReceiver getRFReceiver(TileEntity tileEntity, EnumFacing side) {
|
|
||||||
if(tileEntity instanceof IEnergyReceiver) {
|
|
||||||
IEnergyReceiver receiver = (IEnergyReceiver) tileEntity;
|
|
||||||
return new PowerNetReceiver(
|
|
||||||
(energy, simulated) -> {
|
|
||||||
int rfEnergy = eu2rf(energy);
|
|
||||||
return rf2eu(receiver.receiveEnergy(side, rfEnergy, simulated));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////// Energy Conversion utils ////////////////////
|
|
||||||
|
|
||||||
public static double rf2eu(int rf) {
|
|
||||||
return rf / 4F;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int eu2rf(double eu) {
|
|
||||||
return (int) Math.floor(eu * 4F);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long eu2tesla(double eu) {
|
|
||||||
return (long) Math.floor(eu / 3.75F);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double tesla2eu(long tesla) {
|
|
||||||
return tesla * 3.75F;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static class PowerNetReceiver {
|
|
||||||
|
|
||||||
private final BiFunction<Double, Boolean, Double> receiveEnergy;
|
|
||||||
|
|
||||||
public PowerNetReceiver(BiFunction<Double, Boolean, Double> receiveEnergy) {
|
|
||||||
this.receiveEnergy = receiveEnergy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends given amount fo EU to receiver
|
|
||||||
* @param max max eu to receive
|
|
||||||
* @return eu received
|
|
||||||
*/
|
|
||||||
public double receiveEnergy(double max, boolean simulated) {
|
|
||||||
return receiveEnergy.apply(max, simulated);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
10
src/main/java/techreborn/power/PowerTickEvent.java
Normal file
10
src/main/java/techreborn/power/PowerTickEvent.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package techreborn.power;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
|
public class PowerTickEvent extends Event
|
||||||
|
{
|
||||||
|
public PowerTickEvent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
358
src/main/java/techreborn/power/TRPowerNet.java
Normal file
358
src/main/java/techreborn/power/TRPowerNet.java
Normal file
|
@ -0,0 +1,358 @@
|
||||||
|
package techreborn.power;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
|
import techreborn.parts.powerCables.CableMultipart;
|
||||||
|
import techreborn.parts.powerCables.EnumCableType;
|
||||||
|
|
||||||
|
public class TRPowerNet
|
||||||
|
{
|
||||||
|
public ArrayList<EnergyHandler> endpoints = new ArrayList();
|
||||||
|
int tick = 0;
|
||||||
|
EnumCableType cableType;
|
||||||
|
private ArrayList<CableMultipart> cables = new ArrayList();
|
||||||
|
private int energy = 0;
|
||||||
|
|
||||||
|
public TRPowerNet(EnumCableType cableType)
|
||||||
|
{
|
||||||
|
this.cableType = cableType;
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void buildEndpoint(TRPowerNet net)
|
||||||
|
{
|
||||||
|
ArrayList<CableMultipart> parts = new ArrayList<>();
|
||||||
|
ArrayList<CableMultipart> partsToMerge = new ArrayList<>();
|
||||||
|
parts.addAll(net.cables);
|
||||||
|
for (CableMultipart cable : parts)
|
||||||
|
{
|
||||||
|
for (EnumFacing facing : EnumFacing.VALUES)
|
||||||
|
{
|
||||||
|
BlockPos pos = cable.getPos().offset(facing);
|
||||||
|
TileEntity tile = cable.getWorld().getTileEntity(pos);
|
||||||
|
if (tile != null && tile instanceof IEnergyInterfaceTile)
|
||||||
|
{
|
||||||
|
IEnergyInterfaceTile eit = (IEnergyInterfaceTile) tile;
|
||||||
|
net.addConnection(eit, facing);
|
||||||
|
}
|
||||||
|
CableMultipart cableMultipart = CableMultipart.getPartFromWorld(cable.getWorld(), pos, null);
|
||||||
|
if (cableMultipart != null)
|
||||||
|
{
|
||||||
|
if (cableMultipart.getNetwork() != net)
|
||||||
|
{
|
||||||
|
partsToMerge.add(cableMultipart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (CableMultipart cableMultipart : partsToMerge)
|
||||||
|
{
|
||||||
|
cableMultipart.mergeWith = net;
|
||||||
|
}
|
||||||
|
net.checkAndRemoveOldEndpoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIOLimit()
|
||||||
|
{
|
||||||
|
return cableType.transferRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void tick(PowerTickEvent evt)
|
||||||
|
{
|
||||||
|
if (tick < 20)
|
||||||
|
{
|
||||||
|
tick++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tick % 80 == 0)
|
||||||
|
{
|
||||||
|
List<CableMultipart> oldCables = new ArrayList<>();
|
||||||
|
for (CableMultipart cableMultipart : cables)
|
||||||
|
{
|
||||||
|
if (cableMultipart.getWorld() == null || cableMultipart.getPos() == null)
|
||||||
|
{
|
||||||
|
oldCables.add(cableMultipart);
|
||||||
|
}
|
||||||
|
CableMultipart mp = cableMultipart.getPartFromWorld(cableMultipart.getWorld(), cableMultipart.getPos(),
|
||||||
|
null);
|
||||||
|
if (mp == null)
|
||||||
|
{
|
||||||
|
oldCables.add(cableMultipart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cables.removeAll(oldCables);
|
||||||
|
}
|
||||||
|
if (!cables.isEmpty())
|
||||||
|
{
|
||||||
|
ArrayList<EnergyHandler> collectibles = new ArrayList();
|
||||||
|
ArrayList<EnergyHandler> insertibles = new ArrayList();
|
||||||
|
for (EnergyHandler ei : endpoints)
|
||||||
|
{
|
||||||
|
if (ei.isCollectible())
|
||||||
|
{
|
||||||
|
collectibles.add(ei);
|
||||||
|
}
|
||||||
|
if (ei.isInsertible())
|
||||||
|
{
|
||||||
|
insertibles.add(ei);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (energy < cableType.transferRate * cables.size())
|
||||||
|
{
|
||||||
|
for (EnergyHandler handler : collectibles)
|
||||||
|
{
|
||||||
|
energy += handler.collectEnergy(cableType.transferRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (EnergyHandler handler : insertibles)
|
||||||
|
{
|
||||||
|
energy -= handler.addEnergy(Math.min(energy, cableType.transferRate));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MinecraftForge.EVENT_BUS.unregister(this);
|
||||||
|
}
|
||||||
|
tick++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addElement(CableMultipart te)
|
||||||
|
{
|
||||||
|
if (!cables.contains(te))
|
||||||
|
{
|
||||||
|
cables.add(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeElement(CableMultipart te)
|
||||||
|
{
|
||||||
|
cables.remove(te);
|
||||||
|
this.rebuild();
|
||||||
|
this.checkAndRemoveOldEndpoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkAndRemoveOldEndpoints()
|
||||||
|
{
|
||||||
|
List<EnergyHandler> deadHandlers = new ArrayList<>();
|
||||||
|
for (EnergyHandler energyHandler : endpoints)
|
||||||
|
{
|
||||||
|
TileEntity tile = (TileEntity) energyHandler.tile;
|
||||||
|
if (tile.getWorld().getTileEntity(tile.getPos()) == null)
|
||||||
|
{
|
||||||
|
deadHandlers.add(energyHandler);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
boolean hasNet = false;
|
||||||
|
for (EnumFacing facing : EnumFacing.VALUES)
|
||||||
|
{
|
||||||
|
BlockPos pos = tile.getPos().offset(facing);
|
||||||
|
CableMultipart multipart = CableMultipart.getPartFromWorld(tile.getWorld(), pos, facing);
|
||||||
|
if (multipart != null && multipart.getNetwork() == this)
|
||||||
|
{
|
||||||
|
hasNet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasNet)
|
||||||
|
{
|
||||||
|
deadHandlers.add(energyHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
endpoints.removeAll(deadHandlers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rebuild()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cables.size(); i++)
|
||||||
|
{
|
||||||
|
CableMultipart te = cables.get(i);
|
||||||
|
te.setNetwork(null);
|
||||||
|
te.findAndJoinNetwork(te.getWorld(), te.getPos());
|
||||||
|
}
|
||||||
|
this.clear(true);
|
||||||
|
MinecraftForge.EVENT_BUS.unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnergy()
|
||||||
|
{
|
||||||
|
return energy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnergy(int energy)
|
||||||
|
{
|
||||||
|
energy += energy;
|
||||||
|
if (energy < 0)
|
||||||
|
{
|
||||||
|
energy = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConnection(IEnergyInterfaceTile ih, EnumFacing dir)
|
||||||
|
{
|
||||||
|
if (ih instanceof CableMultipart)
|
||||||
|
return;
|
||||||
|
EnergyHandler has = this.getHandleFrom(ih);
|
||||||
|
if (has == null)
|
||||||
|
{
|
||||||
|
endpoints.add(new EnergyHandler(ih, cableType, dir));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
has.side = dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void merge(TRPowerNet n)
|
||||||
|
{
|
||||||
|
if (n != this)
|
||||||
|
{
|
||||||
|
ArrayList<CableMultipart> li = new ArrayList();
|
||||||
|
for (int i = 0; i < n.cables.size(); i++)
|
||||||
|
{
|
||||||
|
CableMultipart wire = n.cables.get(i);
|
||||||
|
li.add(wire);
|
||||||
|
}
|
||||||
|
for (EnergyHandler ei : n.endpoints)
|
||||||
|
{
|
||||||
|
endpoints.add(ei);
|
||||||
|
}
|
||||||
|
n.clear(false);
|
||||||
|
for (int i = 0; i < li.size(); i++)
|
||||||
|
{
|
||||||
|
CableMultipart wire = li.get(i);
|
||||||
|
wire.setNetwork(this);
|
||||||
|
}
|
||||||
|
checkAndRemoveOldEndpoints();
|
||||||
|
MinecraftForge.EVENT_BUS.unregister(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private EnergyHandler getHandleFrom(IEnergyInterfaceTile tile)
|
||||||
|
{
|
||||||
|
for (EnergyHandler ei : endpoints)
|
||||||
|
{
|
||||||
|
if (ei.tile == tile)
|
||||||
|
return ei;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clear(boolean clearTiles)
|
||||||
|
{
|
||||||
|
if (clearTiles)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cables.size(); i++)
|
||||||
|
{
|
||||||
|
cables.get(i).resetNetwork();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cables.clear();
|
||||||
|
endpoints.clear();
|
||||||
|
energy = 0;
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int addEnergy(int maxAdd, boolean simulate)
|
||||||
|
{
|
||||||
|
if (energy >= this.getIOLimit())
|
||||||
|
return 0;
|
||||||
|
maxAdd = Math.min(this.getIOLimit(), maxAdd);
|
||||||
|
if (!simulate)
|
||||||
|
energy += maxAdd;
|
||||||
|
return maxAdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class EnergyHandler
|
||||||
|
{
|
||||||
|
private final IEnergyInterfaceTile tile;
|
||||||
|
private final EnumCableType type;
|
||||||
|
private EnumFacing side;
|
||||||
|
|
||||||
|
private EnergyHandler(IEnergyInterfaceTile ih, EnumCableType type, EnumFacing dir)
|
||||||
|
{
|
||||||
|
tile = ih;
|
||||||
|
this.type = type;
|
||||||
|
this.side = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInsertible()
|
||||||
|
{
|
||||||
|
return this.getTotalInsertible() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCollectible()
|
||||||
|
{
|
||||||
|
return this.getTotalCollectible() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(IEnergyInterfaceTile tile)
|
||||||
|
{
|
||||||
|
return tile == this.tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int collectEnergy(int max)
|
||||||
|
{
|
||||||
|
int total = 0;
|
||||||
|
if (tile.canProvideEnergy(side.getOpposite()))
|
||||||
|
{
|
||||||
|
int collect = (int) Math.min(max, Math.min(tile.getMaxOutput(), tile.getEnergy()));
|
||||||
|
total = (int) tile.useEnergy(collect, false);
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int addEnergy(int max)
|
||||||
|
{
|
||||||
|
int total = 0;
|
||||||
|
if (tile.canAcceptEnergy(side.getOpposite()) && max > 0)
|
||||||
|
{
|
||||||
|
if (type.tier.ordinal() > tile.getTier().ordinal() && max > tile.getMaxInput())
|
||||||
|
{
|
||||||
|
if (tile instanceof TileEntity)
|
||||||
|
{
|
||||||
|
((TileEntity) tile).getWorld().createExplosion(
|
||||||
|
new EntityTNTPrimed(((TileEntity) tile).getWorld()),
|
||||||
|
((TileEntity) tile).getPos().getX(), ((TileEntity) tile).getPos().getY(),
|
||||||
|
((TileEntity) tile).getPos().getZ(), 2.5F, true);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int add = max - total;
|
||||||
|
total += tile.addEnergy(add, false);
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalCollectible()
|
||||||
|
{
|
||||||
|
if (tile.canProvideEnergy(side.getOpposite()) && tile.getEnergy() != 0)
|
||||||
|
{
|
||||||
|
return (int) Math.min(tile.getMaxOutput(), tile.getEnergy());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalInsertible()
|
||||||
|
{
|
||||||
|
int total = 0;
|
||||||
|
if (tile.canAcceptEnergy(side.getOpposite()) && tile.getMaxPower() - tile.getEnergy() != 0)
|
||||||
|
{
|
||||||
|
total += tile.addEnergy(type.transferRate, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -321,7 +321,6 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
|
@ -338,6 +337,4 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
return index == 2;
|
return index == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,8 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<<<<<<< HEAD
|
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
=======
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
upgrades.tick();
|
upgrades.tick();
|
||||||
charge(3);
|
charge(3);
|
||||||
|
@ -113,22 +107,7 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,I
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
|
||||||
return new int[] {0, 1, 2};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
|
||||||
return index == 0 || index == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
|
||||||
return index == 2;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
@ -149,7 +128,6 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,I
|
||||||
{
|
{
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,214 +0,0 @@
|
||||||
package techreborn.tiles;
|
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import reborncore.api.power.EnumPowerTier;
|
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
|
||||||
import reborncore.common.misc.Location;
|
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
|
||||||
import reborncore.common.util.Inventory;
|
|
||||||
import techreborn.api.Reference;
|
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
|
|
||||||
public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
|
||||||
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
|
|
||||||
public RecipeCrafter crafter;
|
|
||||||
|
|
||||||
public TileImplosionCompressor()
|
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
// Input slots
|
|
||||||
int[] inputs = new int[2];
|
|
||||||
inputs[0] = 0;
|
|
||||||
inputs[1] = 1;
|
|
||||||
int[] outputs = new int[2];
|
|
||||||
outputs[0] = 2;
|
|
||||||
outputs[1] = 3;
|
|
||||||
crafter = new RecipeCrafter(Reference.implosionCompressorRecipe, this, 2, 2, inventory, inputs, outputs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFacing getFacing()
|
|
||||||
{
|
|
||||||
return getFacingEnum();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getWrenchDropRate()
|
|
||||||
{
|
|
||||||
return 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.ImplosionCompressor, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getMutliBlock()
|
|
||||||
{
|
|
||||||
for (EnumFacing direction : EnumFacing.values())
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
|
||||||
if (tileEntity instanceof TileMachineCasing)
|
|
||||||
{
|
|
||||||
if (!((TileMachineCasing) tileEntity).isConnected())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing))
|
|
||||||
{
|
|
||||||
int heat;
|
|
||||||
BlockMachineCasing machineCasing = (BlockMachineCasing) tileEntity.getBlockType();
|
|
||||||
heat = machineCasing.getHeatFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos()));
|
|
||||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
|
||||||
location.modifyPositionFromSide(direction, 1);
|
|
||||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
|
||||||
.getBlock().getUnlocalizedName().equals("tile.lava"))
|
|
||||||
{
|
|
||||||
heat += 500;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
if (getMutliBlock())
|
|
||||||
{
|
|
||||||
crafter.updateEntity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
|
||||||
crafter.readFromNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
return tagCompound;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void addWailaInfo(List<String> info)
|
|
||||||
// {
|
|
||||||
// super.addWailaInfo(info);
|
|
||||||
// info.add("Power Stored " + energy.getEnergyStored() +" EU");
|
|
||||||
// if(crafter.currentRecipe !=null){
|
|
||||||
// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// ISidedInventory
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
|
||||||
{
|
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
if (slotIndex >= 2)
|
|
||||||
return false;
|
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
return slotIndex == 2 || slotIndex == 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxPower()
|
|
||||||
{
|
|
||||||
return 100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Inventory getInventory() {
|
|
||||||
return inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
|
||||||
return crafter;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,317 +0,0 @@
|
||||||
package techreborn.tiles;
|
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraftforge.fluids.*;
|
|
||||||
import reborncore.api.IListInfoProvider;
|
|
||||||
import reborncore.api.power.EnumPowerTier;
|
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
|
||||||
import reborncore.common.misc.Location;
|
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
|
||||||
import reborncore.common.util.FluidUtils;
|
|
||||||
import reborncore.common.util.Inventory;
|
|
||||||
import reborncore.common.util.Tank;
|
|
||||||
import techreborn.api.Reference;
|
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
|
||||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
import techreborn.init.ModFluids;
|
|
||||||
|
|
||||||
public class TileIndustrialSawmill extends TilePowerAcceptor
|
|
||||||
implements IWrenchable, IFluidHandler,IInventoryProvider, ISidedInventory, IListInfoProvider, ITileRecipeHandler<IndustrialSawmillRecipe>, IRecipeCrafterProvider
|
|
||||||
{
|
|
||||||
public static final int TANK_CAPACITY = 16000;
|
|
||||||
|
|
||||||
public int tickTime;
|
|
||||||
public Inventory inventory = new Inventory(5, "TileIndustrialSawmill", 64, this);
|
|
||||||
public Tank tank = new Tank("TileSawmill", TANK_CAPACITY, this);
|
|
||||||
public RecipeCrafter crafter;
|
|
||||||
|
|
||||||
public TileIndustrialSawmill()
|
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// TODO configs
|
|
||||||
// Input slots
|
|
||||||
int[] inputs = new int[2];
|
|
||||||
inputs[0] = 0;
|
|
||||||
inputs[1] = 1;
|
|
||||||
int[] outputs = new int[3];
|
|
||||||
outputs[0] = 2;
|
|
||||||
outputs[1] = 3;
|
|
||||||
outputs[2] = 4;
|
|
||||||
crafter = new RecipeCrafter(Reference.industrialSawmillRecipe, this, 2, 3, inventory, inputs, outputs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
if (getMutliBlock())
|
|
||||||
{
|
|
||||||
crafter.updateEntity();
|
|
||||||
}
|
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 4);
|
|
||||||
FluidUtils.drainContainers(this, inventory, 1, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getMutliBlock()
|
|
||||||
{
|
|
||||||
for (EnumFacing direction : EnumFacing.values())
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
|
||||||
if (tileEntity instanceof TileMachineCasing)
|
|
||||||
{
|
|
||||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing))
|
|
||||||
{
|
|
||||||
int heat;
|
|
||||||
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) tileEntity.getBlockType();
|
|
||||||
heat = blockMachineCasing
|
|
||||||
.getHeatFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos()));
|
|
||||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
|
||||||
location.modifyPositionFromSide(direction, 1);
|
|
||||||
if (worldObj.getBlockState(location.getBlockPos()).getBlock().getUnlocalizedName()
|
|
||||||
.equals("tile.lava"))
|
|
||||||
{
|
|
||||||
heat += 500;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFacing getFacing()
|
|
||||||
{
|
|
||||||
return getFacingEnum();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getWrenchDropRate()
|
|
||||||
{
|
|
||||||
return 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.industrialSawmill, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isComplete()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
|
||||||
tank.readFromNBT(tagCompound);
|
|
||||||
crafter.readFromNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
|
||||||
tank.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
return tagCompound;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IFluidHandler */
|
|
||||||
@Override
|
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
|
||||||
{
|
|
||||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
|
||||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate)
|
|
||||||
{
|
|
||||||
int filled = tank.fill(resource, doFill);
|
|
||||||
tank.compareAndUpdate();
|
|
||||||
return filled;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
|
||||||
{
|
|
||||||
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
|
||||||
tank.compareAndUpdate();
|
|
||||||
return fluidStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
|
||||||
{
|
|
||||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
|
||||||
tank.compareAndUpdate();
|
|
||||||
return drained;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
|
||||||
{
|
|
||||||
return fluid == FluidRegistry.WATER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
|
||||||
{
|
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISidedInventory
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
|
||||||
{
|
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4 } : new int[] { 0, 1, 2, 3, 4 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
if (slotIndex >= 2)
|
|
||||||
return false;
|
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxPower()
|
|
||||||
{
|
|
||||||
return 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canCraft(TileEntity tile, IndustrialSawmillRecipe recipe) {
|
|
||||||
if (recipe.fluidStack == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (tile instanceof TileIndustrialSawmill) {
|
|
||||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
|
||||||
if (sawmill.tank.getFluid() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (sawmill.tank.getFluid() == recipe.fluidStack) {
|
|
||||||
if (sawmill.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCraft(TileEntity tile, IndustrialSawmillRecipe recipe) {
|
|
||||||
if (recipe.fluidStack == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (tile instanceof TileIndustrialSawmill) {
|
|
||||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
|
||||||
if (sawmill.tank.getFluid() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (sawmill.tank.getFluid() == recipe.fluidStack) {
|
|
||||||
if (sawmill.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
|
||||||
if (sawmill.tank.getFluidAmount() > 0) {
|
|
||||||
sawmill.tank.setFluid(new FluidStack(recipe.fluidStack.getFluid(),
|
|
||||||
sawmill.tank.getFluidAmount() - recipe.fluidStack.amount));
|
|
||||||
} else {
|
|
||||||
sawmill.tank.setFluid(null);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Inventory getInventory() {
|
|
||||||
return inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
|
||||||
return crafter;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,212 +0,0 @@
|
||||||
package techreborn.tiles;
|
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import reborncore.api.power.EnumPowerTier;
|
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
|
||||||
import reborncore.common.util.Inventory;
|
|
||||||
import techreborn.api.Reference;
|
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
|
||||||
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
|
|
||||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ITileRecipeHandler<VacuumFreezerRecipe>, IRecipeCrafterProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
|
||||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
|
||||||
public RecipeCrafter crafter;
|
|
||||||
public int multiBlockStatus = 0;
|
|
||||||
|
|
||||||
public TileVacuumFreezer()
|
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// Input slots
|
|
||||||
int[] inputs = new int[1];
|
|
||||||
inputs[0] = 0;
|
|
||||||
int[] outputs = new int[1];
|
|
||||||
outputs[0] = 1;
|
|
||||||
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
|
||||||
|
|
||||||
if (worldObj.getTotalWorldTime() % 20 == 0)
|
|
||||||
{
|
|
||||||
multiBlockStatus = checkMachine() ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxPower()
|
|
||||||
{
|
|
||||||
return 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFacing getFacing()
|
|
||||||
{
|
|
||||||
return getFacingEnum();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getWrenchDropRate()
|
|
||||||
{
|
|
||||||
return 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isComplete()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
|
||||||
crafter.readFromNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
return tagCompound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkMachine()
|
|
||||||
{
|
|
||||||
int xDir = EnumFacing.UP.getFrontOffsetX() * 2;
|
|
||||||
int yDir = EnumFacing.UP.getFrontOffsetY() * 2;
|
|
||||||
int zDir = EnumFacing.UP.getFrontOffsetZ() * 2;
|
|
||||||
for (int i = -1; i < 2; i++)
|
|
||||||
{
|
|
||||||
for (int j = -1; j < 2; j++)
|
|
||||||
{
|
|
||||||
for (int k = -1; k < 2; k++)
|
|
||||||
{
|
|
||||||
if ((i != 0) || (j != 0) || (k != 0))
|
|
||||||
{
|
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
|
||||||
getPos().getZ() - zDir + k)).getBlock() != ModBlocks.MachineCasing)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(new BlockPos(
|
|
||||||
getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k));
|
|
||||||
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) BlockStateContainer.getBlock();
|
|
||||||
if (blockMachineCasing
|
|
||||||
.getMetaFromState(BlockStateContainer) != (((i == 0) && (j == 0) && (k != 0))
|
|
||||||
|| ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2
|
|
||||||
: 1))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!worldObj.isAirBlock(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
|
||||||
getPos().getZ() - zDir + k)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canCraft(TileEntity tile, VacuumFreezerRecipe recipe) {
|
|
||||||
if (tile instanceof TileVacuumFreezer) {
|
|
||||||
if (((TileVacuumFreezer) tile).multiBlockStatus == 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCraft(TileEntity tile, VacuumFreezerRecipe recipe) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Inventory getInventory() {
|
|
||||||
return inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
|
||||||
return crafter;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,7 +13,6 @@ import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.api.reactor.FusionReactorRecipe;
|
import techreborn.api.reactor.FusionReactorRecipe;
|
||||||
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider
|
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider
|
||||||
{
|
{
|
||||||
|
@ -37,7 +36,8 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower()
|
||||||
|
{
|
||||||
return 100000000;
|
return 100000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,10 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxInput() {
|
public double getMaxInput()
|
||||||
if (hasStartedCrafting) {
|
{
|
||||||
|
if (hasStartedCrafting)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 8192;
|
return 8192;
|
||||||
|
@ -273,12 +275,6 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
{
|
{
|
||||||
inventory.hasChanged = false;
|
inventory.hasChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0 && hasStartedCrafting) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateRecipe()
|
private boolean validateRecipe()
|
||||||
|
|
|
@ -18,7 +18,6 @@ import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider
|
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider
|
||||||
{
|
{
|
||||||
|
@ -132,33 +131,35 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||||
|
{
|
||||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||||
syncWithAll();
|
syncWithAll();
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||||
|
{
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
syncWithAll();
|
syncWithAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tank.isEmpty() && tank.getFluidType() != null
|
if (!tank.isEmpty() && tank.getFluidType() != null
|
||||||
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType())) {
|
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType()))
|
||||||
|
{
|
||||||
double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType());
|
double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType());
|
||||||
if (getFreeSpace() >= powerIn) {
|
if (getFreeSpace() >= powerIn)
|
||||||
|
{
|
||||||
addEnergy(powerIn, false);
|
addEnergy(powerIn, false);
|
||||||
tank.drain(1, true);
|
tank.drain(1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,6 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||||
{
|
{
|
||||||
|
@ -26,20 +25,18 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
|
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
|
||||||
.getBlock() == Blocks.DRAGON_EGG) {
|
.getBlock() == Blocks.DRAGON_EGG)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,6 @@ import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -145,14 +144,17 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {
|
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
|
||||||
|
{
|
||||||
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
||||||
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
||||||
// eu per tick
|
// eu per tick
|
||||||
|
@ -168,16 +170,13 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
||||||
tank.drain(currentWithdraw, true);
|
tank.drain(currentWithdraw, true);
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||||
|
{
|
||||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||||
|
{
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,6 @@ import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||||
{
|
{
|
||||||
|
@ -38,41 +37,45 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getEnergy() < getMaxPower()) {
|
if (getEnergy() < getMaxPower())
|
||||||
if (burnTime > 0) {
|
{
|
||||||
|
if (burnTime > 0)
|
||||||
|
{
|
||||||
burnTime--;
|
burnTime--;
|
||||||
addEnergy(outputAmount);
|
addEnergy(outputAmount);
|
||||||
isBurning = true;
|
isBurning = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
isBurning = false;
|
isBurning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (burnTime == 0) {
|
if (burnTime == 0)
|
||||||
|
{
|
||||||
updateState();
|
updateState();
|
||||||
burnTime = totalBurnTime = getItemBurnTime(getStackInSlot(fuelSlot));
|
burnTime = totalBurnTime = getItemBurnTime(getStackInSlot(fuelSlot));
|
||||||
if (burnTime > 0) {
|
if (burnTime > 0)
|
||||||
|
{
|
||||||
updateState();
|
updateState();
|
||||||
burnItem = getStackInSlot(fuelSlot);
|
burnItem = getStackInSlot(fuelSlot);
|
||||||
if (getStackInSlot(fuelSlot).stackSize == 1) {
|
if (getStackInSlot(fuelSlot).stackSize == 1)
|
||||||
|
{
|
||||||
setInventorySlotContents(fuelSlot, null);
|
setInventorySlotContents(fuelSlot, null);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
decrStackSize(fuelSlot, 1);
|
decrStackSize(fuelSlot, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTickBurning = isBurning;
|
lastTickBurning = isBurning;
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState()
|
||||||
|
|
|
@ -10,7 +10,6 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
||||||
{
|
{
|
||||||
|
@ -23,33 +22,35 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
|
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() + 1))
|
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() + 1))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() - 1))
|
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() - 1))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX() - 1, getPos().getY(), getPos().getZ()))
|
} else if (worldObj.getBlockState(new BlockPos(getPos().getX() - 1, getPos().getY(), getPos().getZ()))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() - 1, getPos().getZ()))
|
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() - 1, getPos().getZ()))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,6 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileLightningRod extends TilePowerAcceptor {
|
public class TileLightningRod extends TilePowerAcceptor {
|
||||||
|
|
||||||
|
@ -24,17 +23,17 @@ public class TileLightningRod extends TilePowerAcceptor {
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if (onStatusHoldTicks > 0)
|
if(onStatusHoldTicks > 0)
|
||||||
--onStatusHoldTicks;
|
--onStatusHoldTicks;
|
||||||
|
|
||||||
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
if(onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||||
if (getBlockType() instanceof BlockMachineBase)
|
if(getBlockType() instanceof BlockMachineBase)
|
||||||
((BlockMachineBase) getBlockType()).setActive(false, worldObj, pos);
|
((BlockMachineBase) getBlockType()).setActive(false, worldObj, pos);
|
||||||
onStatusHoldTicks = -1;
|
onStatusHoldTicks = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float weatherStrength = worldObj.getThunderStrength(1.0F);
|
float weatherStrength = worldObj.getThunderStrength(1.0F);
|
||||||
if (weatherStrength > 0.2F) {
|
if(weatherStrength > 0.2F) {
|
||||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||||
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
|
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
|
||||||
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
|
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
|
||||||
|
@ -51,10 +50,6 @@ public class TileLightningRod extends TilePowerAcceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLightningStrikeMultiplier() {
|
public float getLightningStrikeMultiplier() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -151,12 +150,14 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
|
|
||||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {
|
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
|
||||||
|
{
|
||||||
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
||||||
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
||||||
// eu per tick
|
// eu per tick
|
||||||
|
@ -172,16 +173,13 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
tank.drain(currentWithdraw, true);
|
tank.drain(currentWithdraw, true);
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||||
|
{
|
||||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||||
|
{
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.util.ITickable;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.blocks.generator.BlockSolarPanel;
|
import techreborn.blocks.generator.BlockSolarPanel;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -26,25 +25,26 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!worldObj.isRemote) {
|
if(!worldObj.isRemote){
|
||||||
if (worldObj.getTotalWorldTime() % 60 == 0) {
|
if (worldObj.getTotalWorldTime() % 60 == 0)
|
||||||
|
{
|
||||||
shouldMakePower = isSunOut();
|
shouldMakePower = isSunOut();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (shouldMakePower) {
|
if (shouldMakePower)
|
||||||
|
{
|
||||||
powerToAdd = 10;
|
powerToAdd = 10;
|
||||||
addEnergy(powerToAdd);
|
addEnergy(powerToAdd);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
powerToAdd = 0;
|
powerToAdd = 0;
|
||||||
}
|
}
|
||||||
worldObj.setBlockState(getPos(), worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
worldObj.setBlockState(getPos(),
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
||||||
{
|
{
|
||||||
|
@ -138,46 +137,51 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// TODO optimise this code
|
// TODO optimise this code
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
for (EnumFacing direction : EnumFacing.values()) {
|
for (EnumFacing direction : EnumFacing.values())
|
||||||
|
{
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
|
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
|
||||||
.getBlock() == Blocks.LAVA) {
|
.getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
addEnergy(1);
|
addEnergy(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.getTotalWorldTime() % 40 == 0) {
|
if (worldObj.getTotalWorldTime() % 40 == 0)
|
||||||
|
{
|
||||||
BlockMachineBase bmb = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
BlockMachineBase bmb = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
||||||
boolean didFindLava = false;
|
boolean didFindLava = false;
|
||||||
for (EnumFacing direction : EnumFacing.values()) {
|
for (EnumFacing direction : EnumFacing.values())
|
||||||
|
{
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(),
|
getPos().getY() + direction.getFrontOffsetY(),
|
||||||
getPos().getZ() + direction.getFrontOffsetZ())).getBlock() == Blocks.LAVA) {
|
getPos().getZ() + direction.getFrontOffsetZ())).getBlock() == Blocks.LAVA)
|
||||||
|
{
|
||||||
didFindLava = true;
|
didFindLava = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bmb.setActive(didFindLava, worldObj, pos);
|
bmb.setActive(didFindLava, worldObj, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {
|
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
|
||||||
|
{
|
||||||
tank.drain(1, true);
|
tank.drain(1, true);
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||||
|
{
|
||||||
// inventory.setInventorySlotContents(2, new ItemStack(tank
|
// inventory.setInventorySlotContents(2, new ItemStack(tank
|
||||||
// .getFluidType().getBlock()));
|
// .getFluidType().getBlock()));
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||||
|
{
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
|
@ -20,19 +19,17 @@ public class TileWaterMill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
if (worldObj.getTotalWorldTime() % 20 == 0)
|
||||||
|
{
|
||||||
checkForWater();
|
checkForWater();
|
||||||
}
|
}
|
||||||
if (waterblocks > 0) {
|
if (waterblocks > 0)
|
||||||
|
{
|
||||||
addEnergy(waterblocks);
|
addEnergy(waterblocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForWater()
|
public void checkForWater()
|
||||||
|
|
|
@ -3,7 +3,6 @@ package techreborn.tiles.generator;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
|
@ -19,16 +18,19 @@ public class TileWindMill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (pos.getY() > 64) {
|
if (pos.getY() > 64)
|
||||||
double actualPower = basePower + basePower * worldObj.getThunderStrength(1.0F);
|
{
|
||||||
addEnergy(actualPower);
|
int actualPower = basePower;
|
||||||
|
if (worldObj.isThundering())
|
||||||
|
{
|
||||||
|
actualPower *= 1.25;
|
||||||
}
|
}
|
||||||
|
addEnergy(actualPower); // Value taken from
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
// http://wiki.industrial-craft.net/?title=Wind_Mill
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
// Not worth making more complicated
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||||
{
|
{
|
||||||
|
@ -126,26 +125,32 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
if (ticks == ConfigTechReborn.AverageEuOutTickTime)
|
||||||
|
{
|
||||||
euChange = -1;
|
euChange = -1;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
ticks++;
|
ticks++;
|
||||||
euChange += getEnergy() - euLastTick;
|
euChange += getEnergy() - euLastTick;
|
||||||
if (euLastTick == getEnergy()) {
|
if (euLastTick == getEnergy())
|
||||||
|
{
|
||||||
euChange = 0;
|
euChange = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
euLastTick = getEnergy();
|
euLastTick = getEnergy();
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
boolean needsInvUpdate = false;
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
if (needsInvUpdate)
|
||||||
|
{
|
||||||
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -28,25 +27,32 @@ public class TileLesu extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity()
|
||||||
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
countedNetworks.clear();
|
countedNetworks.clear();
|
||||||
connectedBlocks = 0;
|
connectedBlocks = 0;
|
||||||
for (EnumFacing dir : EnumFacing.values()) {
|
for (EnumFacing dir : EnumFacing.values())
|
||||||
|
{
|
||||||
if (worldObj.getTileEntity(
|
if (worldObj.getTileEntity(
|
||||||
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||||
getPos().getZ() + dir.getFrontOffsetZ())) instanceof TileLesuStorage) {
|
getPos().getZ() + dir.getFrontOffsetZ())) instanceof TileLesuStorage)
|
||||||
|
{
|
||||||
if (((TileLesuStorage) worldObj.getTileEntity(
|
if (((TileLesuStorage) worldObj.getTileEntity(
|
||||||
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||||
getPos().getZ() + dir.getFrontOffsetZ()))).network != null) {
|
getPos().getZ() + dir.getFrontOffsetZ()))).network != null)
|
||||||
|
{
|
||||||
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(new BlockPos(
|
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(new BlockPos(
|
||||||
getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||||
getPos().getZ() + dir.getFrontOffsetZ()))).network;
|
getPos().getZ() + dir.getFrontOffsetZ()))).network;
|
||||||
if (!countedNetworks.contains(network)) {
|
if (!countedNetworks.contains(network))
|
||||||
if (network.master == null || network.master == this) {
|
{
|
||||||
|
if (network.master == null || network.master == this)
|
||||||
|
{
|
||||||
connectedBlocks += network.storages.size();
|
connectedBlocks += network.storages.size();
|
||||||
countedNetworks.add(network);
|
countedNetworks.add(network);
|
||||||
network.master = this;
|
network.master = this;
|
||||||
|
@ -59,27 +65,25 @@ public class TileLesu extends TilePowerAcceptor
|
||||||
maxStorage = ((connectedBlocks + 1) * ConfigTechReborn.LesuStoragePerBlock);
|
maxStorage = ((connectedBlocks + 1) * ConfigTechReborn.LesuStoragePerBlock);
|
||||||
output = (connectedBlocks * ConfigTechReborn.ExtraOutputPerLesuBlock) + ConfigTechReborn.BaseLesuOutput;
|
output = (connectedBlocks * ConfigTechReborn.ExtraOutputPerLesuBlock) + ConfigTechReborn.BaseLesuOutput;
|
||||||
|
|
||||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
if (ticks == ConfigTechReborn.AverageEuOutTickTime)
|
||||||
|
{
|
||||||
euChange = -1;
|
euChange = -1;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
ticks++;
|
ticks++;
|
||||||
if (euChange == -1) {
|
if (euChange == -1)
|
||||||
|
{
|
||||||
euChange = 0;
|
euChange = 0;
|
||||||
}
|
}
|
||||||
euChange += getEnergy() - euLastTick;
|
euChange += getEnergy() - euLastTick;
|
||||||
if (euLastTick == getEnergy()) {
|
if (euLastTick == getEnergy())
|
||||||
|
{
|
||||||
euChange = 0;
|
euChange = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
euLastTick = getEnergy();
|
euLastTick = getEnergy();
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuChange()
|
public double getEuChange()
|
||||||
|
|
|
@ -22,6 +22,7 @@ import techreborn.api.Reference;
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
import techreborn.api.recipe.ITileRecipeHandler;
|
||||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
import techreborn.blocks.BlockMachineCasing;
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.multiblocks.MultiBlockCasing;
|
import techreborn.multiblocks.MultiBlockCasing;
|
||||||
import techreborn.tiles.TileMachineCasing;
|
import techreborn.tiles.TileMachineCasing;
|
||||||
|
@ -158,22 +159,6 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
tagCompound.setInteger("tickTime", tickTime);
|
tagCompound.setInteger("tickTime", tickTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD:src/main/java/techreborn/tiles/multiblock/TileBlastFurnace.java
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
|
||||||
return new int[] {0, 1, 2, 3};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
|
||||||
return index == 0 || index == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
|
||||||
return index == 2 || index == 3;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
@ -194,7 +179,6 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
{
|
{
|
||||||
return slotIndex == 2 || slotIndex == 3;
|
return slotIndex == 2 || slotIndex == 3;
|
||||||
}
|
}
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.:src/main/java/techreborn/tiles/TileBlastFurnace.java
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,7 @@ import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -36,6 +37,10 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public MultiblockChecker multiblockChecker;
|
public MultiblockChecker multiblockChecker;
|
||||||
|
|
||||||
|
public TileIndustrialSawmill() {
|
||||||
|
super(2);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
@ -214,6 +219,26 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
||||||
return 64000;
|
return 64000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxOutput() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxInput() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier() {
|
public EnumPowerTier getTier() {
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
|
|
||||||
public TileVacuumFreezer() {
|
public TileVacuumFreezer() {
|
||||||
|
super(2);
|
||||||
int[] inputs = new int[] {0};
|
int[] inputs = new int[] {0};
|
||||||
int[] outputs = new int[] {1};
|
int[] outputs = new int[] {1};
|
||||||
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||||
|
@ -52,6 +53,26 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
||||||
return 64000;
|
return 64000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxOutput() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxInput() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier() {
|
public EnumPowerTier getTier() {
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
|
|
|
@ -13,7 +13,6 @@ import reborncore.common.powerSystem.PoweredItem;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||||
import techreborn.power.PowerNet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Rushmead
|
* Created by Rushmead
|
||||||
|
@ -55,39 +54,40 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateEntity() {
|
@Override public void updateEntity()
|
||||||
if (inventory.getStackInSlot(0) != null) {
|
{
|
||||||
|
if (inventory.getStackInSlot(0) != null)
|
||||||
|
{
|
||||||
ItemStack stack = inventory.getStackInSlot(0);
|
ItemStack stack = inventory.getStackInSlot(0);
|
||||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
if(!(stack.getItem() instanceof IEnergyItemInfo)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem();
|
IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem();
|
||||||
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) {
|
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack))
|
||||||
if (canUseEnergy(item.getMaxTransfer(stack))) {
|
{
|
||||||
|
if (canUseEnergy(item.getMaxTransfer(stack)))
|
||||||
|
{
|
||||||
useEnergy(item.getMaxTransfer(stack));
|
useEnergy(item.getMaxTransfer(stack));
|
||||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
|
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inventory.getStackInSlot(1) != null) {
|
if (inventory.getStackInSlot(1) != null)
|
||||||
|
{
|
||||||
ItemStack stack = inventory.getStackInSlot(1);
|
ItemStack stack = inventory.getStackInSlot(1);
|
||||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
if(!(stack.getItem() instanceof IEnergyItemInfo)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||||
if (item.canProvideEnergy(stack)) {
|
if (item.canProvideEnergy(stack))
|
||||||
if (getEnergy() != getMaxPower()) {
|
{
|
||||||
|
if (getEnergy() != getMaxPower())
|
||||||
|
{
|
||||||
addEnergy(item.getMaxTransfer(stack));
|
addEnergy(item.getMaxTransfer(stack));
|
||||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -150,7 +150,6 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
|
@ -167,6 +166,4 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> parent of 6f54e38... Wires now transfer energy from all mods and manages it as EU. (#686)
|
|
||||||
}
|
}
|
|
@ -1,10 +1,6 @@
|
||||||
package techreborn.tiles.teir1;
|
package techreborn.tiles.teir1;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
import ic2.core.upgrade.IUpgradeItem;
|
|
||||||
=======
|
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
@ -14,12 +10,9 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
<<<<<<< HEAD
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
|
||||||
import reborncore.common.tile.TilePowerAcceptor;
|
|
||||||
=======
|
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.utils.upgrade.UpgradeHandler;
|
import techreborn.utils.upgrade.UpgradeHandler;
|
||||||
|
@ -49,15 +42,8 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<<<<<<< HEAD
|
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
//charge(3); TODO
|
|
||||||
|
|
||||||
=======
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
boolean burning = isBurning();
|
boolean burning = isBurning();
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (isBurning() && canSmelt())
|
if (isBurning() && canSmelt())
|
||||||
|
@ -193,22 +179,6 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
<<<<<<< HEAD
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
|
||||||
return new int[] {0, 1};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
|
||||||
return index == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
|
||||||
return index == 1;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
{
|
{
|
||||||
|
@ -228,7 +198,6 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
||||||
{
|
{
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower()
|
||||||
|
|
|
@ -43,20 +43,11 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<<<<<<< HEAD
|
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
upgradeHandler.tick();
|
upgradeHandler.tick();
|
||||||
//charge(3); TODO
|
|
||||||
=======
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
|
||||||
// upgrades.tick();
|
|
||||||
charge(3);
|
charge(3);
|
||||||
>>>>>>> parent of b292fdd... Rewrite to use new RebornCore Power API. Texture fixes.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue