RBMK auto control function limit, console GUI, recipes

This commit is contained in:
Bob 2021-05-05 23:35:08 +02:00
parent 1625ef2211
commit f89fc3702e
22 changed files with 235 additions and 19 deletions

View File

@ -867,7 +867,7 @@ public class ModBlocks {
public static final int guiID_rbmk_boiler = 114;
public static final int guiID_rbmk_control = 115;
public static final int guiID_rbmk_control_auto = 116;
public static final int guiID_rbmk_console = 17;
public static final int guiID_rbmk_console = 117;
public static Block pribris;
public static Block pribris_burning;
public static Block pribris_radiating;

View File

@ -12,6 +12,7 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -44,6 +45,11 @@ public class BlockGeysir extends BlockContainer {
public BlockGeysir(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public Item getItemDropped(int i, Random rand, int j) {
return null;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {

View File

@ -20,6 +20,12 @@ public class MineralRecipes {
RecipesCommon.add9To1(ModItems.ingot_aluminium, ModBlocks.block_aluminium);
RecipesCommon.add1To9(ModBlocks.block_aluminium, ModItems.ingot_aluminium);
RecipesCommon.add9To1(ModItems.ingot_graphite, ModBlocks.block_graphite);
RecipesCommon.add1To9(ModBlocks.block_graphite, ModItems.ingot_graphite);
RecipesCommon.add9To1(ModItems.ingot_boron, ModBlocks.block_boron);
RecipesCommon.add1To9(ModBlocks.block_boron, ModItems.ingot_boron);
RecipesCommon.add9To1(ModItems.nugget_zirconium, ModItems.ingot_zirconium);
RecipesCommon.add1To9(ModItems.ingot_zirconium, ModItems.nugget_zirconium);

View File

@ -813,6 +813,13 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_rbmk_console: {
if(entity instanceof TileEntityRBMKConsole) {
return new ContainerRBMKConsole(player.inventory, (TileEntityRBMKConsole) entity);
}
return null;
}
}
// NON-TE CONTAINERS
@ -1613,6 +1620,13 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_rbmk_console: {
if(entity instanceof TileEntityRBMKConsole) {
return new GUIRBMKConsole(player.inventory, (TileEntityRBMKConsole) entity);
}
return null;
}
}
// ITEM GUIS

View File

@ -683,6 +683,14 @@ public class AssemblerRecipes {
new ComparableStack(ModItems.pipes_steel, 1),
new ComparableStack(ModItems.crystal_diamond, 1)
}, 400);
makeRecipe(new ComparableStack(ModBlocks.rbmk_blank, 1), new AStack[] {
new ComparableStack(ModBlocks.concrete, 6),
new ComparableStack(ModItems.ingot_asbestos, 6),
new OreDictStack("plateSteel", 12),
new OreDictStack("ingotCopper", 4),
new ComparableStack(ModItems.plate_polymer, 4)
}, 100);
makeRecipe(new ComparableStack(ModBlocks.block_cap_nuka, 1), new AStack[] { new ComparableStack(ModItems.cap_nuka, 128) }, 10);
makeRecipe(new ComparableStack(ModBlocks.block_cap_quantum, 1), new AStack[] { new ComparableStack(ModItems.cap_quantum, 128) }, 10);

View File

@ -0,0 +1,35 @@
package com.hbm.inventory.container;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole;
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 ContainerRBMKConsole extends Container {
private TileEntityRBMKConsole rbmk;
public ContainerRBMKConsole(InventoryPlayer invPlayer, TileEntityRBMKConsole tedf) {
this.rbmk = tedf;
}
@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);
}
}

View File

@ -0,0 +1,43 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerRBMKConsole;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIRBMKConsole extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_console.png");
private TileEntityRBMKConsole console;
public GUIRBMKConsole(InventoryPlayer invPlayer, TileEntityRBMKConsole tedf) {
super(new ContainerRBMKConsole(invPlayer, tedf));
this.console = tedf;
this.xSize = 244;
this.ySize = 172;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 71, guiTop + 29, 16, 56, mouseX, mouseY, new String[]{ "%" } );
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
}
@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);
}
}

View File

