mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
RBMK redstone column that doesn't work (will work eventually)
This commit is contained in:
parent
5bcffadbab
commit
424d6c3486
@ -1098,6 +1098,7 @@ public class ModBlocks {
|
|||||||
public static Block rbmk_storage;
|
public static Block rbmk_storage;
|
||||||
public static Block rbmk_cooler;
|
public static Block rbmk_cooler;
|
||||||
public static Block rbmk_heater;
|
public static Block rbmk_heater;
|
||||||
|
public static Block rbmk_redstone;
|
||||||
public static Block rbmk_console;
|
public static Block rbmk_console;
|
||||||
public static Block rbmk_crane_console;
|
public static Block rbmk_crane_console;
|
||||||
public static Block rbmk_loader;
|
public static Block rbmk_loader;
|
||||||
@ -2146,6 +2147,7 @@ public class ModBlocks {
|
|||||||
rbmk_storage = new RBMKStorage().setBlockName("rbmk_storage").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_storage");
|
rbmk_storage = new RBMKStorage().setBlockName("rbmk_storage").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_storage");
|
||||||
rbmk_cooler = new RBMKCooler().setBlockName("rbmk_cooler").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_cooler");
|
rbmk_cooler = new RBMKCooler().setBlockName("rbmk_cooler").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_cooler");
|
||||||
rbmk_heater = new RBMKHeater().setBlockName("rbmk_heater").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_heater");
|
rbmk_heater = new RBMKHeater().setBlockName("rbmk_heater").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_heater");
|
||||||
|
rbmk_redstone = new RBMKRedstone().setBlockName("rbmk_redstone").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_redstone");
|
||||||
rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console");
|
rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console");
|
||||||
rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console");
|
rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console");
|
||||||
rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader");
|
rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader");
|
||||||
@ -3143,6 +3145,7 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(rbmk_storage, rbmk_storage.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_storage, rbmk_storage.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rbmk_cooler, rbmk_cooler.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_cooler, rbmk_cooler.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rbmk_heater, rbmk_heater.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_heater, rbmk_heater.getUnlocalizedName());
|
||||||
|
GameRegistry.registerBlock(rbmk_redstone, rbmk_redstone.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(rbmk_loader, rbmk_loader.getUnlocalizedName());
|
GameRegistry.registerBlock(rbmk_loader, rbmk_loader.getUnlocalizedName());
|
||||||
|
|||||||
33
src/main/java/com/hbm/blocks/machine/rbmk/RBMKRedstone.java
Normal file
33
src/main/java/com/hbm/blocks/machine/rbmk/RBMKRedstone.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.hbm.blocks.machine.rbmk;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRedstone;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class RBMKRedstone extends RBMKBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
|
if(meta >= this.offset)
|
||||||
|
return new TileEntityRBMKRedstone();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
return openInv(world, x, y, z, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
|
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderType(){
|
||||||
|
return this.renderIDPassive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -306,6 +306,22 @@ public class GUIRBMKConsole extends GuiScreen {
|
|||||||
case OUTGASSER: break;
|
case OUTGASSER: break;
|
||||||
case BREEDER: break;
|
case BREEDER: break;
|
||||||
|
|
||||||
|
case REDSTONE:
|
||||||
|
|
||||||
|
switch(col.data.getInteger("mode")) {
|
||||||
|
case 2: // slow flux
|
||||||
|
drawTexturedModalRect(guiLeft + x + 3, guiTop + y + size - 2, 142, 183 - 8, 3, 8);
|
||||||
|
break;
|
||||||
|
case 3: // fast flux
|
||||||
|
drawTexturedModalRect(guiLeft + x + 3, guiTop + y + size - 2, 142, 193 - 8, 3, 8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(col.data.getBoolean("active")) { //set active texture afterwards or it will override
|
||||||
|
drawTexturedModalRect(guiLeft + x + 4, guiTop + y + size - 2, 145, 204, 2, 8);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CONTROL:
|
case CONTROL:
|
||||||
int color = col.data.getShort("color");
|
int color = col.data.getShort("color");
|
||||||
if(color > -1)
|
if(color > -1)
|
||||||
|
|||||||
168
src/main/java/com/hbm/inventory/gui/GUIRBMKRedstone.java
Normal file
168
src/main/java/com/hbm/inventory/gui/GUIRBMKRedstone.java
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.inventory.container.ContainerRBMKGeneric;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.packet.NBTControlPacket;
|
||||||
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRedstone;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIRBMKRedstone extends GuiInfoContainer {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_redstone.png");
|
||||||
|
private TileEntityRBMKRedstone rod;
|
||||||
|
|
||||||
|
private GuiTextField[] fields;
|
||||||
|
|
||||||
|
public GUIRBMKRedstone(InventoryPlayer invPlayer, TileEntityRBMKRedstone tile) {
|
||||||
|
super(new ContainerRBMKGeneric(invPlayer));
|
||||||
|
rod = tile;
|
||||||
|
|
||||||
|
fields = new GuiTextField[2];
|
||||||
|
|
||||||
|
this.xSize = 176;
|
||||||
|
this.ySize = 186;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
this.fields[0] = new GuiTextField(this.fontRendererObj, guiLeft + 56, guiTop + 25, 94, 18);
|
||||||
|
this.fields[1] = new GuiTextField(this.fontRendererObj, guiLeft + 29, guiTop + 60, 28, 10);
|
||||||
|
for(int i = 0; i < 2; i++) {
|
||||||
|
this.fields[i].setTextColor(0x00ff00);
|
||||||
|
this.fields[i].setDisabledTextColour(0x00ff00);
|
||||||
|
this.fields[i].setEnableBackgroundDrawing(false);
|
||||||
|
this.fields[i].setMaxStringLength(4);
|
||||||
|
this.fields[i].setText(String.valueOf(rod.threshold));
|
||||||
|
if(i == 0) {
|
||||||
|
this.fields[i].setText(rod.channel == null ? "" : rod.channel);
|
||||||
|
this.fields[i].setMaxStringLength(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
|
super.drawScreen(mouseX, mouseY, f);
|
||||||
|
String value = "";
|
||||||
|
switch(rod.mode) {
|
||||||
|
case 1:
|
||||||
|
value = "°C";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
value = "/cm²/s";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 29, guiTop + 49, 28, 10, mouseX, mouseY, "Value: " + (rod.value) + value);
|
||||||
|
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 69, guiTop + 56, 25, 25, mouseX, mouseY, "Monitor slow flux");
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 96, guiTop + 56, 25, 25, mouseX, mouseY, "Monitor fast flux");
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 123, guiTop + 56, 25, 25, mouseX, mouseY, "Monitor heat");
|
||||||
|
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 29, guiTop + 60, 28, 10, mouseX, mouseY, "Redstone Threshold");
|
||||||
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 29, guiTop + 71, 28, 10, mouseX, mouseY, "Save threshold");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int x, int y, int i) {
|
||||||
|
super.mouseClicked(x, y, i);
|
||||||
|
|
||||||
|
for(int j = 0; j < 2; j++) {
|
||||||
|
this.fields[j].mouseClicked(x, y, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(guiLeft + 29 <= x && guiLeft + 29 + 28 > x && guiTop + 71 < y && guiTop + 71 + 10 >= y) {
|
||||||
|
|
||||||
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
if(NumberUtils.isNumber(fields[1].getText())) {
|
||||||
|
data.setString("Ch_set", fields[0].getText() + "");
|
||||||
|
data.setInteger("Threshold", Integer.parseInt(fields[1].getText()));
|
||||||
|
} else {
|
||||||
|
fields[0].setText("");
|
||||||
|
fields[1].setText("0");
|
||||||
|
}
|
||||||
|
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, rod.xCoord, rod.yCoord, rod.zCoord));
|
||||||
|
}
|
||||||
|
for(int k = 0; k < 3; k++) { // button for each mode
|
||||||
|
if(guiLeft + 68 + k * 27 <= x && guiLeft + 68 + (k + 1) * 27 > x && guiTop + 55 < y && guiTop + 55 + 27 >= y) {
|
||||||
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
if(k == 0)
|
||||||
|
data.setInteger("Mode", 2);
|
||||||
|
if(k == 1)
|
||||||
|
data.setInteger("Mode", 3);
|
||||||
|
if(k == 2)
|
||||||
|
data.setInteger("Mode", 1);
|
||||||
|
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, rod.xCoord, rod.yCoord, rod.zCoord));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
|
String name = this.rod.hasCustomInventoryName() ? this.rod.getInventoryName() : I18n.format(this.rod.getInventoryName());
|
||||||
|
|
||||||
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||||
|
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
|
switch(rod.mode) {
|
||||||
|
case 1:
|
||||||
|
drawTexturedModalRect(guiLeft + 77, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 104, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 131, guiTop + 46, 180, 3, 9, 9);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
drawTexturedModalRect(guiLeft + 77, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 104, guiTop + 46, 180, 3, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 131, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
drawTexturedModalRect(guiLeft + 77, guiTop + 46, 180, 3, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 104, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
drawTexturedModalRect(guiLeft + 131, guiTop + 46, 180, 13, 9, 9);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.fields[0].drawTextBox();
|
||||||
|
this.fields[1].drawTextBox();
|
||||||
|
this.fontRendererObj.drawString(rod.trunc_v, 30, 50, 0xFF7F7F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char c, int i) {
|
||||||
|
|
||||||
|
for(int j = 0; j < 2; j++) {
|
||||||
|
if(this.fields[j].textboxKeyTyped(c, i))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.keyTyped(c, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
Keyboard.enableRepeatEvents(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -342,6 +342,7 @@ public class TileMappings {
|
|||||||
put(TileEntityRBMKAbsorber.class, "tileentity_rbmk_absorber");
|
put(TileEntityRBMKAbsorber.class, "tileentity_rbmk_absorber");
|
||||||
put(TileEntityRBMKModerator.class, "tileentity_rbmk_moderator");
|
put(TileEntityRBMKModerator.class, "tileentity_rbmk_moderator");
|
||||||
put(TileEntityRBMKOutgasser.class, "tileentity_rbmk_outgasser");
|
put(TileEntityRBMKOutgasser.class, "tileentity_rbmk_outgasser");
|
||||||
|
put(TileEntityRBMKRedstone.class, "tileentity_rbmk_redstone");
|
||||||
put(TileEntityRBMKCooler.class, "tileentity_rbmk_cooler");
|
put(TileEntityRBMKCooler.class, "tileentity_rbmk_cooler");
|
||||||
put(TileEntityRBMKHeater.class, "tileentity_rbmk_heater");
|
put(TileEntityRBMKHeater.class, "tileentity_rbmk_heater");
|
||||||
put(TileEntityRBMKStorage.class, "tileentity_rbmk_storage");
|
put(TileEntityRBMKStorage.class, "tileentity_rbmk_storage");
|
||||||
|
|||||||
@ -384,6 +384,11 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
|||||||
stats.add(EnumChatFormatting.WHITE + I18nUtil.resolveKey("rbmk.boiler.steam", this.data.getInteger("steam"), this.data.getInteger("maxSteam")));
|
stats.add(EnumChatFormatting.WHITE + I18nUtil.resolveKey("rbmk.boiler.steam", this.data.getInteger("steam"), this.data.getInteger("maxSteam")));
|
||||||
stats.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("rbmk.boiler.type", I18nUtil.resolveKey(Fluids.fromID(this.data.getShort("type")).getUnlocalizedName())));
|
stats.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("rbmk.boiler.type", I18nUtil.resolveKey(Fluids.fromID(this.data.getShort("type")).getUnlocalizedName())));
|
||||||
break;
|
break;
|
||||||
|
case REDSTONE:
|
||||||
|
stats.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey("rbmk.redstone.active", Boolean.toString(data.getBoolean("active"))));
|
||||||
|
stats.add(EnumChatFormatting.WHITE + I18nUtil.resolveKey("rbmk.redstone.value", this.data.getString("value"), this.data.getInteger("threshold")));
|
||||||
|
stats.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("rbmk.redstone.channel", this.data.getString("channel")));
|
||||||
|
break;
|
||||||
case CONTROL:
|
case CONTROL:
|
||||||
|
|
||||||
if(this.data.hasKey("color")) {
|
if(this.data.hasKey("color")) {
|
||||||
@ -426,9 +431,10 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
|||||||
BREEDER(100),
|
BREEDER(100),
|
||||||
STORAGE(110),
|
STORAGE(110),
|
||||||
COOLER(120),
|
COOLER(120),
|
||||||
HEATEX(130);
|
HEATEX(130),
|
||||||
|
REDSTONE(140);
|
||||||
|
|
||||||
public int offset;
|
public int offset;
|
||||||
|
|
||||||
private ColumnType(int offset) {
|
private ColumnType(int offset) {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
|||||||
@ -0,0 +1,182 @@
|
|||||||
|
package com.hbm.tileentity.machine.rbmk;
|
||||||
|
|
||||||
|
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||||
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
|
import com.hbm.inventory.container.ContainerRBMKGeneric;
|
||||||
|
import com.hbm.inventory.gui.GUIRBMKRedstone;
|
||||||
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||||
|
import com.hbm.tileentity.network.RTTYSystem;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import li.cil.oc.api.network.SimpleComponent;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityRBMKRedstone extends TileEntityRBMKSlottedBase implements IControlReceiver, SimpleComponent {
|
||||||
|
|
||||||
|
|
||||||
|
public int mode = 1;
|
||||||
|
public String channel = "";
|
||||||
|
public int threshold = 0;
|
||||||
|
public boolean active = false;
|
||||||
|
public double sflux = 0.0;
|
||||||
|
public double fflux = 0.0;
|
||||||
|
public double value = 0.0;
|
||||||
|
public String trunc_v = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "container.rbmkRedstone";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileEntityRBMKRedstone() {
|
||||||
|
super(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
if (!worldObj.isRemote) {
|
||||||
|
|
||||||
|
switch(mode) {
|
||||||
|
// mode = 1: Heat
|
||||||
|
// mode = 2: Slow Flux
|
||||||
|
// mode = 3: Fast Flux
|
||||||
|
case (1):
|
||||||
|
value = heat;
|
||||||
|
active = value > threshold;
|
||||||
|
break;
|
||||||
|
case (2):
|
||||||
|
value = sflux;
|
||||||
|
active = value > threshold;
|
||||||
|
break;
|
||||||
|
case (3):
|
||||||
|
value = fflux;
|
||||||
|
active = value > threshold;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!channel.isEmpty()) {
|
||||||
|
if(active) {
|
||||||
|
RTTYSystem.broadcast(worldObj, channel, 15);
|
||||||
|
} else {
|
||||||
|
RTTYSystem.broadcast(worldObj, channel, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.updateEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processFlux(Double flux, IRBMKFluxReceiver.NType stream) {
|
||||||
|
if(stream == IRBMKFluxReceiver.NType.SLOW) {
|
||||||
|
sflux = flux;
|
||||||
|
} else if (stream == IRBMKFluxReceiver.NType.FAST) {
|
||||||
|
fflux = flux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(EntityPlayer player) {return true;}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receiveControl(NBTTagCompound data) {
|
||||||
|
|
||||||
|
if(data.hasKey("Ch_set")) {
|
||||||
|
channel = data.getString("Ch_set");
|
||||||
|
threshold = data.getInteger("Threshold");
|
||||||
|
} else if (data.hasKey("Mode")) {
|
||||||
|
int newMode = data.getInteger("Mode") % 4;
|
||||||
|
if(newMode <= 0)
|
||||||
|
newMode = 1;
|
||||||
|
mode = newMode;
|
||||||
|
}
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
|
mode = nbt.getInteger("mode");
|
||||||
|
channel = nbt.getString("channel");
|
||||||
|
threshold = nbt.getInteger("threshold");
|
||||||
|
active = nbt.getBoolean("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
|
nbt.setInteger("mode", mode);
|
||||||
|
nbt.setString("channel", channel);
|
||||||
|
nbt.setInteger("threshold", threshold);
|
||||||
|
nbt.setBoolean("active", active);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getDiagData(NBTTagCompound nbt) {
|
||||||
|
super.getDiagData(nbt);
|
||||||
|
nbt.setString("mode", String.valueOf(mode));
|
||||||
|
nbt.setString("channel", channel);
|
||||||
|
nbt.setString("threshold", String.valueOf(threshold));
|
||||||
|
nbt.setString("active", String.valueOf(active));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getNBTForConsole() {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
|
||||||
|
if(value >= 100) {
|
||||||
|
value = (int) value;
|
||||||
|
} else {
|
||||||
|
value = ((int) (value * 10)) / 10F;
|
||||||
|
}
|
||||||
|
data.setInteger("mode", mode);
|
||||||
|
data.setString("value", trunc_v);
|
||||||
|
data.setInteger("threshold", threshold);
|
||||||
|
data.setBoolean("active", active);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMelt(int reduce) {
|
||||||
|
|
||||||
|
int count = 1 + worldObj.rand.nextInt(2);
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
|
spawnDebris(DebrisType.BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onMelt(reduce);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ColumnType getConsoleType() {
|
||||||
|
return ColumnType.REDSTONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public double getMaxRenderDistanceSquared() {
|
||||||
|
return 65536.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComponentName() {
|
||||||
|
return "rbmk_redstone_rod";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new ContainerRBMKGeneric(player.inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new GUIRBMKRedstone(player.inventory, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -192,6 +192,12 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(te instanceof TileEntityRBMKRedstone) {
|
||||||
|
TileEntityRBMKRedstone rod = (TileEntityRBMKRedstone)te;
|
||||||
|
rod.processFlux(flux, stream);
|
||||||
|
return flux;
|
||||||
|
}
|
||||||
|
|
||||||
if(te instanceof IRBMKFluxReceiver) {
|
if(te instanceof IRBMKFluxReceiver) {
|
||||||
IRBMKFluxReceiver rod = (IRBMKFluxReceiver)te;
|
IRBMKFluxReceiver rod = (IRBMKFluxReceiver)te;
|
||||||
rod.receiveFlux(stream, flux);
|
rod.receiveFlux(stream, flux);
|
||||||
|
|||||||
@ -722,6 +722,7 @@ container.rbmkHeater=RBMK Fluid Heater
|
|||||||
container.rbmkOutgasser=RBMK Irradiation Channel
|
container.rbmkOutgasser=RBMK Irradiation Channel
|
||||||
container.rbmkReaSim=RBMK Fuel Rod (ReaSim)
|
container.rbmkReaSim=RBMK Fuel Rod (ReaSim)
|
||||||
container.rbmkRod=RBMK Fuel Rod
|
container.rbmkRod=RBMK Fuel Rod
|
||||||
|
container.rbmkRedstone=RBMK Redstone Column
|
||||||
container.rbmkStorage=RBMK Storage Column
|
container.rbmkStorage=RBMK Storage Column
|
||||||
container.reactorBreeding=Breeding Reactor
|
container.reactorBreeding=Breeding Reactor
|
||||||
container.reactorControl=Reactor Remote Control Block
|
container.reactorControl=Reactor Remote Control Block
|
||||||
@ -4242,6 +4243,9 @@ rbmk.heat=Column temperature: %s
|
|||||||
rbmk.boiler.water=Feedwater: %s / %s
|
rbmk.boiler.water=Feedwater: %s / %s
|
||||||
rbmk.boiler.steam=Steam: %s / %s
|
rbmk.boiler.steam=Steam: %s / %s
|
||||||
rbmk.boiler.type=Compressor: %s
|
rbmk.boiler.type=Compressor: %s
|
||||||
|
rbmk.redstone.active=Active: %s
|
||||||
|
rbmk.redstone.value=Value: %s / %s
|
||||||
|
rbmk.redstone.channel=Channel: %s
|
||||||
rbmk.console.assign=Assign selected columns to screen #%s
|
rbmk.console.assign=Assign selected columns to screen #%s
|
||||||
rbmk.console.none=Off
|
rbmk.console.none=Off
|
||||||
rbmk.console.col_temp=Monitor average column temperature
|
rbmk.console.col_temp=Monitor average column temperature
|
||||||
@ -5110,6 +5114,7 @@ tile.rbmk_control_mod.name=RBMK Moderated Control Rods
|
|||||||
tile.rbmk_crane_console.name=RBMK Crane Console
|
tile.rbmk_crane_console.name=RBMK Crane Console
|
||||||
tile.rbmk_heater.name=RBMK Fluid Heater
|
tile.rbmk_heater.name=RBMK Fluid Heater
|
||||||
tile.rbmk_heatex.name=RBMK Heat Exchanger
|
tile.rbmk_heatex.name=RBMK Heat Exchanger
|
||||||
|
tile.rbmk_redstone.name=RBMK Redstone Column
|
||||||
tile.rbmk_loader.name=RBMK Steam Connector
|
tile.rbmk_loader.name=RBMK Steam Connector
|
||||||
tile.rbmk_moderator.name=RBMK Graphite Moderator
|
tile.rbmk_moderator.name=RBMK Graphite Moderator
|
||||||
tile.rbmk_outgasser.name=RBMK Irradiation Channel
|
tile.rbmk_outgasser.name=RBMK Irradiation Channel
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Loading…
x
Reference in New Issue
Block a user