mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
finished PWR ports, recipes
This commit is contained in:
parent
35b18dda34
commit
d3b559bd61
@ -17,8 +17,11 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@ -94,7 +97,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
public static class TileEntityBlockPWR extends TileEntity implements IFluidConnector {
|
||||
public static class TileEntityBlockPWR extends TileEntity implements IFluidConnector, ISidedInventory {
|
||||
|
||||
public Block block;
|
||||
public int coreX;
|
||||
@ -108,18 +111,14 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0 && block != null) {
|
||||
|
||||
if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) {
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ);
|
||||
|
||||
if(tile instanceof TileEntityPWRController) {
|
||||
TileEntityPWRController controller = (TileEntityPWRController) tile;
|
||||
if(!controller.assembled) {
|
||||
this.getBlockType().breakBlock(worldObj, xCoord, yCoord, zCoord, this.getBlockType(), this.getBlockMetadata());
|
||||
}
|
||||
} else {
|
||||
TileEntityPWRController controller = getCore();
|
||||
|
||||
if(controller != null) {
|
||||
if(!controller.assembled) {
|
||||
this.getBlockType().breakBlock(worldObj, xCoord, yCoord, zCoord, this.getBlockType(), this.getBlockMetadata());
|
||||
}
|
||||
} else if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) {
|
||||
this.getBlockType().breakBlock(worldObj, xCoord, yCoord, zCoord, this.getBlockType(), this.getBlockMetadata());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,21 +156,33 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntityPWRController cachedCore;
|
||||
|
||||
protected TileEntityPWRController getCore() {
|
||||
|
||||
if(cachedCore != null && !cachedCore.isInvalid()) return cachedCore;
|
||||
|
||||
if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) {
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ);
|
||||
if(tile instanceof TileEntityPWRController) {
|
||||
TileEntityPWRController controller = (TileEntityPWRController) tile;
|
||||
cachedCore = controller;
|
||||
return controller;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferFluid(FluidType type, int pressure, long fluid) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return fluid;
|
||||
if(block == null) return fluid;
|
||||
|
||||
if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) {
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ);
|
||||
if(tile instanceof TileEntityPWRController) {
|
||||
TileEntityPWRController controller = (TileEntityPWRController) tile;
|
||||
return controller.transferFluid(type, pressure, fluid);
|
||||
}
|
||||
}
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.transferFluid(type, pressure, fluid);
|
||||
|
||||
return fluid;
|
||||
}
|
||||
@ -181,15 +192,8 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return 0;
|
||||
if(block == null) return 0;
|
||||
|
||||
if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) {
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ);
|
||||
if(tile instanceof TileEntityPWRController) {
|
||||
TileEntityPWRController controller = (TileEntityPWRController) tile;
|
||||
return controller.getDemand(type, pressure);
|
||||
}
|
||||
}
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getDemand(type, pressure);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -198,5 +202,119 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
|
||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||
return this.getBlockMetadata() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return 0;
|
||||
if(block == null) return 0;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getSizeInventory();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return null;
|
||||
if(block == null) return null;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getStackInSlot(slot);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return null;
|
||||
if(block == null) return null;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.decrStackSize(slot, amount);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return null;
|
||||
if(block == null) return null;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getStackInSlotOnClosing(slot);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return;
|
||||
if(block == null) return;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) controller.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return 0;
|
||||
if(block == null) return 0;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getInventoryStackLimit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer player) { return false; }
|
||||
@Override public void openInventory() { }
|
||||
@Override public void closeInventory() { }
|
||||
@Override public String getInventoryName() { return ""; }
|
||||
@Override public boolean hasCustomInventoryName() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return false;
|
||||
if(block == null) return false;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.isItemValidForSlot(slot, stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return new int[0];
|
||||
if(block == null) return new int[0];
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.getAccessibleSlotsFromSide(side);
|
||||
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return false;
|
||||
if(block == null) return false;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.canInsertItem(slot, stack, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
|
||||
if(this.getBlockMetadata() != 1) return false;
|
||||
if(block == null) return false;
|
||||
TileEntityPWRController controller = this.getCore();
|
||||
if(controller != null) return controller.canExtractItem(slot, stack, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,6 +874,16 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModBlocks.rbmk_steam_outlet, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.ingot(), 'C', CU.plate(), 'B', ModItems.tank_steel });
|
||||
//addRecipeAuto(new ItemStack(ModBlocks.rbmk_heatex, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.ingot(), 'C', CU.plate(), 'B', ModItems.pipes_steel });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_fuel, 4), new Object[] { "LZL", "LZL", "LZL", 'L', PB.plate528(), 'Z', ZR.plateCast() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_control, 4), new Object[] { "SBS", "MBM", "SBS", 'S', STEEL.plate528(), 'B', B.ingot(), 'M', ModItems.motor });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_channel, 4), new Object[] { "CPC", "BPB", "CPC", 'C', CU.ingot(), 'P', ModBlocks.deco_pipe_quad, 'B', ANY_PLASTIC.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_heatex, 4), new Object[] { "CSC", "SMS", "CSC", 'C', CU.plateCast(), 'S', STEEL.plate528(), 'M', ModItems.motor });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_reflector, 4), new Object[] { "RLR", "LSL", "RLR", 'R', OreDictManager.getReflector(), 'L', PB.plate528(), 'S', STEEL.plateCast() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_casing, 4), new Object[] { "LCL", "CSC", "LCL", 'L', PB.plate528(), 'C', ANY_CONCRETE.any(), 'S', STEEL.plateCast() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_controller, 1), new Object[] { "CPC", "PSP", "CPC", 'C', ModBlocks.pwr_casing, 'P', ANY_PLASTIC.ingot(), 'S', ModItems.circuit_gold });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_port, 1), new Object[] { "S", "C", "S", 'S', STEEL.plate(), 'C', ModBlocks.pwr_casing });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.pwr_neutron_source, 1), new Object[] { "LRL", "ZRZ", "LRL", 'L', PB.plate528(), 'R', ModItems.billet_ra226be, 'Z', ZR.plateCast() });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.deco_rbmk, 8), new Object[] { "R", 'R', ModBlocks.rbmk_blank });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.deco_rbmk_smooth, 1), new Object[] { "R", 'R', ModBlocks.deco_rbmk });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.rbmk_blank, 1), new Object[] { "RRR", "R R", "RRR", 'R', ModBlocks.deco_rbmk });
|
||||
|
||||
@ -96,7 +96,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -122,17 +122,17 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
return this.isItemValidForSlot(slot, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] { };
|
||||
}
|
||||
|
||||
|
||||
@ -350,6 +350,22 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
||||
public double getXOverE(double x, double d) {
|
||||
return 1 - Math.pow(Math.E, -x / d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if(slot == 0) return stack.getItem() == ModItems.pwr_fuel;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] {0, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user