mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge remote-tracking branch 'HbmMods/master'
This commit is contained in:
commit
56f97e531c
@ -93,6 +93,10 @@ public interface IEnergyUser extends IEnergyConnector {
|
||||
}
|
||||
}
|
||||
|
||||
public default void updateStandardConnections(World world, TileEntity te) {
|
||||
updateStandardConnections(world, te.xCoord, te.yCoord, te.zCoord);
|
||||
}
|
||||
|
||||
public default void updateStandardConnections(World world, int x, int y, int z) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
|
||||
@ -12,6 +12,8 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
*
|
||||
* The American Heritage® Dictionary of the English Language, 5th Edition.
|
||||
*
|
||||
* Only supports one tank per type (for in- and output separately)
|
||||
*
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
|
||||
@ -15,7 +15,6 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ -1000,6 +1000,7 @@ public class ModBlocks {
|
||||
public static Block machine_selenium;
|
||||
public static final int guiID_machine_selenium = 63;
|
||||
|
||||
public static Block press_preheater;
|
||||
public static Block machine_press;
|
||||
public static final int guiID_machine_press = 53;
|
||||
public static Block machine_epress;
|
||||
@ -2127,6 +2128,7 @@ public class ModBlocks {
|
||||
machine_bat9000 = new MachineBigAssTank9000(Material.iron).setBlockName("machine_bat9000").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_orbus = new MachineOrbus(Material.iron).setBlockName("machine_orbus").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_turbofan = new MachineTurbofan(Material.iron).setBlockName("machine_turbofan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_turbofan");
|
||||
press_preheater = new BlockBase(Material.iron).setBlockName("press_preheater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":press_preheater");
|
||||
machine_press = new MachinePress(Material.iron).setBlockName("machine_press").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_press");
|
||||
machine_epress = new MachineEPress(Material.iron).setBlockName("machine_epress").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_epress");
|
||||
machine_selenium = new MachineSeleniumEngine(Material.iron).setBlockName("machine_selenium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_selenium");
|
||||
@ -2913,6 +2915,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(anvil_osmiridium, ItemBlockBase.class, anvil_osmiridium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_murky, ItemBlockBase.class, anvil_murky.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(press_preheater, press_preheater.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_press, machine_press.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_epress, machine_epress.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_difurnace_off, machine_difurnace_off.getUnlocalizedName());
|
||||
|
||||
@ -13,7 +13,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -74,6 +73,8 @@ public class BlockDoorGeneric extends BlockDummyable {
|
||||
AxisAlignedBB box = getCollisionBoundingBoxFromPool(worldIn, x, y, z);
|
||||
if(box.minY == 0 && box.maxY == 0)
|
||||
return;
|
||||
if(hasExtra(worldIn.getBlockMetadata(x, y, z)))
|
||||
return;
|
||||
super.addCollisionBoxesToList( worldIn, x, y, z, entityBox, collidingBoxes, entityIn);
|
||||
}
|
||||
|
||||
@ -107,15 +108,11 @@ public class BlockDoorGeneric extends BlockDummyable {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset);
|
||||
AxisAlignedBB box = type.getBlockBound(x - core[0], y - core[1], z - core[2], open ); //.rotate(dir.getBlockRotation().add(Rotation.COUNTERCLOCKWISE_90)), open); TODO: add rotation
|
||||
//System.out.println(te2.getBlockMetadata()-offset);
|
||||
switch(te2.getBlockMetadata()-offset){
|
||||
case 2:
|
||||
return AxisAlignedBB.getBoundingBox(1-box.minX, box.minY, 1-box.minZ, 1-box.maxX, box.maxY, 1-box.maxZ);
|
||||
case 4:
|
||||
return AxisAlignedBB.getBoundingBox(1-box.minZ, box.minY, box.minX, 1-box.maxZ, box.maxY, box.maxX);
|
||||
case 3:
|
||||
return AxisAlignedBB.getBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
|
||||
case 5:
|
||||
return AxisAlignedBB.getBoundingBox(box.minZ, box.minY, 1-box.minX, box.maxZ, box.maxY, 1-box.maxX);
|
||||
switch(te2.getBlockMetadata() - offset){
|
||||
case 2: return AxisAlignedBB.getBoundingBox(1 - box.minX, box.minY, 1 - box.minZ, 1 - box.maxX, box.maxY, 1 - box.maxZ);
|
||||
case 4: return AxisAlignedBB.getBoundingBox(1 - box.minZ, box.minY, box.minX, 1 - box.maxZ, box.maxY, box.maxX);
|
||||
case 3: return AxisAlignedBB.getBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
|
||||
case 5: return AxisAlignedBB.getBoundingBox(box.minZ, box.minY, 1 - box.minX, box.maxZ, box.maxY, 1 - box.maxX);
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
@ -1,13 +1,20 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.machine.TileEntityHadronPower;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class BlockHadronPower extends BlockContainer {
|
||||
public class BlockHadronPower extends BlockContainer implements ILookOverlay {
|
||||
|
||||
public long power;
|
||||
|
||||
@ -20,4 +27,26 @@ public class BlockHadronPower extends BlockContainer {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityHadronPower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityHadronPower))
|
||||
return;
|
||||
|
||||
TileEntityHadronPower battery = (TileEntityHadronPower) te;
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE");
|
||||
|
||||
double percent = (double) battery.getPower() / (double) battery.getMaxPower();
|
||||
int charge = (int) Math.floor(percent * 10_000D);
|
||||
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
|
||||
|
||||
text.add("&[" + color + "&]" + (charge / 100D) + "%");
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -873,6 +873,7 @@ public class CraftingManager {
|
||||
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()), new Object[] { Items.book, Items.iron_ingot });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "IGI", "ICI", "PDP", 'I', STEEL.ingot(), 'G', Items.glowstone_dust, 'C', ModBlocks.red_wire_coated, 'P', IRON.plate(), 'D', ModItems.coil_copper });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.press_preheater), new Object[] { "CCC", "SLS", "TST", 'C', ModItems.board_copper, 'S', Blocks.stone, 'L', Fluids.LAVA.getDict(1000), 'T', W.ingot() });
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_RESTORED.ordinal()), new Object[] { new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_DIGAMMA.ordinal()), KEY_TOOL_SCREWDRIVER, ModItems.ducttape, ModItems.armor_polish });
|
||||
addShapelessAuto(new ItemStack(ModItems.holotape_damaged), new Object[] { DictFrame.fromOne(ModItems.holotape_image, EnumHoloImage.HOLO_RESTORED), ModBlocks.muffler, ModItems.crt_display, ModItems.gem_alexandrite /* placeholder for amplifier */ });
|
||||
|
||||
@ -1269,6 +1269,21 @@ public class ItemRenderLibrary {
|
||||
bindTexture(ResourceManager.substation_tex); ResourceManager.substation.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.charger), new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -7, 0);
|
||||
GL11.glScaled(10, 10, 10);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glScaled(2, 2, 2);
|
||||
GL11.glTranslated(0.5, 0, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.charger_tex);
|
||||
ResourceManager.charger.renderPart("Base");
|
||||
ResourceManager.charger.renderPart("Slide");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
}
|
||||
|
||||
private static void bindTexture(ResourceLocation res) {
|
||||
|
||||
@ -91,7 +91,7 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
|
||||
if(finalPos.equals(pos)) {
|
||||
this.shouldUseBB = false;
|
||||
} else {
|
||||
((BlockDummyable)getBlockType()).removeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
|
||||
((BlockDummyable)getBlockType()).makeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,8 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
|
||||
|
||||
private List<EntityPlayer> players = new ArrayList();
|
||||
private long charge = 0;
|
||||
private int lastOp = 0;
|
||||
|
||||
long lastOp = 0;
|
||||
boolean particles = false;
|
||||
|
||||
public int usingTicks;
|
||||
@ -52,10 +52,12 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
|
||||
}
|
||||
}
|
||||
|
||||
particles = worldObj.getTotalWorldTime() - lastOp < 4;
|
||||
particles = lastOp > 0;
|
||||
|
||||
if(particles) {
|
||||
|
||||
lastOp--;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 0.2F, 0.5F);
|
||||
}
|
||||
@ -116,8 +118,6 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
|
||||
if(this.usingTicks < delay || power == 0)
|
||||
return power;
|
||||
|
||||
lastOp = worldObj.getTotalWorldTime();
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
@ -131,6 +131,8 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
|
||||
toCharge = Math.min(toCharge, power / 5);
|
||||
battery.chargeBattery(stack, toCharge);
|
||||
power -= toCharge;
|
||||
|
||||
lastOp = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.block.ILaserable;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -23,7 +24,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, ILaserable {
|
||||
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, ILaserable, IFluidStandardReceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000000L;
|
||||
@ -52,6 +53,7 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
this.subscribeToAllAround(tank.getTankType(), this);
|
||||
|
||||
watts = MathHelper.clamp_int(watts, 1, 100);
|
||||
long demand = maxPower * watts / 2000;
|
||||
@ -280,4 +282,9 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
nbt.setBoolean("isOn", isOn);
|
||||
tank.writeToNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -17,7 +15,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoreInjector extends TileEntityMachineBase implements IFluidAcceptor {
|
||||
public class TileEntityCoreInjector extends TileEntityMachineBase implements IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public static final int range = 15;
|
||||
@ -39,6 +37,9 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.subscribeToAllAround(tanks[1].getTankType(), this);
|
||||
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[1].setType(2, 3, slots);
|
||||
@ -170,4 +171,9 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
tanks[1].writeToNBT(nbt, "fuel2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1]};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor{
|
||||
public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor /* TODO: new fluid API */ {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 20000000;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.machine.BlockHadronPower;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
@ -8,7 +9,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHadronPower extends TileEntityLoadedBase implements IEnergyUser {
|
||||
public class TileEntityHadronPower extends TileEntityLoadedBase implements IEnergyUser, INBTPacketReceiver {
|
||||
|
||||
public long power;
|
||||
|
||||
@ -24,9 +25,18 @@ public class TileEntityHadronPower extends TileEntityLoadedBase implements IEner
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
@ -20,6 +20,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -29,7 +30,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidSource {
|
||||
public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidSource, IFluidStandardTransceiver /* TODO: finish fluid API impl */ {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 10000000;
|
||||
@ -478,4 +479,14 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
player.triggerAchievement(MainRegistry.achMeltdown);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -25,7 +26,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
|
||||
public class TileEntityMachineBoiler extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
public class TileEntityMachineBoiler extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -218,6 +219,10 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
@ -396,4 +401,14 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
|
||||
public void clearFluidList(FluidType type) {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -30,7 +31,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyUser {
|
||||
public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyUser, IFluidStandardTransceiver {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -229,6 +230,8 @@ public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implem
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
this.updateConnections();
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
@ -415,4 +418,14 @@ public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implem
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@ -20,9 +21,8 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -309,21 +309,18 @@ public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
this.updateStandardConnections(worldObj, this);
|
||||
this.subscribeToAllAround(tank.getTankType(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -356,4 +353,9 @@ public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,8 +20,10 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@ -31,7 +33,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineChemplant extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor {
|
||||
public class TileEntityMachineChemplant extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -195,14 +197,25 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3, yCoord, zCoord + rot.offsetZ * 3, rot);
|
||||
this.trySubscribe(worldObj, xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite());
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3 + dir.offsetX, yCoord, zCoord + rot.offsetZ * 3 + dir.offsetZ, rot);
|
||||
this.trySubscribe(worldObj, xCoord - rot.offsetX * 2 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 2 + dir.offsetZ, rot.getOpposite());
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX * 3, yCoord, zCoord + rot.offsetZ * 3, rot),
|
||||
new DirPos(xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite()),
|
||||
new DirPos(xCoord + rot.offsetX * 3 + dir.offsetX, yCoord, zCoord + rot.offsetZ * 3 + dir.offsetZ, rot),
|
||||
new DirPos(xCoord - rot.offsetX * 2 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 2 + dir.offsetZ, rot.getOpposite())
|
||||
};
|
||||
}
|
||||
|
||||
private boolean canProcess() {
|
||||
@ -227,10 +240,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
private void setupTanks(ChemRecipe recipe) {
|
||||
if(recipe.inputFluids[0] != null) tanks[0].setTankType(recipe.inputFluids[0].type);
|
||||
if(recipe.inputFluids[1] != null) tanks[1].setTankType(recipe.inputFluids[1].type);
|
||||
if(recipe.outputFluids[0] != null) tanks[2].setTankType(recipe.outputFluids[0].type);
|
||||
if(recipe.outputFluids[1] != null) tanks[3].setTankType(recipe.outputFluids[1].type);
|
||||
if(recipe.inputFluids[0] != null) tanks[0].setTankType(recipe.inputFluids[0].type); else tanks[0].setTankType(Fluids.NONE);
|
||||
if(recipe.inputFluids[1] != null) tanks[1].setTankType(recipe.inputFluids[1].type); else tanks[1].setTankType(Fluids.NONE);
|
||||
if(recipe.outputFluids[0] != null) tanks[2].setTankType(recipe.outputFluids[0].type); else tanks[2].setTankType(Fluids.NONE);
|
||||
if(recipe.outputFluids[1] != null) tanks[3].setTankType(recipe.outputFluids[1].type); else tanks[3].setTankType(Fluids.NONE);
|
||||
}
|
||||
|
||||
private boolean hasRequiredFluids(ChemRecipe recipe) {
|
||||
@ -565,4 +578,14 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[2], tanks[3]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1]};
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
this.subscribeToAllAround(Fluids.WATER, worldObj, xCoord, yCoord, zCoord);
|
||||
this.subscribeToAllAround(Fluids.WATER, this);
|
||||
|
||||
//Water
|
||||
tank.loadTank(0, 3, slots);
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -13,9 +10,11 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -24,7 +23,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor {
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
@ -101,18 +100,34 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
protected DirPos[] getConPos() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
|
||||
if(dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH) {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord + 5, zCoord, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord + 5, zCoord, Library.NEG_X);
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 2, yCoord + 5, zCoord, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord + 5, zCoord, Library.NEG_X)
|
||||
};
|
||||
}
|
||||
|
||||
if(dir == ForgeDirection.EAST || dir == ForgeDirection.WEST) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 5, zCoord + 2, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 5, zCoord - 2, Library.NEG_Z);
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord, yCoord + 5, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord, yCoord + 5, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
return new DirPos[0];
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
@ -360,4 +375,9 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
if(stack != null && i >= 5 && i <= 6 && stack.getItem() instanceof ItemMachineUpgrade)
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.inventory.recipes.PressRecipes;
|
||||
import com.hbm.items.machine.ItemStamp;
|
||||
@ -17,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachinePress extends TileEntity implements ISidedInventory {
|
||||
|
||||
@ -203,16 +205,32 @@ public class TileEntityMachinePress extends TileEntity implements ISidedInventor
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
boolean preheated = false;
|
||||
|
||||
if(power < maxPower / 3 - 5) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) == ModBlocks.press_preheater) {
|
||||
preheated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(preheated)
|
||||
power += 2;
|
||||
|
||||
if(burnTime > 0) {
|
||||
this.burnTime--;
|
||||
this.power++;
|
||||
if(power > maxPower)
|
||||
if(power > maxPower) {
|
||||
power = maxPower;
|
||||
}
|
||||
} else {
|
||||
if(power > 0)
|
||||
if(power > 0) {
|
||||
power--;
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
|
||||
39
src/main/java/com/hbm/util/fauxpointtwelve/DirPos.java
Normal file
39
src/main/java/com/hbm/util/fauxpointtwelve/DirPos.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.hbm.util.fauxpointtwelve;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class DirPos extends BlockPos {
|
||||
|
||||
protected ForgeDirection dir;
|
||||
|
||||
public DirPos(int x, int y, int z, ForgeDirection dir) {
|
||||
super(x, y, z);
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
public DirPos(TileEntity te, ForgeDirection dir) {
|
||||
super(te);
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
public DirPos(double x, double y, double z, ForgeDirection dir) {
|
||||
super(x, y, z);
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DirPos rotate(Rotation rotationIn) {
|
||||
switch(rotationIn) {
|
||||
case NONE:
|
||||
default: return this;
|
||||
case CLOCKWISE_90: return new DirPos(-this.getZ(), this.getY(), this.getX(), this.getDir().getRotation(ForgeDirection.UP));
|
||||
case CLOCKWISE_180: return new DirPos(-this.getX(), this.getY(), -this.getZ(), this.getDir().getOpposite());
|
||||
case COUNTERCLOCKWISE_90: return new DirPos(this.getZ(), this.getY(), -this.getX(), this.getDir().getRotation(ForgeDirection.DOWN));
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection getDir() {
|
||||
return this.dir;
|
||||
}
|
||||
}
|
||||
@ -3497,6 +3497,7 @@ tile.plasma.name=Plasma
|
||||
tile.plasma_heater.name=Plasmaerhitzer
|
||||
tile.pole_satellite_receiver.name=Satellitenschüssel
|
||||
tile.pole_top.name=Antennenspitze
|
||||
tile.press_preheater.name=Presse-Vorheizer
|
||||
tile.pribris.name=RBMK-Schutt
|
||||
tile.pribris_burning.name=Flammender RBMK-Schutt
|
||||
tile.pribris_digamma.name=Geschwärzter RBMK-Schutt
|
||||
|
||||
@ -3871,6 +3871,7 @@ tile.plasma.name=Plasma
|
||||
tile.plasma_heater.name=Plasma Heater
|
||||
tile.pole_satellite_receiver.name=Satellite Dish
|
||||
tile.pole_top.name=Antenna Top
|
||||
tile.press_preheater.name=Burner Press Preheater
|
||||
tile.pribris.name=RBMK Debris
|
||||
tile.pribris_burning.name=Flaming RBMK Debris
|
||||
tile.pribris_digamma.name=Blackened RBMK Debris
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,45 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
18,
|
||||
17,
|
||||
16,
|
||||
15,
|
||||
14,
|
||||
13,
|
||||
12,
|
||||
11,
|
||||
10,
|
||||
9,
|
||||
8,
|
||||
7,
|
||||
6,
|
||||
5,
|
||||
4,
|
||||
3,
|
||||
2,
|
||||
1
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user