mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
automatic RBMK control rod GUI base
This commit is contained in:
parent
c0887a5d32
commit
6235e886de
@ -856,7 +856,8 @@ public class ModBlocks {
|
||||
public static final int guiID_rbmk_rod = 113;
|
||||
public static final int guiID_rbmk_boiler = 114;
|
||||
public static final int guiID_rbmk_control = 115;
|
||||
public static final int guiID_rbmk_console = 116;
|
||||
public static final int guiID_rbmk_control_auto = 116;
|
||||
public static final int guiID_rbmk_console = 17;
|
||||
public static Block pribris;
|
||||
public static Block pribris_burning;
|
||||
|
||||
|
||||
@ -2,11 +2,15 @@ package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class RBMKBase extends BlockDummyable {
|
||||
@ -43,6 +47,29 @@ public abstract class RBMKBase extends BlockDummyable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
|
||||
float height = 0.0F;
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos != null) {
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(te instanceof TileEntityRBMKBase) {
|
||||
|
||||
TileEntityRBMKBase rbmk = (TileEntityRBMKBase) te;
|
||||
|
||||
if(rbmk.hasLid()) {
|
||||
height += 0.25F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY + height, z + this.maxZ);
|
||||
}
|
||||
|
||||
public static int renderIDRods = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderIDPassive = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderIDControl = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControl;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RBMKControl extends RBMKBase {
|
||||
@ -13,7 +14,7 @@ public class RBMKControl extends RBMKBase {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= this.offset)
|
||||
return new TileEntityRBMKControl();
|
||||
return new TileEntityRBMKControlManual();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -21,6 +22,11 @@ public class RBMKControl extends RBMKBase {
|
||||
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, ModBlocks.guiID_rbmk_control);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControl;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlAuto;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RBMKControlAuto extends RBMKBase {
|
||||
@ -11,10 +14,20 @@ public class RBMKControlAuto extends RBMKBase {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= this.offset)
|
||||
return new TileEntityRBMKControl();
|
||||
return new TileEntityRBMKControlAuto();
|
||||
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, ModBlocks.guiID_rbmk_control_auto);
|
||||
}
|
||||
|
||||
@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.renderIDControl;
|
||||
|
||||
@ -801,8 +801,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_rbmk_control: {
|
||||
if(entity instanceof TileEntityRBMKControl) {
|
||||
return new ContainerRBMKControl(player.inventory, (TileEntityRBMKControl) entity);
|
||||
if(entity instanceof TileEntityRBMKControlManual) {
|
||||
return new ContainerRBMKControl(player.inventory, (TileEntityRBMKControlManual) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_rbmk_control_auto: {
|
||||
if(entity instanceof TileEntityRBMKControlAuto) {
|
||||
return new ContainerRBMKControlAuto(player.inventory, (TileEntityRBMKControlAuto) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1594,8 +1601,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_rbmk_control: {
|
||||
if(entity instanceof TileEntityRBMKControl) {
|
||||
return new GUIRBMKControl(player.inventory, (TileEntityRBMKControl) entity);
|
||||
if(entity instanceof TileEntityRBMKControlManual) {
|
||||
return new GUIRBMKControl(player.inventory, (TileEntityRBMKControlManual) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_rbmk_control_auto: {
|
||||
if(entity instanceof TileEntityRBMKControlAuto) {
|
||||
return new GUIRBMKControlAuto(player.inventory, (TileEntityRBMKControlAuto) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBoiler;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControl;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@ -11,9 +10,9 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerRBMKControl extends Container {
|
||||
|
||||
private TileEntityRBMKControl rbmk;
|
||||
private TileEntityRBMKControlManual rbmk;
|
||||
|
||||
public ContainerRBMKControl(InventoryPlayer invPlayer, TileEntityRBMKControl tedf) {
|
||||
public ContainerRBMKControl(InventoryPlayer invPlayer, TileEntityRBMKControlManual tedf) {
|
||||
rbmk = tedf;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlAuto;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerRBMKControlAuto extends Container {
|
||||
|
||||
private TileEntityRBMKControlAuto rbmk;
|
||||
|
||||
public ContainerRBMKControlAuto(InventoryPlayer invPlayer, TileEntityRBMKControlAuto tedf) {
|
||||
rbmk = tedf;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 20));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 20));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return rbmk.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -6,11 +6,10 @@ import com.hbm.inventory.container.ContainerRBMKControl;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.NBTControlPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControl;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -19,9 +18,9 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class GUIRBMKControl extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_control.png");
|
||||
private TileEntityRBMKControl rod;
|
||||
private TileEntityRBMKControlManual rod;
|
||||
|
||||
public GUIRBMKControl(InventoryPlayer invPlayer, TileEntityRBMKControl tedf) {
|
||||
public GUIRBMKControl(InventoryPlayer invPlayer, TileEntityRBMKControlManual tedf) {
|
||||
super(new ContainerRBMKControl(invPlayer, tedf));
|
||||
rod = tedf;
|
||||
|
||||
|
||||
85
src/main/java/com/hbm/inventory/gui/GUIRBMKControlAuto.java
Normal file
85
src/main/java/com/hbm/inventory/gui/GUIRBMKControlAuto.java
Normal file
@ -0,0 +1,85 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerRBMKControlAuto;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.NBTControlPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlAuto;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIRBMKControlAuto extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_control_auto.png");
|
||||
private TileEntityRBMKControlAuto rod;
|
||||
|
||||
public GUIRBMKControlAuto(InventoryPlayer invPlayer, TileEntityRBMKControlAuto tedf) {
|
||||
super(new ContainerRBMKControlAuto(invPlayer, tedf));
|
||||
rod = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 124, guiTop + 29, 16, 56, mouseX, mouseY, new String[]{ (int)(rod.level * 100) + "%" } );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
/*for(int k = 0; k < 5; k++) {
|
||||
|
||||
//manual rod control
|
||||
if(guiLeft + 118 <= x && guiLeft + 118 + 30 > x && guiTop + 26 + k * 11 < y && guiTop + 26 + 10 + k * 11 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setDouble("level", 1.0D - (k * 0.25D));
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, rod.xCoord, rod.yCoord, rod.zCoord));
|
||||
}
|
||||
|
||||
//color groups
|
||||
if(guiLeft + 28 <= x && guiLeft + 28 + 12 > x && guiTop + 26 + k * 11 < y && guiTop + 26 + 10 + k * 11 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("color", k);
|
||||
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);
|
||||
|
||||
int height = (int)(56 * (1D - rod.level));
|
||||
|
||||
if(height > 0)
|
||||
drawTexturedModalRect(guiLeft + 124, guiTop + 29, 176, 56 - height, 8, height);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 59, guiTop + 27, 184, 0, 26, 19);
|
||||
}
|
||||
}
|
||||
@ -219,8 +219,8 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.source"));
|
||||
}
|
||||
|
||||
list.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey("trait.rbmx.depletion", ((int)(((yield - getYield(stack)) / yield) * 1000)) / 1000D + "%"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("trait.rbmx.xenon", ((getPoison(stack) * 100D) / 100D) + "%"));
|
||||
list.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey("trait.rbmx.depletion", ((int)(((yield - getYield(stack)) / yield) * 100000)) / 1000D + "%"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("trait.rbmx.xenon", ((int)(getPoison(stack) * 1000D) / 1000D) + "%"));
|
||||
list.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey("trait.rbmx.splitsWith", I18nUtil.resolveKey(nType.unlocalized + ".x")));
|
||||
list.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey("trait.rbmx.splitsInto", I18nUtil.resolveKey(rType.unlocalized + ".x")));
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.fluxFunc", EnumChatFormatting.WHITE + "" + funcEnd + " * x" + (selfRate > 0 ? (EnumChatFormatting.RED + " + " + selfRate) : "")));
|
||||
@ -238,8 +238,8 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.source"));
|
||||
}
|
||||
|
||||
list.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey("trait.rbmk.depletion", ((int)(((yield - getYield(stack)) / yield) * 1000D)) / 1000D + "%"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("trait.rbmk.xenon", ((getPoison(stack) * 100D) / 100D) + "%"));
|
||||
list.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey("trait.rbmk.depletion", ((int)(((yield - getYield(stack)) / yield) * 100000D)) / 1000D + "%"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("trait.rbmk.xenon", ((int)(getPoison(stack) * 1000D) / 1000D) + "%"));
|
||||
list.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey("trait.rbmk.splitsWith", I18nUtil.resolveKey(nType.unlocalized)));
|
||||
list.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey("trait.rbmk.splitsInto", I18nUtil.resolveKey(rType.unlocalized)));
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.fluxFunc", EnumChatFormatting.WHITE + "" + funcEnd + " * x" + (selfRate > 0 ? (EnumChatFormatting.RED + " + " + selfRate) : "")));
|
||||
|
||||
@ -49,6 +49,7 @@ import com.hbm.entity.particle.*;
|
||||
import com.hbm.entity.projectile.*;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.particle.*;
|
||||
import com.hbm.render.anim.*;
|
||||
import com.hbm.render.anim.HbmAnimations.Animation;
|
||||
@ -207,7 +208,8 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITERStruct.class, new RenderITERMultiblock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPlasmaStruct.class, new RenderPlasmaMultiblock());
|
||||
//RBMK
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControl.class, new RenderRBMKControlRod());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControlManual.class, new RenderRBMKControlRod(RefStrings.MODID + ":textures/blocks/rbmk/rbmk_control.png"));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControlAuto.class, new RenderRBMKControlRod(RefStrings.MODID + ":textures/blocks/rbmk/rbmk_control_auto.png"));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKConsole.class, new RenderRBMKConsole());
|
||||
//ITER
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITER.class, new RenderITER());
|
||||
|
||||
@ -463,7 +463,8 @@ public class MainRegistry {
|
||||
GameRegistry.registerTileEntity(TileEntityFEL.class, "tileentity_fel");
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKRod.class, "tileentity_rbmk_rod");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKControl.class, "tileentity_rbmk_control");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKControlManual.class, "tileentity_rbmk_control");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKControlAuto.class, "tileentity_rbmk_control_auto");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKBlank.class, "tileentity_rbmk_blank");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKBoiler.class, "tileentity_rbmk_boiler");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKReflector.class, "tileentity_rbmk_reflector");
|
||||
|
||||
@ -12,7 +12,11 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderRBMKControlRod extends TileEntitySpecialRenderer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/blocks/rbmk/rbmk_control.png");
|
||||
private ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/blocks/rbmk/rbmk_control.png");
|
||||
|
||||
public RenderRBMKControlRod(String texture) {
|
||||
this.texture = new ResourceLocation(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float i) {
|
||||
|
||||
@ -42,7 +42,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
|
||||
public double heat;
|
||||
|
||||
public boolean hasLid() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,36 +1,21 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements IControlReceiver {
|
||||
public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double lastLevel;
|
||||
public double level;
|
||||
public static final double speed = 0.00277D; // it takes around 18 seconds for the thing to fully extend
|
||||
public double targetLevel;
|
||||
public RBMKColor color;
|
||||
|
||||
public TileEntityRBMKControl() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.rbmkControl";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@ -60,28 +45,6 @@ public class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
|
||||
if(data.hasKey("level")) {
|
||||
this.targetLevel = data.getDouble("level");
|
||||
}
|
||||
|
||||
if(data.hasKey("color")) {
|
||||
int c = Math.abs(data.getInteger("color")) % RBMKColor.values().length; //to stop naughty kids from sending packets that crash the server
|
||||
|
||||
RBMKColor newCol = RBMKColor.values()[c];
|
||||
|
||||
if(newCol == this.color) {
|
||||
this.color = null;
|
||||
} else {
|
||||
this.color = newCol;
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
@ -89,11 +52,6 @@ public class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements
|
||||
|
||||
this.level = nbt.getDouble("level");
|
||||
this.targetLevel = nbt.getDouble("targetLevel");
|
||||
|
||||
if(nbt.hasKey("color"))
|
||||
this.color = RBMKColor.values()[nbt.getInteger("color")];
|
||||
else
|
||||
this.color = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,9 +60,6 @@ public class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements
|
||||
|
||||
nbt.setDouble("level", this.level);
|
||||
nbt.setDouble("targetLevel", this.targetLevel);
|
||||
|
||||
if(color != null)
|
||||
nbt.setInteger("color", color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,12 +72,4 @@ public class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
public static enum RBMKColor {
|
||||
RED,
|
||||
YELLOW,
|
||||
GREEN,
|
||||
BLUE,
|
||||
PURPLE
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
public class TileEntityRBMKControlAuto extends TileEntityRBMKControl {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.rbmkControlAuto";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntityRBMKControlManual extends TileEntityRBMKControl implements IControlReceiver {
|
||||
|
||||
public RBMKColor color;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.rbmkControl";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
|
||||
if(data.hasKey("level")) {
|
||||
this.targetLevel = data.getDouble("level");
|
||||
}
|
||||
|
||||
if(data.hasKey("color")) {
|
||||
int c = Math.abs(data.getInteger("color")) % RBMKColor.values().length; //to stop naughty kids from sending packets that crash the server
|
||||
|
||||
RBMKColor newCol = RBMKColor.values()[c];
|
||||
|
||||
if(newCol == this.color) {
|
||||
this.color = null;
|
||||
} else {
|
||||
this.color = newCol;
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
if(nbt.hasKey("color"))
|
||||
this.color = RBMKColor.values()[nbt.getInteger("color")];
|
||||
else
|
||||
this.color = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
if(color != null)
|
||||
nbt.setInteger("color", color.ordinal());
|
||||
}
|
||||
|
||||
public static enum RBMKColor {
|
||||
RED,
|
||||
YELLOW,
|
||||
GREEN,
|
||||
BLUE,
|
||||
PURPLE
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Loading…
x
Reference in New Issue
Block a user