@ -113,6 +113,8 @@ public class ModItems {
public static Item nugget_solinium;
public static Item ingot_phosphorus;
public static Item ingot_semtex;
public static Item ingot_boron;
public static Item ingot_graphite;
public static Item ingot_australium;
public static Item ingot_weidanium;
@ -1019,6 +1021,7 @@ public class ModItems {
public static Item digamma_diagnostic;
public static Item survey_scanner;
public static Item mirror_tool;
public static Item rbmk_tool;
public static Item template_folder;
public static Item journal_pip;
@ -2296,6 +2299,8 @@ public class ModItems {
ingot_au198 = new ItemHazard().addRadiation(ItemHazard.au198 * ItemHazard.ingot).addFire(15).toItem().setUnlocalizedName("ingot_au198").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_au198");
ingot_titanium = new Item().setUnlocalizedName("ingot_titanium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_titanium");
ingot_cobalt = new Item().setUnlocalizedName("ingot_cobalt").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_cobalt");
ingot_boron = new Item().setUnlocalizedName("ingot_boron").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_boron");
ingot_graphite = new Item().setUnlocalizedName("ingot_graphite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_graphite");
sulfur = new Item().setUnlocalizedName("sulfur").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":sulfur");
ingot_uranium_fuel = new ItemHazard(ItemHazard.uf * ItemHazard.ingot).setUnlocalizedName("ingot_uranium_fuel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_uranium_fuel");
@ -4036,6 +4041,7 @@ public class ModItems {
digamma_diagnostic = new ItemDigammaDiagnostic().setUnlocalizedName("digamma_diagnostic").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":digamma_diagnostic");
survey_scanner = new ItemSurveyScanner().setUnlocalizedName("survey_scanner").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":survey_scanner");
mirror_tool = new ItemMirrorTool().setUnlocalizedName("mirror_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":mirror_tool");
rbmk_tool = new ItemRBMKTool().setUnlocalizedName("rbmk_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":rbmk_tool");
key = new ItemKey().setUnlocalizedName("key").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":key");
key_red = new ItemCustomLore().setUnlocalizedName("key_red").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":key_red");
@ -4865,6 +4871,8 @@ public class ModItems {
GameRegistry.registerItem(ingot_lead, ingot_lead.getUnlocalizedName());
GameRegistry.registerItem(ingot_beryllium, ingot_beryllium.getUnlocalizedName());
GameRegistry.registerItem(ingot_cobalt, ingot_cobalt.getUnlocalizedName());
GameRegistry.registerItem(ingot_boron, ingot_boron.getUnlocalizedName());
GameRegistry.registerItem(ingot_graphite, ingot_graphite.getUnlocalizedName());
GameRegistry.registerItem(ingot_dura_steel, ingot_dura_steel.getUnlocalizedName());
GameRegistry.registerItem(ingot_polymer, ingot_polymer.getUnlocalizedName());
GameRegistry.registerItem(ingot_schraranium, ingot_schraranium.getUnlocalizedName());
@ -5891,6 +5899,7 @@ public class ModItems {
GameRegistry.registerItem(oil_detector, oil_detector.getUnlocalizedName());
GameRegistry.registerItem(survey_scanner, survey_scanner.getUnlocalizedName());
GameRegistry.registerItem(mirror_tool, mirror_tool.getUnlocalizedName());
GameRegistry.registerItem(rbmk_tool, rbmk_tool.getUnlocalizedName());
GameRegistry.registerItem(geiger_counter, geiger_counter.getUnlocalizedName());
GameRegistry.registerItem(digamma_diagnostic, digamma_diagnostic.getUnlocalizedName());
GameRegistry.registerItem(containment_box, containment_box.getUnlocalizedName());

View File

@ -0,0 +1,82 @@
package com.hbm.items.tool;
import java.util.List;
import com.google.common.collect.Multimap;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.rbmk.RBMKBase;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole;
import com.hbm.util.I18nUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemRBMKTool extends Item {
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
Block b = world.getBlock(x, y, z);
if(b instanceof RBMKBase) {
int[] pos = ((BlockDummyable)b).findCore(world, x, y, z);
if(pos != null && !world.isRemote) {
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setInteger("posX", pos[0]);
stack.stackTagCompound.setInteger("posY", pos[1] + 1);
stack.stackTagCompound.setInteger("posZ", pos[2]);
player.addChatComponentMessage(new ChatComponentTranslation(this.getUnlocalizedName() + ".linked").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
}
return true;
}
if(b == ModBlocks.rbmk_console && stack.hasTagCompound()) {
if(!world.isRemote) {
int[] pos = ((BlockDummyable)b).findCore(world, x, y, z);
TileEntityRBMKConsole mirror = (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");
}
return true;
}
return false;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
for(String s : I18nUtil.resolveKeyArray(this.getUnlocalizedName() + ".desc"))
list.add(EnumChatFormatting.YELLOW + s);
}
@Override
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap multimap = super.getAttributeModifiers(stack);
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 2, 0));
return multimap;
}
}

View File

@ -32,24 +32,34 @@ public class TileEntityRBMKControlAuto extends TileEntityRBMKControl implements
if(!worldObj.isRemote) {
double fauxLevel = 0;
double lowerBound = Math.min(this.heatLower, this.heatUpper);
double upperBound = Math.max(this.heatLower, this.heatUpper);
//TODO: there's some chaos that needs limiting
switch(this.function) {
case LINEAR:
// my brain hasn't been this challenged since my math finals in
// '19
fauxLevel = (this.heat - this.heatLower) * ((this.levelUpper - this.levelLower) / (this.heatUpper - this.heatLower)) + this.levelLower;
break;
case QUAD_UP:
// so this is how we roll, huh?
fauxLevel = Math.pow((this.heat - this.heatLower) / (this.heatUpper - this.heatLower), 2) * (this.levelUpper - this.levelLower) + this.levelLower;
break;
case QUAD_DOWN:
// sometimes my genius is almost frightening
fauxLevel = Math.pow((this.heat - this.heatUpper) / (this.heatLower - this.heatUpper), 2) * (this.levelLower - this.levelUpper) + this.levelUpper;
break;
if(this.heat < lowerBound) {
fauxLevel = this.levelLower;
} else if(this.heat > upperBound) {
fauxLevel = this.levelUpper;
} else {
switch(this.function) {
case LINEAR:
// my brain hasn't been this challenged since my math finals in
// '19
fauxLevel = (this.heat - this.heatLower) * ((this.levelUpper - this.levelLower) / (this.heatUpper - this.heatLower)) + this.levelLower;
break;
case QUAD_UP:
// so this is how we roll, huh?
fauxLevel = Math.pow((this.heat - this.heatLower) / (this.heatUpper - this.heatLower), 2) * (this.levelUpper - this.levelLower) + this.levelLower;
break;
case QUAD_DOWN:
// sometimes my genius is almost frightening
fauxLevel = Math.pow((this.heat - this.heatUpper) / (this.heatLower - this.heatUpper), 2) * (this.levelLower - this.levelUpper) + this.levelUpper;
break;
}
}
this.targetLevel = fauxLevel * 0.01D;

View File

@ -4,7 +4,6 @@ import com.hbm.packet.NBTPacket;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

View File

@ -1339,6 +1339,7 @@ item.ingot_asbestos.name=Asbestplatte
item.ingot_au198.name=Gold-198-Barren
item.ingot_australium.name=Australiumbarren
item.ingot_beryllium.name=Berylliumbarren
item.ingot_boron.name=Borbarren
item.ingot_chainsteel.name=Schwerer Kettenstahl
item.ingot_co60.name=Kobalt-60-Barren
item.ingot_cobalt.name=Kobaltbarren
@ -1351,6 +1352,7 @@ item.ingot_dura_steel.name=Schnellarbeitsstahlbarren
item.ingot_electronium.name=Elektroniumbarren
item.ingot_euphemium.name=Euphemiumbarren
item.ingot_fiberglass.name=Fiberglasstafel
item.ingot_graphite.name=Graphitbarren
item.ingot_hes.name=Stark angereicherter Schrabidiumkernbrennstoffbarren
item.ingot_lanthanium.name=Semistabiler Lanthanbarren
item.ingot_lead.name=Bleibarren

View File

@ -1339,6 +1339,7 @@ item.ingot_asbestos.name=Asbestos Sheet
item.ingot_au198.name=Gold-198 Ingot
item.ingot_australium.name=Australium Ingot
item.ingot_beryllium.name=Beryllium Ingot
item.ingot_boron.name=Boron Ingot
item.ingot_chainsteel.name=Heavy Chainsteel
item.ingot_co60.name=Cobalt-60 Ingot
item.ingot_cobalt.name=Cobalt Ingot
@ -1351,6 +1352,7 @@ item.ingot_dura_steel.name=High-Speed Steel Ingot
item.ingot_electronium.name=Electronium Ingot
item.ingot_euphemium.name=Euphemium Ingot
item.ingot_fiberglass.name=Fiberglass Bar
item.ingot_graphite.name=Graphite Ingot
item.ingot_hes.name=Highly Enriched Schrabidium Fuel Ingot
item.ingot_lanthanium.name=Semi-Stable Lanthanium Ingot
item.ingot_lead.name=Lead Ingot

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B