This commit is contained in:
Bob 2023-12-05 22:13:12 +01:00
parent 976e0dba37
commit b69351f857
4 changed files with 90 additions and 11 deletions

View File

@ -1,12 +1,15 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineExposureChamber;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineExposureChamber extends BlockDummyable {
@ -17,6 +20,7 @@ public class MachineExposureChamber extends BlockDummyable {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineExposureChamber();
if(meta >= 6) return new TileEntityProxyCombo().inventory().power();
return null;
}
@ -29,6 +33,46 @@ public class MachineExposureChamber extends BlockDummyable {
public int getOffset() {
return 2;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x += dir.offsetX * o;
z += dir.offsetZ * o;
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, 0, 0, 0, -3, 8}, this, dir);
MultiblockHandlerXR.fillSpace(world, x, y + 2, z, new int[] {0, 0, 1, -1, -3, 6}, this, dir);
MultiblockHandlerXR.fillSpace(world, x, y + 2, z, new int[] {0, 0, -1, 1, -3, 6}, this, dir);
MultiblockHandlerXR.fillSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, 1, -1, 0, 1}, this, dir);
MultiblockHandlerXR.fillSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, -1, 1, 0, 1}, this, dir);
this.makeExtra(world, x + rot.offsetX * 7 + dir.offsetX, y, z + rot.offsetZ * 7 + dir.offsetZ);
this.makeExtra(world, x + rot.offsetX * 7 - dir.offsetX, y, z + rot.offsetZ * 7 - dir.offsetZ);
this.makeExtra(world, x + rot.offsetX * 8 + dir.offsetX, y, z + rot.offsetZ * 8 + dir.offsetZ);
this.makeExtra(world, x + rot.offsetX * 8 - dir.offsetX, y, z + rot.offsetZ * 8 - dir.offsetZ);
this.makeExtra(world, x + rot.offsetX * 8, y, z + rot.offsetZ * 8);
}
@Override
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
x += dir.offsetX * o;
z += dir.offsetZ * o;
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, 0, 0, 0, -3, 8}, x, y, z, dir)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {0, 0, 1, -1, -3, 6}, x, y, z, dir)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {0, 0, -1, 1, -3, 6}, x, y, z, dir)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, 1, -1, 0, 1}, x, y, z, dir)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, -1, 1, 0, 1}, x, y, z, dir)) return false;
return true;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {

View File

@ -152,8 +152,8 @@ public class RodRecipes {
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.HEA242), new Object[] { "F", "I", "F", 'F', AM242.billet(), 'I', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.HES326), new Object[] { "F", "I", "F", 'F', SA326.billet(), 'I', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.HES327), new Object[] { "F", "I", "F", 'F', SA327.billet(), 'I', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.BFB_AM_MIX), new Object[] { "F", "I", "B", 'F', ModItems.billet_am_mix, 'I', ModItems.plate_polymer, 'B', BI.billet() });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.BFB_PU241), new Object[] { "F", "I", "B", 'F', PU241.billet(), 'I', ModItems.plate_polymer, 'B', BI.billet() });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.BFB_AM_MIX), new Object[] { "NFN", "NIN", "NBN", 'F', ModItems.billet_am_mix, 'I', ModItems.plate_polymer, 'B', BI.billet(), 'N', ModItems.nugget_plutonium_fuel });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.pwr_fuel, EnumPWRFuel.BFB_PU241), new Object[] { "NFN", "NIN", "NBN", 'F', PU241.billet(), 'I', ModItems.plate_polymer, 'B', BI.billet(), 'N', ModItems.nugget_uranium_fuel });
}
public static void registerInit() {

View File

@ -256,13 +256,13 @@ public class CentrifugeRecipes extends SerializableRecipe {
new ItemStack(ModItems.nugget_euphemium, 1),
new ItemStack(ModItems.nuclear_waste_tiny, 6) });
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.pwr_fuel_depleted, EnumPWRFuel.BFB_AM_MIX)), new ItemStack[] {
new ItemStack(ModItems.nugget_am_mix, 4),
new ItemStack(ModItems.nugget_pu_mix, 1),
new ItemStack(ModItems.nugget_am_mix, 9),
new ItemStack(ModItems.nugget_pu_mix, 2),
new ItemStack(ModItems.nugget_bismuth, 6),
new ItemStack(ModItems.nuclear_waste_tiny, 1) });
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.pwr_fuel_depleted, EnumPWRFuel.BFB_PU241)), new ItemStack[] {
new ItemStack(ModItems.nugget_pu241, 4),
new ItemStack(ModItems.nugget_pu_mix, 1),
new ItemStack(ModItems.nugget_pu241, 9),
new ItemStack(ModItems.nugget_pu_mix, 2),
new ItemStack(ModItems.nugget_bismuth, 6),
new ItemStack(ModItems.nuclear_waste_tiny, 1) });

View File

@ -9,18 +9,22 @@ import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineExposureChamber extends TileEntityMachineBase implements IGUIProvider {
public class TileEntityMachineExposureChamber extends TileEntityMachineBase implements IGUIProvider, IEnergyUser {
public long power;
public static final long maxPower = 1_000_000;
@ -62,6 +66,10 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
this.isOn = false;
this.power = Library.chargeTEFromItems(slots, 5, power, maxPower);
if(worldObj.getTotalWorldTime() % 20 == 0) {
for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
UpgradeManager.eval(slots, 6, 7);
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
@ -152,6 +160,18 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
}
}
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
return new DirPos[] {
new DirPos(xCoord + rot.offsetX * 7 + dir.offsetX * 2, yCoord, zCoord + rot.offsetZ * 7 + dir.offsetZ * 2, dir),
new DirPos(xCoord + rot.offsetX * 7 - dir.offsetX * 2, yCoord, zCoord + rot.offsetZ * 7 - dir.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord + rot.offsetX * 8 + dir.offsetX * 2, yCoord, zCoord + rot.offsetZ * 8 + dir.offsetZ * 2, dir),
new DirPos(xCoord + rot.offsetX * 8 - dir.offsetX * 2, yCoord, zCoord + rot.offsetZ * 8 - dir.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord + rot.offsetX * 9, yCoord, zCoord + rot.offsetZ * 9, rot)
};
}
public ExposureChamberRecipe getRecipe(ItemStack particle, ItemStack ingredient) {
return ExposureChamberRecipes.getRecipe(particle, ingredient);
}
@ -176,6 +196,21 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
this.savedParticles = buf.readByte();
}
@Override
public long getPower() {
return power;
}
@Override
public void setPower(long power) {
this.power = power;
}
@Override
public long getMaxPower() {
return maxPower;
}
AxisAlignedBB bb = null;
@Override
@ -183,12 +218,12 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 2,
xCoord - 8,
yCoord,
zCoord - 2,
xCoord + 3,
zCoord - 8,
xCoord + 9,
yCoord + 5,
zCoord + 3
zCoord + 9
);
}