mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
a tiny bit of RBMK console work
This commit is contained in:
parent
f89fc3702e
commit
4469d43e0b
@ -53,10 +53,11 @@ public class ItemRBMKTool extends Item {
|
||||
|
||||
int[] pos = ((BlockDummyable)b).findCore(world, x, y, z);
|
||||
|
||||
TileEntityRBMKConsole mirror = (TileEntityRBMKConsole)world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
TileEntityRBMKConsole console = (TileEntityRBMKConsole)world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
int tx = stack.stackTagCompound.getInteger("posX");
|
||||
int ty = stack.stackTagCompound.getInteger("posY");
|
||||
int tz = stack.stackTagCompound.getInteger("posZ");
|
||||
console.setTarget(tx, ty, tz);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@ -42,4 +43,9 @@ public class TileEntityRBMKAbsorber extends TileEntityRBMKBase {
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.ABSORBER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -376,4 +377,10 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ColumnType getConsoleType();
|
||||
|
||||
public NBTTagCompound getNBTForConsole() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@ -42,4 +43,9 @@ public class TileEntityRBMKBlank extends TileEntityRBMKBase {
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.BLANK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -242,4 +243,9 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.BOILER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,17 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityRBMKConsole extends TileEntityMachineBase {
|
||||
|
||||
private int targetX;
|
||||
private int targetY;
|
||||
private int targetZ;
|
||||
|
||||
public RBMKColumn[][] columns = new RBMKColumn[15][15];
|
||||
|
||||
public TileEntityRBMKConsole() {
|
||||
super(0);
|
||||
@ -20,6 +28,32 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase {
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
rescan();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void rescan() {
|
||||
|
||||
for(int i = -7; i <= 7; i++) {
|
||||
for(int j = -7; j <= 7; j++) {
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(targetX + i, targetY, targetZ + j);
|
||||
|
||||
if(te instanceof TileEntityRBMKBase) {
|
||||
|
||||
TileEntityRBMKBase rbmk = (TileEntityRBMKBase)te;
|
||||
|
||||
columns[i + 7][j + 7] = new RBMKColumn(rbmk.getConsoleType(), rbmk.getNBTForConsole());
|
||||
|
||||
} else {
|
||||
columns[i + 7][j + 7] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,4 +66,37 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase {
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
public void setTarget(int x, int y, int z) {
|
||||
this.targetX = x;
|
||||
this.targetY = y;
|
||||
this.targetZ = z;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public static class RBMKColumn {
|
||||
|
||||
public ColumnType type;
|
||||
public NBTTagCompound data;
|
||||
|
||||
public RBMKColumn(ColumnType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public RBMKColumn(ColumnType type, NBTTagCompound data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ColumnType {
|
||||
BLANK,
|
||||
FUEL,
|
||||
CONTROL,
|
||||
CONTROL_AUTO,
|
||||
BOILER,
|
||||
MODERATOR,
|
||||
ABSORBER,
|
||||
REFLECTOR
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -120,4 +121,9 @@ public class TileEntityRBMKControlAuto extends TileEntityRBMKControl implements
|
||||
QUAD_UP,
|
||||
QUAD_DOWN
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.CONTROL_AUTO;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -67,4 +68,9 @@ public class TileEntityRBMKControlManual extends TileEntityRBMKControl implement
|
||||
BLUE,
|
||||
PURPLE
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.CONTROL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@ -41,4 +42,9 @@ public class TileEntityRBMKModerator extends TileEntityRBMKBase {
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.MODERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@ -40,4 +41,9 @@ public class TileEntityRBMKReflector extends TileEntityRBMKBase {
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.REFLECTOR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.items.machine.ItemRBMKRod;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -223,4 +224,9 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.FUEL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,35 +38,6 @@ public class Bunker extends WorldGenerator
|
||||
};
|
||||
}
|
||||
|
||||
public boolean LocationIsValidSpawn(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
Block checkBlock = world.getBlock(x, y - 1, z);
|
||||
Block blockAbove = world.getBlock(x, y , z);
|
||||
Block blockBelow = world.getBlock(x, y - 2, z);
|
||||
|
||||
for (Block i : GetValidSpawnBlocks())
|
||||
{
|
||||
if (blockAbove != Blocks.air)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (checkBlock == i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (checkBlock == Blocks.snow_layer && blockBelow == i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (checkBlock.getMaterial() == Material.plants && blockBelow == i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random rand, int x, int y, int z)
|
||||
{
|
||||
@ -84,10 +55,6 @@ public class Bunker extends WorldGenerator
|
||||
public boolean generate_r0(World world, Random rand, int x, int y, int z)
|
||||
{
|
||||
y += 1;
|
||||
if(!LocationIsValidSpawn(world, x, y, z) || !LocationIsValidSpawn(world, x + 3, y, z) || !LocationIsValidSpawn(world, x + 3, y, z + 5) || !LocationIsValidSpawn(world, x, y, z + 5))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 11; i++)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user