diff --git a/README.md b/README.md index 44d0ef5..29cd955 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,13 @@ If you would like to help, send a me message on discord (my username is recursiv # Issues If you find an issue and would like to report it, you can either open an issue here or send me a message on discord. + +# TODO +- Breeder rods +- Explosions & other overheat effects +- UI Polishing +- New textures +- Make vents state their total cooling capacity in sim results +- Test on MP +- Component automation configuration in the simulator +- A decent looking TESR thermal sensor for EU reactors (or hook into nuclear control somehow) diff --git a/assets/reactor_chamber_side.xcf b/assets/reactor_chamber_side.xcf new file mode 100644 index 0000000..420920c Binary files /dev/null and b/assets/reactor_chamber_side.xcf differ diff --git a/assets/reactor_chamber_top.xcf b/assets/reactor_chamber_top.xcf new file mode 100644 index 0000000..3d9d414 Binary files /dev/null and b/assets/reactor_chamber_top.xcf differ diff --git a/assets/reactor_core_side.xcf b/assets/reactor_core_side.xcf new file mode 100644 index 0000000..99e3d32 Binary files /dev/null and b/assets/reactor_core_side.xcf differ diff --git a/assets/reactor_core_side_active.xcf b/assets/reactor_core_side_active.xcf new file mode 100644 index 0000000..f98a990 Binary files /dev/null and b/assets/reactor_core_side_active.xcf differ diff --git a/assets/thermal_sensor.xcf b/assets/thermal_sensor.xcf index 344a771..f76af29 100644 Binary files a/assets/thermal_sensor.xcf and b/assets/thermal_sensor.xcf differ diff --git a/dependencies.gradle b/dependencies.gradle index e8046a2..84d6133 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -5,6 +5,8 @@ dependencies { runtimeOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") runtimeOnlyNonPublishable("com.github.GTNewHorizons:waila:1.8.0:dev") + implementation("com.google.protobuf:protobuf-java:3.25.3") + api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") api('com.github.GTNewHorizons:GT5-Unofficial:5.09.46.23:dev') api("com.github.GTNewHorizons:ModularUI:1.2.0:dev") diff --git a/scripts/update_protos.sh b/scripts/update_protos.sh new file mode 100755 index 0000000..6f0c5b5 --- /dev/null +++ b/scripts/update_protos.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd $(dirname $(realpath $0))/.. + +protoc --plugin=java --java_out=src/main/java/ $(find src -name "*.proto") + diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/CommonProxy.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/CommonProxy.java index d0650ea..e43b0a8 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/CommonProxy.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/CommonProxy.java @@ -4,6 +4,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.blocks.BlockList; import com.recursive_pineapple.nuclear_horizons.reactors.fluids.FluidList; import com.recursive_pineapple.nuclear_horizons.reactors.items.ItemList; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationItems; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -24,8 +25,10 @@ public void preInit(FMLPreInitializationEvent event) { // load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed) public void init(FMLInitializationEvent event) { - // PacketDispatcher.registerPackets(); + PacketDispatcher.registerPackets(); // PacketDispatcher.TileEntityUpdatedMessage.init(); + + SimulationItems.init(); } // postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed) diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/networking/PacketDispatcher.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/networking/PacketDispatcher.java index 6dad6df..db3b2d4 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/networking/PacketDispatcher.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/networking/PacketDispatcher.java @@ -10,6 +10,8 @@ import com.recursive_pineapple.nuclear_horizons.NuclearHorizons; import com.recursive_pineapple.nuclear_horizons.reactors.tile.IUpdateableTileEntity; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorSimulator; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationResult; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.NetworkRegistry; @@ -20,8 +22,10 @@ import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; public class PacketDispatcher { private static byte packetId = 0; @@ -29,7 +33,58 @@ public class PacketDispatcher { public static final SimpleNetworkWrapper DISPATCHER = NetworkRegistry.INSTANCE.newSimpleChannel(NuclearHorizons.MODID); public static final void registerPackets() { - DISPATCHER.registerMessage(TileEntityUpdatedMessage::handle, TileEntityUpdatedMessage.class, packetId++, Side.CLIENT); + DISPATCHER.registerMessage(ReactorSimulationFinishedMessage::handle, ReactorSimulationFinishedMessage.class, packetId++, Side.SERVER); + } + + public static class ReactorSimulationFinishedMessage implements IMessage { + public int dimensionId, x, y, z; + + public SimulationResult result; + + @Override + public void fromBytes(ByteBuf buf) { + this.dimensionId = buf.readInt(); + this.x = buf.readInt(); + this.y = buf.readInt(); + this.z = buf.readInt(); + + this.result = SimulationResult.read(buf); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(dimensionId); + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + + SimulationResult.write(buf, result); + } + + public static IMessage handle(IMessage message, MessageContext ctx) { + if(!(message instanceof ReactorSimulationFinishedMessage msg)) { + return null; + } + + WorldServer dim = null; + + for(var world : MinecraftServer.getServer().worldServers) { + if(world.provider.dimensionId == msg.dimensionId) { + dim = world; + break; + } + } + + if(dim == null) { + return null; + } + + if(dim.getTileEntity(msg.x, msg.y, msg.z) instanceof TileReactorSimulator sim) { + sim.setSimulationResult(msg.result); + } + + return null; + } } public static class TileEntityUpdatedMessage implements IMessage { diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/BlockList.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/BlockList.java index 3a74267..d7081a2 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/BlockList.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/BlockList.java @@ -7,7 +7,9 @@ import com.recursive_pineapple.nuclear_horizons.reactors.fluids.FluidList; import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileAccessHatch; import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileFluidPort; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorChamber; import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorCore; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorSimulator; import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileRedstonePort; import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileThermalSensor; @@ -22,6 +24,7 @@ public class BlockList { public static final String REACTOR_ACCESS_HATCH_NAME = "reactor_access_hatch"; public static final String REACTOR_REDSTONE_PORT_NAME = "reactor_redstone_port"; public static final String REACTOR_THERMAL_SENSOR_NAME = "reactor_thermal_sensor"; + public static final String REACTOR_SIMULATOR_NAME = "reactor_simulator"; public static final String COOLANT_BLOCK_NAME = "nh_coolant"; public static final String HOT_COOLANT_BLOCK_NAME = "nh_hot_coolant"; @@ -32,6 +35,7 @@ public class BlockList { public static ReactorAccessHatch REACTOR_ACCESS_HATCH; public static ReactorRedstonePort REACTOR_REDSTONE_PORT; public static ReactorThermalSensor REACTOR_THERMAL_SENSOR; + public static ReactorSimulator REACTOR_SIMULATOR; public static FluidBlock COOLANT_BLOCK; public static FluidBlock HOT_COOLANT_BLOCK; @@ -44,6 +48,7 @@ public static void registerBlocks() { REACTOR_ACCESS_HATCH = new ReactorAccessHatch(); REACTOR_REDSTONE_PORT = new ReactorRedstonePort(); REACTOR_THERMAL_SENSOR = new ReactorThermalSensor(); + REACTOR_SIMULATOR = new ReactorSimulator(); COOLANT_BLOCK = new FluidBlock( FluidList.COOLANT, @@ -59,12 +64,14 @@ public static void registerBlocks() { NuclearHorizons.MODID + ":hot_coolant_still", NuclearHorizons.MODID + ":hot_coolant_flow" ); + HOT_COOLANT_BLOCK.setBurnsEntities(true); HOT_COOLANT_BLOCK.setBlockName(HOT_COOLANT_BLOCK_NAME); registerBlock(REACTOR_CORE, REACTOR_CORE_NAME); registerTileEntity(TileReactorCore.class, REACTOR_CORE_NAME); registerBlock(REACTOR_CHAMBER, REACTOR_CHAMBER_NAME); + registerTileEntity(TileReactorChamber.class, REACTOR_CHAMBER_NAME); registerBlock(PRESSURE_VESSEL, PRESSURE_VESSEL_NAME); @@ -80,6 +87,9 @@ public static void registerBlocks() { registerBlock(REACTOR_THERMAL_SENSOR, REACTOR_THERMAL_SENSOR_NAME); registerTileEntity(TileThermalSensor.class, REACTOR_THERMAL_SENSOR_NAME); + registerBlock(REACTOR_SIMULATOR, REACTOR_SIMULATOR_NAME); + registerTileEntity(TileReactorSimulator.class, REACTOR_SIMULATOR_NAME); + registerBlock(COOLANT_BLOCK, COOLANT_BLOCK_NAME); registerBlock(HOT_COOLANT_BLOCK, HOT_COOLANT_BLOCK_NAME); } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/FluidBlock.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/FluidBlock.java index 6ce85eb..75aa80b 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/FluidBlock.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/FluidBlock.java @@ -4,15 +4,21 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.BlockFluidFinite; +import net.minecraft.world.World; +import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -public class FluidBlock extends BlockFluidFinite { +public class FluidBlock extends BlockFluidClassic { + + public static final DamageSource HOT_FLUID_DAMAGE = new DamageSource("hot_fluid"); private String stillTextureName, flowingTextureName; public IIcon stillIcon, flowingIcon; + private boolean burnsEntities = false; public FluidBlock(Fluid fluid, Material material, String stillTextureName, String flowingTextureName) { super(fluid, material); @@ -31,4 +37,17 @@ public void registerBlockIcons(IIconRegister reg) { stillIcon = reg.registerIcon(stillTextureName); flowingIcon = reg.registerIcon(flowingTextureName); } + + public FluidBlock setBurnsEntities(boolean burnsEntities) { + this.burnsEntities = burnsEntities; + return this; + } + + @Override + public void onEntityCollidedWithBlock(World worldIn, int x, int y, int z, Entity entityIn) { + super.onEntityCollidedWithBlock(worldIn, x, y, z, entityIn); + if(burnsEntities && worldIn.getWorldTime() % 20 == 0) { + entityIn.attackEntityFrom(HOT_FLUID_DAMAGE, 1.0f); + } + } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorChamber.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorChamber.java index 14c9096..068efb3 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorChamber.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorChamber.java @@ -9,15 +9,19 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; import net.minecraft.world.World; public class ReactorChamber extends BlockContainer { + private IIcon iconTop, iconSide; + public ReactorChamber() { super(Material.iron); @@ -27,6 +31,21 @@ public ReactorChamber() { setBlockTextureName("nuclear_horizons:reactor_chamber"); } + @Override + public void registerBlockIcons(IIconRegister reg) { + this.iconTop = reg.registerIcon("nuclear_horizons:reactor_chamber_top"); + this.iconSide = reg.registerIcon("nuclear_horizons:reactor_chamber_side"); + } + + @Override + public IIcon getIcon(int side, int meta) { + if(side == 0 || side == 1) { + return iconTop; + } else { + return iconSide; + } + } + @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileReactorChamber(); diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorCore.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorCore.java index f729552..983f39c 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorCore.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorCore.java @@ -13,7 +13,7 @@ public class ReactorCore extends BlockContainer { - private IIcon iconTop, iconSide; + private IIcon iconTop, iconSideInactive, iconSideActive, iconBottom; public ReactorCore() { super(Material.iron); @@ -25,13 +25,27 @@ public ReactorCore() { @Override public void registerBlockIcons(IIconRegister reg) { - this.iconTop = reg.registerIcon("nuclear_horizons:reactor_chamber"); - this.iconSide = reg.registerIcon("nuclear_horizons:reactor_core"); + this.iconTop = reg.registerIcon("nuclear_horizons:reactor_chamber_side"); + this.iconBottom = reg.registerIcon("nuclear_horizons:reactor_chamber_top"); + this.iconSideInactive = reg.registerIcon("nuclear_horizons:reactor_core_side"); + this.iconSideActive = reg.registerIcon("nuclear_horizons:reactor_core_side_active"); } @Override public IIcon getIcon(int side, int meta) { - return iconTop; + if(side == 1) { + return iconTop; + } + + if(side == 0) { + return iconBottom; + } + + if(meta == 1) { + return iconSideActive; + } else { + return iconSideInactive; + } } @Override diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorSimulator.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorSimulator.java new file mode 100644 index 0000000..89e8338 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/blocks/ReactorSimulator.java @@ -0,0 +1,33 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.blocks; + +import com.gtnewhorizons.modularui.api.UIInfos; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorSimulator; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class ReactorSimulator extends BlockContainer { + protected ReactorSimulator() { + super(Material.iron); + + setBlockName(BlockList.REACTOR_SIMULATOR_NAME); + setStepSound(soundTypeMetal); + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { + return new TileReactorSimulator(); + } + + @Override + public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) { + if(!worldIn.isRemote) { + UIInfos.TILE_MODULAR_UI.open(player, worldIn, x, y, z); + } + + return true; + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/IComponentAdapter.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/IComponentAdapter.java index 7a433e6..ff09433 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/IComponentAdapter.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/IComponentAdapter.java @@ -1,5 +1,7 @@ package com.recursive_pineapple.nuclear_horizons.reactors.components; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationResult; + import net.minecraft.item.ItemStack; public interface IComponentAdapter { @@ -46,4 +48,8 @@ public default int getReactorMaxHeatIncrease() { public default double getExplosionRadiusMult() { return 1.0; } + + public default void modifySimulationResults(SimulationResult result, int componentIndex) { + + } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/FuelRodAdapter.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/FuelRodAdapter.java index 2d13344..33bac83 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/FuelRodAdapter.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/FuelRodAdapter.java @@ -47,6 +47,8 @@ public void onHeatTick() { } if(fuelRod.getRemainingHealth(itemStack) <= 0) { + var product = fuelRod.getProduct(itemStack); + reactor.setItem(x, y, product != null ? product.copy() : null); return; } @@ -83,7 +85,7 @@ public void onEnergyTick() { return; } - if(fuelRod.getRemainingHealth(itemStack) == 0) { + if(fuelRod.getRemainingHealth(itemStack) <= 0) { return; } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatAbsorberAdapter.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatAbsorberAdapter.java index 151d2e1..cfda4d5 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatAbsorberAdapter.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatAbsorberAdapter.java @@ -47,13 +47,12 @@ public int getStoredHeat() { @Override public int addHeat(int delta) { - return this.heatContainer.addHeat(itemStack, delta); - } + int rejected = this.heatContainer.addHeat(itemStack, delta); - @Override - public void onHeatTick() { if(this.heatContainer.getRemainingHealth(itemStack) <= 0 && this.heatContainer.isConsumable(itemStack)) { this.reactor.setItem(x, y, null); } + + return rejected; } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatMoverAdapter.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatMoverAdapter.java index d84c475..24f296e 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatMoverAdapter.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/components/adapters/HeatMoverAdapter.java @@ -4,6 +4,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; import com.recursive_pineapple.nuclear_horizons.reactors.components.InventoryDirection; import com.recursive_pineapple.nuclear_horizons.reactors.items.IHeatMover; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationResult; import net.minecraft.item.ItemStack; @@ -49,7 +50,23 @@ public int getStoredHeat() { @Override public int addHeat(int delta) { - return this.heatMover.addHeat(itemStack, delta); + int rejected = this.heatMover.addHeat(itemStack, delta); + + if(this.heatMover.getRemainingHealth(itemStack) <= 0) { + this.reactor.setItem(this.x, this.y, null); + } + + return rejected; + } + + @Override + public void modifySimulationResults(SimulationResult result, int componentIndex) { + // if(result.maxHullCooling == null) result.maxHullCooling = 0l; + + // result.maxHullCooling += this.heatMover.getTransferFromReactor(itemStack, reactor); + + // if(result.componentResults[componentIndex].maxAirHeating + // TODO: this } @Override @@ -102,9 +119,5 @@ public void onHeatTick() { } } } - - if(this.heatMover.getRemainingHealth(itemStack) <= 0) { - this.reactor.setItem(this.x, this.y, null); - } } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicFuelRodItem.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicFuelRodItem.java index ec01237..3010d27 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicFuelRodItem.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicFuelRodItem.java @@ -1,8 +1,10 @@ package com.recursive_pineapple.nuclear_horizons.reactors.items; +import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.lwjgl.input.Keyboard; @@ -13,6 +15,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; import com.recursive_pineapple.nuclear_horizons.reactors.components.adapters.FuelRodAdapter; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -24,6 +27,7 @@ public class BasicFuelRodItem extends Item implements IBasicFuelRod, IComponentA private final int rodCount; private final boolean isMox; private final int maxHealth; + private ItemStack product; public BasicFuelRodItem(String name, String textureName, double energyMult, double heatMult, int rodCount, boolean isMox, int maxHealth) { setUnlocalizedName(name); @@ -67,6 +71,16 @@ public void applyDamage(@Nonnull ItemStack itemStack, int damage) { itemStack.setItemDamage(itemStack.getItemDamage() + damage); } + @Override + public ItemStack getProduct(@Nonnull ItemStack itemStack) { + return product; + } + + public BasicFuelRodItem setProduct(@Nullable ItemStack product) { + this.product = product; + return this; + } + @Override public boolean canAdaptItem(@Nonnull ItemStack itemStack) { return itemStack.getItem() == this; @@ -82,28 +96,42 @@ public void addInformation(ItemStack itemStack, EntityPlayer player, List desc, boolean advancedItemTooltips) { super.addInformation(itemStack, player, desc, advancedItemTooltips); - desc.add(String.format("Stored Heat: %,d / %,d", itemStack.getItemDamage(), this.maxHeat)); + desc.add(I18n.format("nh_tooltip.durability", itemStack.getItemDamage(), this.maxHeat)); } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatExchangerItem.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatExchangerItem.java index 68cdb04..1e5a7d9 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatExchangerItem.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatExchangerItem.java @@ -12,6 +12,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; import com.recursive_pineapple.nuclear_horizons.reactors.components.adapters.HeatMoverAdapter; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -86,21 +87,21 @@ public void addInformation(ItemStack itemStack, EntityPlayer player, List 0) { - desc.add(String.format("Stored Heat: %,d / %,d", this.getStoredHeat(itemStack), this.maxHeat)); + desc.add(I18n.format("nh_tooltip.durability", this.getStoredHeat(itemStack), this.maxHeat)); } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - desc.add("Every two seconds, this component will:"); + desc.add(I18n.format("nh_tooltip.prelude")); if(this.maxHeatFromReactor > 0) { - desc.add(String.format("Transfer up to %d HU between the reactor and itself.", this.maxHeatFromReactor)); + desc.add(I18n.format("nh_tooltip.mover.reactor_xfer", this.maxHeatFromReactor)); } if(this.maxHeatFromNeighbour > 0) { - desc.add(String.format("Transfer up to %d HU between its neighbours and itself.", this.maxHeatFromNeighbour)); + desc.add(I18n.format("nh_tooltip.exchanger.comp_xfer", this.maxHeatFromNeighbour)); } } else { - desc.add("Hold Shift for more info."); + desc.add(I18n.format("nh_tooltip.more_info")); } } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatVentItem.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatVentItem.java index 539d1ac..670ea4c 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatVentItem.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicHeatVentItem.java @@ -12,6 +12,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; import com.recursive_pineapple.nuclear_horizons.reactors.components.adapters.HeatMoverAdapter; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -97,22 +98,26 @@ public void addInformation(ItemStack itemStack, EntityPlayer player, List 0) { - desc.add(String.format("Stored Heat: %,d / %,d", this.getStoredHeat(itemStack), this.maxHeat)); + desc.add(I18n.format("nh_tooltip.stored_heat", this.getStoredHeat(itemStack), this.maxHeat)); } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - desc.add("Every two seconds, this component will:"); + desc.add(I18n.format("nh_tooltip.prelude")); if(this.maxHeatFromReactor > 0) { - desc.add(String.format("Transfer up to %d HU from the reactor to itself.", this.maxHeatFromReactor)); + desc.add(I18n.format("nh_tooltip.mover.reactor_xfer", this.maxHeatFromReactor)); } if(this.maxHeatToAir > 0) { - desc.add(String.format("Dissipate up to %d HU from itself.", this.maxHeatToAir)); + desc.add(I18n.format("nh_tooltip.vent.void_self", this.maxHeatToAir)); } if(this.maxNeighbourToAir > 0) { - desc.add(String.format("Dissipate up to %d HU from its neighbours.", this.maxNeighbourToAir)); + desc.add(I18n.format("nh_tooltip.vent.void_adj", this.maxNeighbourToAir)); + } + + if(this.maxHeatToAir > 0) { + desc.add(I18n.format("nh_tooltip.vent.fluid_disclaimer")); } } else { desc.add("Hold Shift for more info."); diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicNeutronReflectorItem.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicNeutronReflectorItem.java index 72f66d2..8518804 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicNeutronReflectorItem.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/BasicNeutronReflectorItem.java @@ -13,6 +13,7 @@ import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; import com.recursive_pineapple.nuclear_horizons.reactors.components.adapters.NeutronReflectorAdapter; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -71,12 +72,12 @@ public void applyDamage(@Nonnull ItemStack itemStack, int damage) { public void addInformation(ItemStack itemStack, EntityPlayer player, List desc, boolean advancedItemTooltips) { super.addInformation(itemStack, player, desc, advancedItemTooltips); - if(!advancedItemTooltips) { - if(this.maxHealth > 0) { - desc.add(String.format("Durability: %,d / %,d", this.getRemainingHealth(itemStack), this.maxHealth)); - } else { - desc.add("Invulnerable"); + if(this.maxHealth > 0) { + if(!advancedItemTooltips || itemStack.getItemDamage() == 0) { + desc.add(I18n.format("nh_tooltip.durability", this.getRemainingHealth(itemStack), this.maxHealth)); } + } else { + desc.add(I18n.format("nh_tooltip.undestructable")); } } } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/HeatUtils.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/HeatUtils.java index 305b8db..b43925f 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/HeatUtils.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/HeatUtils.java @@ -5,7 +5,7 @@ public class HeatUtils { private HeatUtils() { } public static int getTransferAmount(int sourceHeat, int destHeat, int max) { - // pos = source > dest: pull, neg = source < dest: push + // positive = source > dest: pull, negative = source < dest: push int delta = sourceHeat - destHeat; int signum = delta < 0 ? -1 : 1; @@ -21,10 +21,9 @@ public static int getTransferAmount(int sourceHeat, int destHeat, int max) { } public static int getConsumableHeat(int maxHeat, int currentHeat, int addedHeat) { - // if we have 50 heat and we subtract 25, we should be able to consume 25 heat - // 50 - 75 = 50 - // 25, 50 + 50 = 25 + // 50 stored - 75 removed = 50 removed + // 25 out of 50 + 50 added = 25 added if(addedHeat > 0) { int remaining = maxHeat - currentHeat; diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/IBasicFuelRod.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/IBasicFuelRod.java index 2d26ea5..321afe9 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/IBasicFuelRod.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/items/IBasicFuelRod.java @@ -1,6 +1,7 @@ package com.recursive_pineapple.nuclear_horizons.reactors.items; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import net.minecraft.item.ItemStack; @@ -14,4 +15,6 @@ public interface IBasicFuelRod { public int getRemainingHealth(@Nonnull ItemStack itemStack); public void applyDamage(@Nonnull ItemStack itemStack, int damage); + public @Nullable ItemStack getProduct(@Nonnull ItemStack itemStack); + } diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileAccessHatch.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileAccessHatch.java index 692066f..7d2dd87 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileAccessHatch.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileAccessHatch.java @@ -2,6 +2,8 @@ import javax.annotation.Nullable; +import com.recursive_pineapple.nuclear_horizons.reactors.blocks.BlockList; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -135,24 +137,12 @@ public void setInventorySlotContents(int index, ItemStack stack) { @Override public String getInventoryName() { - var reactor = getReactor(); - - if(reactor != null) { - return reactor.getInventoryName(); - } else { - return "Reactor Access Hatch"; - } + return BlockList.REACTOR_ACCESS_HATCH_NAME; } @Override public boolean hasCustomInventoryName() { - var reactor = getReactor(); - - if(reactor != null) { - return reactor.hasCustomInventoryName(); - } else { - return false; - } + return false; } @Override diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorChamber.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorChamber.java index 39bb951..1645f93 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorChamber.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorChamber.java @@ -2,6 +2,8 @@ import javax.annotation.Nullable; +import com.recursive_pineapple.nuclear_horizons.reactors.blocks.BlockList; + import gregtech.api.interfaces.tileentity.IEnergyConnected; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -162,24 +164,12 @@ public void setInventorySlotContents(int index, ItemStack stack) { @Override public String getInventoryName() { - var reactor = getReactor(); - - if(reactor != null) { - return reactor.getInventoryName(); - } else { - return "Reactor Access Hatch"; - } + return BlockList.REACTOR_CHAMBER_NAME; } @Override public boolean hasCustomInventoryName() { - var reactor = getReactor(); - - if(reactor != null) { - return reactor.hasCustomInventoryName(); - } else { - return false; - } + return false; } @Override diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorCore.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorCore.java index 63a3ce8..ffa8dec 100644 --- a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorCore.java +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorCore.java @@ -38,6 +38,7 @@ import gregtech.api.logic.interfaces.PowerLogicHost; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -56,8 +57,8 @@ public class TileReactorCore extends TileEntity implements IInventory, IReactorGrid, ITileWithModularUI, IEnergyConnected { - private static final int ROW_COUNT = 6; - private static final int COL_COUNT = 9; + public static final int ROW_COUNT = 6; + public static final int COL_COUNT = 9; private static final int REACTOR_TICK_SPEED = 20; private static final int REACTOR_STRUCTURE_CHECK_PERIOD = 10 * 20; @@ -217,7 +218,7 @@ public ModularWindow createWindow(UIBuildContext buildContext) { .setAlignment(CrossAxisAlignment.CENTER) .widgets( padding(7, 7), - new TextWidget("Nuclear Reactor").setSize(150, 16), + new TextWidget(I18n.format("nh_gui.reactor.title")).setSize(150, 16), new Row() .setAlignment(MainAxisAlignment.CENTER, CrossAxisAlignment.CENTER) .widgets( @@ -240,21 +241,21 @@ public ModularWindow createWindow(UIBuildContext buildContext) { .setAlignment(MainAxisAlignment.START) .widgets( padding(7 + 16, 16), - new TextWidget("Inventory").setSize(50, 16) + new TextWidget(I18n.format("nh_gui.reactor.player_inv")).setSize(50, 16) ) ) .addChild( new Row() .setAlignment(MainAxisAlignment.END) .widgets( - TextWidget.dynamicString(() -> String.format("HU: %,d", this.storedHeat)) + TextWidget.dynamicString(() -> I18n.format("nh_gui.reactor.stored_hu", this.storedHeat)) + .setSize(50, 16), + TextWidget.dynamicString(() -> ( + !isFluid + ? I18n.format("nh_gui.reactor.eu_output", this.addedEU / 20) + : I18n.format("nh_gui.reactor.hu_output", this.addedHeat) + )) .setSize(50, 16), - TextWidget.dynamicString(() -> String.format("EU/t: %,d", this.addedEU / 20)) - .setSizeProvider((s, w, p) -> isFluid ? new Size(0, 0) : new Size(50, 16)) - .setEnabled(w -> !isFluid), - TextWidget.dynamicString(() -> String.format("HU/s: %,d", this.addedHeat)) - .setSizeProvider((s, w, p) -> !isFluid ? new Size(0, 0) : new Size(50, 16)) - .setEnabled(w -> isFluid), padding(7 + 16, 16) ) ) @@ -400,6 +401,8 @@ public void updateEntity() { this.tickCounter++; if(this.tickCounter % REACTOR_TICK_SPEED == 0) { + boolean wasActive = isActive; + this.isActive = worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0; for(var dir : DirectionUtil.values()) { @@ -432,6 +435,10 @@ public void updateEntity() { this.doEUTick(); } + if(wasActive != isActive) { + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, isActive ? 1 : 0, 3); + } + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -673,7 +680,7 @@ public void setInventorySlotContents(int index, ItemStack stack) { @Override public String getInventoryName() { - return "gui.reactor.name"; + return BlockList.REACTOR_CORE_NAME; } @Override diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorSimulator.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorSimulator.java new file mode 100644 index 0000000..88d278b --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/TileReactorSimulator.java @@ -0,0 +1,791 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile; + +import static com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorCore.COL_COUNT; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Objects; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.DoubleConsumer; +import java.util.function.DoubleSupplier; +import java.util.function.Supplier; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.math.Color; +import com.gtnewhorizons.modularui.api.math.CrossAxisAlignment; +import com.gtnewhorizons.modularui.api.math.MainAxisAlignment; +import com.gtnewhorizons.modularui.api.math.Size; +import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.api.widget.Widget; +import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.Column; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; +import com.gtnewhorizons.modularui.common.widget.Row; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.SyncedWidget; +import com.gtnewhorizons.modularui.common.widget.TabButton; +import com.gtnewhorizons.modularui.common.widget.TabContainer; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import com.gtnewhorizons.modularui.common.widget.VanillaButtonWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget; +import com.recursive_pineapple.nuclear_horizons.NuclearHorizons; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationConfig; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulationResult; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.Simulator; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; + +public class TileReactorSimulator extends TileEntity implements ITileWithModularUI { + + @SideOnly(Side.CLIENT) + private final Simulator simulator = new Simulator(this); + + @NotNull + private String configCode = ""; + + /** + * Must be final since the SlotGroup keeps a reference to this specific config. + */ + private final SimulationConfig config = new SimulationConfig(); + + @Nullable + private SimulationResult latestSimulation; + + @SideOnly(Side.CLIENT) + private SlotGroup slots; + + @SideOnly(Side.CLIENT) + private TabContainer tabContainer; + + @SideOnly(Side.CLIENT) + private int activeComponentX = -1, activeComponentY = -1; + + public TileReactorSimulator() { + + } + + @Override + public void updateEntity() { + simulator.pollFinished(); + } + + public void setSimulationResult(SimulationResult result) { + latestSimulation = result; + + config.result = result; + + if(result != null) result.config = config; + + if(slots != null) { + for(var child : slots.getChildren()) { + if(child instanceof SlotWidget slot) { + slot.getMcSlot().onSlotChanged(); + } + } + } + + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + public void setConfigCode(String code) { + if(!Objects.equals(code, this.configCode)) { + this.configCode = code; + this.config.put(SimulationConfig.fromCode(code)); + + if(slots != null) { + for(var child : slots.getChildren()) { + if(child instanceof SlotWidget slot) { + slot.getMcSlot().onSlotChanged(); + } + } + } + + if(worldObj != null) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirty(); + } + } + + public void onConfigChanged() { + var code = this.config.getCode(); + + if(!Objects.equals(code, configCode)) { + this.configCode = code; + if(worldObj != null) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirty(); + } + } + + @Override + public Packet getDescriptionPacket() { + var nbt = new NBTTagCompound(); + + if(this.latestSimulation != null) { + nbt.setByteArray("history", this.latestSimulation.save().toByteArray()); + } + + nbt.setString("code", configCode); + + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, blockMetadata, nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + var nbt = pkt.func_148857_g(); + + setConfigCode(nbt.getString("code")); + + var data = nbt.getByteArray("history"); + if(data.length > 0) { + try { + setSimulationResult(SimulationResult.load(SimulatorProtos.SimulationResult.parseFrom(data))); + } catch (InvalidProtocolBufferException e) { + NuclearHorizons.LOG.error("Received invalid simulation result", e); + setSimulationResult(null); + } + } else { + setSimulationResult(null); + } + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + super.writeToNBT(compound); + + compound.setInteger("version", 1); + if(config != null) { + compound.setString("config", configCode); + } + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + super.readFromNBT(compound); + + switch(compound.getInteger("version")) { + case 1: { + setConfigCode(compound.getString("config")); + break; + } + } + } + + private static Widget padding(int width, int height) { + return new TextWidget().setSize(width, height); + } + + @Override + public ModularWindow createWindow(UIBuildContext buildContext) { + ModularWindow.Builder builder = ModularWindow.builder(new Size(212, 234)); + + builder.setBackground(ModularUITextures.VANILLA_BACKGROUND); + + builder.widgets( + new TabContainer() + .setButtonSize(new Size(28, 32)) + .addTabButton( + new TabButton(0) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(0, -28) + ) + .addTabButton( + new TabButton(1) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0, 1f, 0.5f)) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(28, -28) + ) + .addTabButton( + new TabButton(2) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_END.getSubArea(0, 0, 1f, 0.5f)) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_END.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(56, -28) + ) + .addPage(gridPage(buildContext.getPlayer())) + .addPage(resultsPage()) + .addPage(reactorSettingsPage()) + .consume(w -> { + tabContainer = (TabContainer)w; + }) + ); + + builder.widgets( + new FakeSyncWidget.StringSyncer( + () -> this.configCode, + this::setConfigCode + ), + new FakeSyncWidget( + () -> this.latestSimulation, + this::setSimulationResult, + SimulationResult::write, + SimulationResult::read + ) + ); + + return builder.build(); + } + + private Column gridPage(EntityPlayer player) { + return new Column() + .setAlignment(MainAxisAlignment.START, CrossAxisAlignment.CENTER) + .widgets( + padding(7, 7), + new TextWidget(I18n.format("nh_gui.sim.title")).setSize(150, 16), + new Row() + .setAlignment(MainAxisAlignment.CENTER, CrossAxisAlignment.CENTER) + .widgets( + SlotGroup.ofItemHandler(config, COL_COUNT) + .phantom(true) + .applyForWidget(slot -> { + slot.setChangeListener(this::onConfigChanged); + }) + .widgetCreator(slot -> new SimulatorSlotWidget(slot, () -> { + this.activeComponentX = slot.getSlotIndex() % COL_COUNT; + this.activeComponentY = slot.getSlotIndex() / COL_COUNT; + tabContainer.setActivePage(5); + })) + .build() + .consume(w -> { + slots = (SlotGroup)w; + }) + ), + padding(2, 2), + new Row() + .setAlignment(MainAxisAlignment.START, CrossAxisAlignment.CENTER) + .widgets( + new VanillaButtonWidget() + .setDisplayString(I18n.format("nh_gui.sim.actions.start")) + .setOnClick((d, w) -> { + if(NetworkUtils.isClient()) { + simulator.start(config); + } + }) + .setSize(48, 16), + padding(2, 2), + new VanillaButtonWidget() + .setDisplayString(I18n.format("nh_gui.sim.actions.cancel")) + .setOnClick((d, w) -> { + if(NetworkUtils.isClient()) { + simulator.cancel(); + } + }) + .setSize(48, 16) + ), + padding(2, 2), + SlotGroup.playerInventoryGroup(player, null) + ); + } + + private static void addResultLine(ArrayList lines, String name, String unit, Object value) { + var text = I18n.format( + "nh_gui.sim.results." + name, + I18n.format( + value == null + ? "nh_gui.sim.results.none" + : ("nh_gui.sim.results." + unit), + value + ) + ); + + for(var line : text.split("\\n")) { + lines.add(line); + } + } + + private Widget resultsPage() { + return new Column() + .setAlignment(MainAxisAlignment.START, CrossAxisAlignment.CENTER) + .widgets( + padding(7, 7), + new TextWidget(I18n.format("nh_gui.sim.results.title")).setSize(150, 16), + padding(7, 7), + TextWidget + .dynamicString(() -> { + var r = latestSimulation; + + ArrayList lines = new ArrayList<>(); + + if(r == null) { + lines.add(I18n.format("nh_gui.sim.results.no_results")); + } else if(r.timeToExplode == null) { + addResultLine(lines, "runtime", "seconds", r.simTime); + } + + if(r != null) { + if(r.timeToNormal != null) { + addResultLine(lines, "time_to_normal", "seconds", r.timeToNormal); + lines.add(I18n.format("nh_gui.sim.results.time_to_normal", r.timeToNormal)); + } + + if(r.timeToBurn != null) { + addResultLine(lines, "time_to_burn", "seconds", r.timeToBurn); + } + + if(r.timeToEvaporate != null) { + addResultLine(lines, "time_to_evaporate", "seconds", r.timeToEvaporate); + } + + if(r.timeToHurt != null) { + addResultLine(lines, "time_to_hurt", "seconds", r.timeToHurt); + } + + if(r.timeToLava != null) { + addResultLine(lines, "time_to_lava", "seconds", r.timeToLava); + } + + if(r.timeToExplode != null) { + addResultLine(lines, "time_to_explosion", "seconds", r.timeToExplode); + } + } + + addResultLine(lines, "active_time", "seconds", r == null ? null : r.activeTime); + addResultLine(lines, "inactive_time", "seconds", r == null ? null : r.pausedTime); + + addResultLine(lines, "avg_power", "eu_per_tick", r == null ? null : (r.totalEU * 2 / 20 / r.simTime)); + addResultLine(lines, "min_power", "eu_per_tick", r == null ? null : r.minEUpT); + addResultLine(lines, "max_power", "eu_per_tick", r == null ? null : r.maxEUpT); + + addResultLine(lines, "avg_vent_cooling", "hu_per_sec", r == null ? null : (r.totalHU / r.simTime)); + addResultLine(lines, "min_vent_cooling", "hu_per_sec", r == null ? null : r.minHUpS); + addResultLine(lines, "max_vent_cooling", "hu_per_sec", r == null ? null : r.maxHUpS); + + addResultLine(lines, "avg_hull_temp", "hu_total", r == null ? null : (r.totalTempSecs / r.simTime)); + addResultLine(lines, "min_hull_temp", "hu_total", r == null ? null : r.minTemp); + addResultLine(lines, "max_hull_temp", "hu_total", r == null ? null : r.maxTemp); + + return String.join("\n", lines); + }) + .setTextAlignment(Alignment.TopLeft) + ); + } + + private static final AdaptableUITexture DISPLAY = AdaptableUITexture.of("modularui:gui/background/display", 143, 75, 2); + + private Widget textSetting(String name, Supplier getter, Consumer setter) { + return new MultiChildWidget() + .addChild( + new TextWidget(name) + .setTextAlignment(Alignment.CenterRight) + .setPos(-50, 0) + .setSize(150, 16) + ) + .addChild( + new TextFieldWidget() + .setGetter(getter) + .setSetter(v -> { + setter.accept(v); + + this.markDirty(); + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + }) + .setScrollBar() + .setTextColor(Color.WHITE.dark(1)) + .setTextAlignment(Alignment.CenterLeft) + .setBackground(DISPLAY.withOffset(-2, -2, 4, 4)) + .setSize(96, 16) + .setPos(100, 0) + ); + } + + private Widget numericSetting(String name, DoubleSupplier getter, DoubleConsumer setter) { + return new MultiChildWidget() + .addChild( + new TextWidget(name) + .setTextAlignment(Alignment.CenterRight) + .setPos(-50, 0) + .setSize(150, 16) + ) + .addChild( + new NumericWidget() + .setGetter(getter) + .setSetter(v -> { + setter.accept(v); + + this.markDirty(); + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + }) + .setBounds(0, Double.MAX_VALUE) + .setTextColor(Color.WHITE.dark(1)) + .setBackground(DISPLAY.withOffset(-2, -2, 4, 4)) + .setSize(96, 16) + .setPos(100, 0) + ); + } + + private Widget booleanSetting(String name, BooleanSupplier getter, Consumer setter) { + String trueText = I18n.format("nh_gui.sim.settings.true"), falseText = I18n.format("nh_gui.sim.settings.false"); + + return new MultiChildWidget() + .addChild( + new TextWidget(name) + .setTextAlignment(Alignment.CenterRight) + .setPos(-50, 0) + .setSize(150, 16) + ) + .addChild( + new VanillaButtonWidget() + .setDisplayString(getter.getAsBoolean() ? trueText : falseText) + .setOnClick((t, u) -> { + var val = !getter.getAsBoolean(); + setter.accept(val); + + ((VanillaButtonWidget)u).setDisplayString(val ? trueText : falseText); + u.notifyTooltipChange(); + + this.markDirty(); + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + }) + .setTicker(w -> ((VanillaButtonWidget)w).setDisplayString(getter.getAsBoolean() ? trueText : falseText)) + .setSize(40, 16) + .setPos(98, 0) + ); + } + + private Widget reactorSettingsPage() { + return new Row() + .widgets( + padding(7, 7), + new Column() + .setAlignment(MainAxisAlignment.START, CrossAxisAlignment.START) + .widgets( + padding(7, 7), + new Row() + .setAlignment(MainAxisAlignment.CENTER) + .widget( + new TextWidget(I18n.format("nh_gui.sim.settings.title")).setSize(150, 16) + ), + padding(7, 7), + textSetting( + I18n.format("nh_gui.sim.settings.planner_code"), + () -> this.configCode, + this::setConfigCode + ), + padding(7, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.max_simulation_ticks"), + () -> this.config.maxSimulationTicks, + v -> { + this.config.maxSimulationTicks = (int)v; + onConfigChanged(); + } + ), + padding(4, 4), + booleanSetting( + I18n.format("nh_gui.sim.settings.fluid"), + () -> this.config.fluid, + b -> { + this.config.fluid = b; + onConfigChanged(); + } + ), + padding(4, 4), + booleanSetting( + I18n.format("nh_gui.sim.settings.pulsed"), + () -> this.config.pulsed, + b -> { + this.config.pulsed = b; + onConfigChanged(); + } + ), + padding(4, 4), + numericSetting( + I18n.format("nh_gui.sim.settings.on_pulse"), + () -> this.config.onPulse, + v -> { + this.config.onPulse = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.off_pulse"), + () -> this.config.offPulse, + v -> { + this.config.offPulse = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.suspend_temp"), + () -> this.config.suspendTemp, + v -> { + this.config.suspendTemp = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.resume_temp"), + () -> this.config.resumeTemp, + v -> { + this.config.resumeTemp = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.initial_reactor_heat"), + () -> this.config.initialHeat, + v -> { + this.config.initialHeat = (int)v; + onConfigChanged(); + } + ) + ), + padding(7, 7) + ); + } + + private Widget componentAutomationPage() { + return new Row() + .widgets( + padding(7, 7), + new Column() + .setAlignment(MainAxisAlignment.START, CrossAxisAlignment.START) + .widgets( + padding(7, 7), + new Row() + .setAlignment(MainAxisAlignment.CENTER) + .widget( + new TextWidget(I18n.format("nh_gui.sim.comp_settings.title")).setSize(150, 16) + ), + padding(7, 7), + TextWidget + .dynamicString(() -> { + String active = null; + + if(activeComponentX == -1 || activeComponentY == -1) { + active = I18n.format("nh_gui.sim.results.none"); + } else { + var comp = config.components[activeComponentX + activeComponentY * COL_COUNT]; + + active = I18n.format( + "nh_gui.sim.comp_settings.xy", + activeComponentX, + activeComponentY, + comp == null + ? I18n.format("nh_gui.sim.results.none") + : I18n.format(comp.item.getUnlocalizedName()) + ); + } + + return I18n.format("nh_gui.sim.comp_settings.active", active); + }), + textSetting( + I18n.format("nh_gui.sim.settings.planner_code"), + () -> this.configCode, + this::setConfigCode + ), + padding(7, 7), + numericSetting( + I18n.format("nh_gui.sim.settings.max_simulation_ticks"), + () -> this.config.maxSimulationTicks, + v -> { + this.config.maxSimulationTicks = (int)v; + onConfigChanged(); + } + ), + padding(4, 4), + booleanSetting( + I18n.format("nh_gui.sim.settings.fluid"), + () -> this.config.fluid, + b -> { + this.config.fluid = b; + onConfigChanged(); + } + ), + padding(4, 4), + booleanSetting( + I18n.format("nh_gui.sim.settings.pulsed"), + () -> this.config.pulsed, + b -> { + this.config.pulsed = b; + onConfigChanged(); + } + ), + padding(4, 4), + numericSetting( + I18n.format("nh_gui.sim.settings.on_pulse"), + () -> this.config.onPulse, + v -> { + this.config.onPulse = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.off_pulse"), + () -> this.config.offPulse, + v -> { + this.config.offPulse = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.suspend_temp"), + () -> this.config.suspendTemp, + v -> { + this.config.suspendTemp = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.resume_temp"), + () -> this.config.resumeTemp, + v -> { + this.config.resumeTemp = (int)v; + onConfigChanged(); + } + ), + padding(4, 6), + numericSetting( + I18n.format("nh_gui.sim.settings.initial_reactor_heat"), + () -> this.config.initialHeat, + v -> { + this.config.initialHeat = (int)v; + onConfigChanged(); + } + ) + ), + padding(7, 7) + ); + } + + private static class SimulatorSlotWidget extends SlotWidget { + private Runnable onRightClicked; + + public SimulatorSlotWidget(BaseSlot slot, @NotNull Runnable onRightClicked) { + super(slot); + this.onRightClicked = onRightClicked; + } + + public java.util.List getExtraTooltip() { + var tooltip = (ArrayList)super.getExtraTooltip(); + + tooltip.add(EnumChatFormatting.DARK_GRAY.toString() + I18n.format("nh_gui.sim.actions.edit_comp_automation")); + + return tooltip; + } + + public ClickResult onClick(int button, boolean doubleClick) { + if(button == 1) { + Widget.ClickData clickData = ClickData.create(button, doubleClick); + this.syncToServer(6, clickData::writeToPacket); + return ClickResult.SUCCESS; + } else { + return super.onClick(button, doubleClick); + } + } + + public void readOnServer(int id, PacketBuffer buf) throws IOException { + if(id == 6) { + if(this.onRightClicked != null) this.onRightClicked.run(); + + this.markForUpdate(); + } else { + super.readOnServer(id, buf); + } + } + } + + private static class MessageChannel extends SyncedWidget { + + private @Nullable Class from_server; + private @Nullable Consumer handle_on_client; + private @Nullable Class from_client; + private @Nullable Consumer handle_on_server; + + public MessageChannel( + @Nullable Class from_server, + @Nullable Consumer handle_on_client, + @Nullable Class from_client, + @Nullable Consumer handle_on_server + ) { + this.from_server = from_server; + this.handle_on_client = handle_on_client; + this.from_client = from_client; + this.handle_on_server = handle_on_server; + } + + @Override + public void readOnClient(int arg0, PacketBuffer arg1) throws IOException { + if(from_server != null && handle_on_client != null) { + FromServer message; + + try { + message = from_server.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException("Could not create instance of FromServer message; type must have a public no-argument constructor", e); + } + + message.fromBytes(arg1); + + handle_on_client.accept(message); + } + } + + @Override + public void readOnServer(int arg0, PacketBuffer arg1) throws IOException { + if(from_client != null && handle_on_server != null) { + FromClient message; + + try { + message = from_client.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException("Could not create instance of FromClient message; type must have a public no-argument constructor", e); + } + + message.fromBytes(arg1); + + handle_on_server.accept(message); + } + } + + public void sendToClient(@NotNull FromServer message) { + if(NetworkUtils.isClient()) { + throw new IllegalStateException("cannot call sendToClient() on the client"); + } + + this.syncToClient(0, buf -> { + message.toBytes(buf); + }); + } + + public void sendToServer(@NotNull FromClient message) { + if(!NetworkUtils.isClient()) { + throw new IllegalStateException("cannot call sendToServer() on the server"); + } + + this.syncToServer(0, buf -> { + message.toBytes(buf); + }); + } + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/BigintStorage.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/BigintStorage.java new file mode 100644 index 0000000..b7b032f --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/BigintStorage.java @@ -0,0 +1,68 @@ +/** + * Originally from the Ic2 Reactor Planner at https://github.com/GTNewHorizons/Ic2ExpReactorPlanner + */ + +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +import java.math.BigInteger; +import java.util.Base64; + +/** + * Stores numbers of varying size inside a BigInteger, expecting each to have + * a defined limit (which need not be an exact power of 2). Numbers are to be + * extracted in reverse order they were stored, and special values can be used + * to make certain values optional for inclusion (the calling class is + * responsible for handling this logic, though). + * @author Brian McCloud + */ +public class BigintStorage { + private BigInteger storedValue = BigInteger.ZERO; + + /** + * Stores the specified value. Requires that 0 <= value <= max. + * @param value the value to store. + * @param max the expected maximum for the value. + */ + public void store(int value, int max) { + if (value < 0 || value > max) { + throw new IllegalArgumentException(); + } + storedValue = storedValue.multiply(BigInteger.valueOf(max + 1)).add(BigInteger.valueOf(value)); + } + + /** + * Extracts a value based on the specified maximum. + * @param max the expected maximum for the value. + * @return the extracted value. + */ + public int extract(int max) { + BigInteger[] values = storedValue.divideAndRemainder(BigInteger.valueOf(max + 1)); + storedValue = values[0]; + return values[1].intValue(); + } + + /** + * Takes input of a Base64 string, and converts it to a BigintStorage. + * @param code the Base64-encoded string (presumed to be from @outputBase64) + * @return the converted storage object. + */ + public static BigintStorage inputBase64(String code) { + BigintStorage result = new BigintStorage(); + byte[] temp = Base64.getDecoder().decode(code); + result.storedValue = new BigInteger(temp); + return result; + } + + /** + * Outputs the current value of this BigintStorage as a Base64-encoded string. + * @return the Base64-encoded string. + */ + public String outputBase64() { + byte[] temp = storedValue.toByteArray(); + return Base64.getEncoder().encodeToString(temp); + } + + public boolean isEmpty() { + return storedValue.equals(BigInteger.ZERO); + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationComponentResult.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationComponentResult.java new file mode 100644 index 0000000..ba58f90 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationComponentResult.java @@ -0,0 +1,18 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +public class SimulationComponentResult { + public long + totalAirHeating, + totalHullHeating, + totalHullCooling, + totalTempSecs, + totalEUOutput; + + public Long + maxAirHeating, + maxHullCooling; + + public int + minTemp = Integer.MAX_VALUE, maxTemp, + replaceCount; +} \ No newline at end of file diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfig.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfig.java new file mode 100644 index 0000000..4452213 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfig.java @@ -0,0 +1,517 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.jetbrains.annotations.NotNull; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.recursive_pineapple.nuclear_horizons.NuclearHorizons; +import com.recursive_pineapple.nuclear_horizons.reactors.components.ComponentRegistry; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorCore; + +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class SimulationConfig implements IItemHandlerModifiable { + + public boolean + pulsed = false, + automated = true, + fluid = false, + usingReactorCoolantInjectors; + + public int + initialHeat = 0, + onPulse = 0, + offPulse = 0, + suspendTemp = 100_000, + resumeTemp = 100_000, + maxSimulationTicks = 1_000_000; + + public SimComponentConfig[] components = new SimComponentConfig[TileReactorCore.COL_COUNT * TileReactorCore.ROW_COUNT]; + + @Nullable + public transient SimulationResult result; + + public SimulationConfig() { + + } + + public String getCode() { + BigintStorage storage = new BigintStorage(); + + storage.store(maxSimulationTicks, 5000000); + storage.store(usingReactorCoolantInjectors ? 1 : 0, 1); + storage.store(fluid ? 1 : 0, 1); + + if(pulsed) { + storage.store(resumeTemp, 120000); + storage.store(suspendTemp, 120000); + storage.store(offPulse, 5000000); + storage.store(onPulse, 5000000); + } + + storage.store(initialHeat, 120000); + + final int maxComponentHeat = 1000000000; + + for(int i = components.length - 1; i >= 0; i--) { + var c = components[i]; + + if(c == null) { + storage.store(0, 72); + continue; + } + + Integer componentId = SimulationItems.getSimulationItemId(c.item); + + if(componentId == null) { + storage.store(0, 72); + NuclearHorizons.LOG.warn("Could not save reactor item " + c.item + " into config code because it does not have a simulation item ID"); + continue; + } + + if(componentId > 72) { + storage.store(0, 72); + NuclearHorizons.LOG.warn("Could not save reactor item " + c.item + " into config code because its simulation item ID was greater than 72"); + continue; + } + + if(c.hasAutomation) { + if(automated) { + storage.store(c.reactorPause, 10000); + storage.store(c.replacementThreshold, maxComponentHeat); + } + + storage.store(c.initialHeat, maxComponentHeat); + } + + storage.store(c.hasAutomation ? 1 : 0, 1); + storage.store(componentId, 72); + } + + storage.store(automated ? 1 : 0, 1); + storage.store(pulsed ? 1 : 0, 1); + + storage.store(4, 255); + + return "erp=" + storage.outputBase64(); + } + + public static SimulationConfig fromCode(String code) { + SimulationConfig config = new SimulationConfig(); + + if(code == null || code.isEmpty()) { + return config; + } + + if(code.startsWith("erp=")) { + code = code.substring(4); + } + + BigintStorage storage = null; + try { + storage = BigintStorage.inputBase64(code); + } catch(Throwable t) { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.RED.toString() + EnumChatFormatting.ITALIC.toString() + + "Could not load invalid reactor code." + ) + ); + NuclearHorizons.LOG.error("Could not parse reactor code into BigInteger", t); + return new SimulationConfig(); + } + + int revision = storage.extract(255); + + if(revision < 0 || revision > 4) { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.RED.toString() + EnumChatFormatting.ITALIC.toString() + + "Could not load invalid reactor code." + ) + ); + NuclearHorizons.LOG.error("Reactor code had incorrect revision (was " + revision + ", should be 4 >= x >= 0)"); + return new SimulationConfig(); + } + + if(revision >= 1) { + config.pulsed = storage.extract(1) > 0; + config.automated = storage.extract(1) > 0; + } + + int maxComponentHeat = switch(revision) { + case 4 -> 1000000000; + case 3 -> 1080000; + default -> 360000; + }; + + for(int row = 0; row < TileReactorCore.ROW_COUNT; row++) { + for(int col = 0; col < TileReactorCore.COL_COUNT; col++) { + int componentId = switch(revision) { + case 0, 1 -> storage.extract(38); + case 2 -> storage.extract(44); + case 3 -> storage.extract(58); + default -> storage.extract(72); + }; + + if(componentId != 0) { + var compConfig = new SimComponentConfig(); + compConfig.hasAutomation = storage.extract(1) > 0; + + if(compConfig.hasAutomation) { + compConfig.initialHeat = storage.extract(maxComponentHeat); + + if(revision == 0 || (revision >= 1 && config.automated)) { + compConfig.replacementThreshold = storage.extract(maxComponentHeat); + compConfig.reactorPause = storage.extract(10000); + } + } + + compConfig.item = SimulationItems.getSimulationItem(componentId); + + if(compConfig.item == null) { + NuclearHorizons.LOG.warn("Could not find simulation item with component id " + componentId); + continue; + } + + config.components[row * TileReactorCore.COL_COUNT + col] = compConfig; + } + } + } + + config.initialHeat = storage.extract(120000); + + if(revision == 0 || (revision >= 1 && config.pulsed)) { + config.onPulse = storage.extract(5000000); + config.offPulse = storage.extract(5000000); + config.suspendTemp = storage.extract(120000); + config.resumeTemp = storage.extract(120000); + } + + config.fluid = storage.extract(1) > 0; + config.usingReactorCoolantInjectors = storage.extract(1) > 0; + + if(revision == 0) { + config.pulsed = storage.extract(1) > 0; + config.automated = storage.extract(1) > 0; + } + + config.maxSimulationTicks = storage.extract(5000000); + + if(!storage.isEmpty()) { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.RED.toString() + EnumChatFormatting.ITALIC.toString() + + "Could not load invalid reactor code." + ) + ); + NuclearHorizons.LOG.error("Reactor code had left over data after reading all fields: assuming something has gone wrong."); + return new SimulationConfig(); + } + + return config; + } + + public static @Nonnull SimulationConfig read(ByteBuf buffer) { + byte[] data = new byte[buffer.readInt()]; + + if(data.length == 0) { + return new SimulationConfig(); + } + + buffer.readBytes(data); + + try { + return SimulationConfig.load(SimulatorProtos.SimulationConfig.parseFrom(data)); + } catch (InvalidProtocolBufferException e) { + NuclearHorizons.LOG.error("Could not read data for SimulationConfig", e); + return new SimulationConfig(); + } + } + + public static void write(ByteBuf buffer, SimulationConfig result) { + if(result == null) { + buffer.writeInt(0); + } else { + var data = result.save().toByteArray(); + buffer.writeInt(data.length); + buffer.writeBytes(data); + } + } + + public SimulatorProtos.SimulationConfig save() { + return SimulatorProtos.SimulationConfig.newBuilder() + .setPulsed(pulsed) + .setAutomated(automated) + .setFluid(fluid) + .setInitialHeat(initialHeat) + .setOnPulse(onPulse) + .setOffPulse(offPulse) + .setSuspendTemp(suspendTemp) + .setResumeTemp(resumeTemp) + .setMaxSimulationTicks(maxSimulationTicks) + .addAllComponents( + IntStream.range(0, components.length) + .mapToObj(i -> { + var c = components[i]; + + if(c == null) { + return null; + } + + Integer id = SimulationItems.getSimulationItemId(c.item); + + if(id == null) { + return null; + } else { + return SimulatorProtos.ComponentConfig.newBuilder() + .setIndex(i) + .setItem(id) + .setHasAutomation(c.hasAutomation) + .setInitialHeat(c.initialHeat) + .setReplacementThreshold(c.replacementThreshold) + .setReactorPause(c.reactorPause) + .build(); + } + }) + .filter(i -> i != null) + .collect(Collectors.toList()) + ) + .build(); + } + + public static SimulationConfig load(SimulatorProtos.SimulationConfig data) { + SimulationConfig config = new SimulationConfig(); + + config.pulsed = data.getPulsed(); + config.automated = data.getAutomated(); + config.fluid = data.getFluid(); + config.initialHeat = data.getInitialHeat(); + config.onPulse = data.getOnPulse(); + config.offPulse = data.getOffPulse(); + config.suspendTemp = data.getSuspendTemp(); + config.resumeTemp = data.getResumeTemp(); + config.maxSimulationTicks = data.getMaxSimulationTicks(); + + for(int i = 0; i < data.getComponentsCount(); i++) { + var c = data.getComponents(i); + + var comp = new SimComponentConfig(); + + comp.item = SimulationItems.getSimulationItem(c.getItem()); + + if(comp.item == null) { + config.components[c.getIndex()] = null; + continue; + } + + comp.hasAutomation = c.getHasAutomation(); + comp.initialHeat = c.getInitialHeat(); + comp.replacementThreshold = c.getReplacementThreshold(); + comp.reactorPause = c.getReactorPause(); + + config.components[c.getIndex()] = comp; + } + + return config; + } + + public void put(@NotNull SimulationConfig source) { + this.pulsed = source.pulsed; + this.automated = source.automated; + this.fluid = source.fluid; + this.initialHeat = source.initialHeat; + this.onPulse = source.onPulse; + this.offPulse = source.offPulse; + this.suspendTemp = source.suspendTemp; + this.resumeTemp = source.resumeTemp; + this.maxSimulationTicks = source.maxSimulationTicks; + + for(int i = 0; i < source.components.length; i++) { + this.components[i] = null; + + var c = source.components[i]; + + if(c != null) { + var dest = new SimComponentConfig(); + + dest.item = c.item; + dest.hasAutomation = c.hasAutomation; + dest.initialHeat = c.initialHeat; + dest.replacementThreshold = c.replacementThreshold; + dest.reactorPause = c.reactorPause; + + this.components[i] = dest; + } + } + } + + @Override + @Nullable + public ItemStack extractItem(int slot, int amount, boolean simulate) { + var item = components[slot]; + + if(item == null || amount < 1) { + return null; + } + + if(!simulate) { + components[slot] = null; + } + + return withResults(new ItemStack(item.item), slot); + } + + @Override + public int getSlotLimit(int slot) { + return 1; + } + + @Override + public int getSlots() { + return components.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return extractItem(slot, 1, true); + } + + @Override + @Nullable + public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { + if(components[slot] != null || stack == null || !ComponentRegistry.isReactorItem(stack)) { + return stack; + } + + var result = stack.copy(); + var stored = result.splitStack(1); + + if(!simulate) { + setStackInSlot(slot, stored); + } + + if(result.stackSize <= 0) { + return null; + } else { + return result; + } + } + + @Override + public void setStackInSlot(int slot, ItemStack stack) { + if(stack == null || !ComponentRegistry.isReactorItem(stack)) { + components[slot] = null; + } else { + var config = new SimComponentConfig(); + config.item = stack.getItem(); + + components[slot] = config; + } + } + + private static void addResultLine(NBTTagList lines, String name, String unit, Object value) { + var text = I18n.format( + "nh_tooltip.sim.results." + name, + unit != null + ? I18n.format( + value == null ? "nh_gui.sim.results.none" : ("nh_gui.sim.results." + unit), + value + ) + : value + ); + + for(var line : text.split("\\n")) { + lines.appendTag(new NBTTagString(EnumChatFormatting.RESET.toString() + EnumChatFormatting.BLUE.toString() + line)); + } + } + + private ItemStack withResults(ItemStack itemStack, int slot) { + boolean hasResults = false; + String format = EnumChatFormatting.RESET.toString() + EnumChatFormatting.BLUE.toString(); + + var res = result; + + if(res != null) { + var r = res.componentResults[slot]; + + if(r != null) { + var lore = new NBTTagList(); + + lore.appendTag(new NBTTagString("")); + + lore.appendTag(new NBTTagString(format + I18n.format("nh_tooltip.results.title"))); + + if(r.totalTempSecs > 0) { + addResultLine(lore, "avg_temp", "hu_total", r.totalTempSecs / res.simTime); + addResultLine(lore, "min_temp", "hu_total", r.minTemp); + addResultLine(lore, "max_temp", "hu_total", r.maxTemp); + } + + if(r.totalHullCooling > 0) { + addResultLine(lore, "avg_hull_cooling", "hu_per_second", r.totalHullCooling / res.simTime); + } + + if(r.totalHullHeating > 0) { + addResultLine(lore, "avg_hull_heating", "hu_per_second", r.totalHullHeating / res.simTime); + addResultLine(lore, "heating_per_item", "hu_total", r.totalHullHeating / (r.replaceCount + 1)); + } + + if(r.totalAirHeating != 0) { + addResultLine(lore, "avg_heat_output", "hu_total", r.totalAirHeating / res.simTime); + } + + addResultLine(lore, "replace_count", null, r.replaceCount); + + if(r.totalEUOutput > 0) { + addResultLine(lore, "avg_power", "eu_per_tick", r.totalEUOutput * 2 / 20 / res.simTime); + addResultLine(lore, "power_per_item", "eu_total", r.totalEUOutput / (r.replaceCount + 1)); + } + + lore.appendTag(new NBTTagString("")); + + var display = new NBTTagCompound(); + display.setTag("Lore", lore); + itemStack.setTagInfo("display", display); + hasResults = true; + } + } + + if(!hasResults) { + var lore = new NBTTagList(); + + lore.appendTag(new NBTTagString("")); + lore.appendTag(new NBTTagString(format + "No simulation results available.")); + lore.appendTag(new NBTTagString("")); + + var display = new NBTTagCompound(); + display.setTag("Lore", lore); + itemStack.setTagInfo("display", display); + } + + return itemStack; + } + + public static class SimComponentConfig { + public Item item; + public boolean hasAutomation; + public int initialHeat; + public int replacementThreshold; + public int reactorPause; + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfigProto.proto b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfigProto.proto new file mode 100755 index 0000000..e553c1e --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfigProto.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +option java_package = "com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator"; +option java_outer_classname = "SimulatorProtos"; + +message SimulationConfig { + bool pulsed = 1; + bool automated = 2; + bool fluid = 3; + int32 initialHeat = 4; + int32 onPulse = 5; + int32 offPulse = 6; + int32 suspendTemp = 7; + int32 resumeTemp = 8; + int32 maxSimulationTicks = 9; + repeated ComponentConfig components = 10; +} + +message ComponentConfig { + int32 index = 1; + int32 item = 2; + bool hasAutomation = 3; + int32 initialHeat = 4; + int32 replacementThreshold = 5; + int32 reactorPause = 6; +} + +message SimulationResult { + int64 start = 1; + int64 end = 2; + int64 totalEU = 3; + int32 minEUpT = 4; + int32 maxEUpT = 5; + int64 totalHU = 6; + int32 minHUpS = 7; + int32 maxHUpS = 8; + int64 totalTempSecs = 9; + int32 minTemp = 10; + int32 maxTemp = 11; + int64 totalHullHeating = 12; + int64 totalHullCooling = 13; + int32 simTime = 14; + int32 activeTime = 15; + int32 pausedTime = 16; + optional int32 timeToNormal = 17; + optional int32 timeToBurn = 18; + optional int32 timeToEvaporate = 19; + optional int32 timeToHurt = 20; + optional int32 timeToLava = 21; + optional int32 timeToExplode = 22; + repeated ComponentResult components = 23; +} + +message ComponentResult { + int32 index = 1; + int64 totalAirHeating = 2; + int64 totalHullHeating = 3; + int64 totalHullCooling = 4; + int64 totalTempSecs = 5; + int32 minTemp = 6; + int32 maxTemp = 7; + int32 replaceCount = 8; + int64 totalEUOutput = 9; +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationItems.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationItems.java new file mode 100644 index 0000000..4bf0b00 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationItems.java @@ -0,0 +1,57 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +import java.util.HashMap; + +import javax.annotation.Nullable; + +import com.recursive_pineapple.nuclear_horizons.reactors.items.ItemList; + +import net.minecraft.item.Item; + +public class SimulationItems { + + private static final HashMap reactorItemsById = new HashMap<>(); + private static final HashMap reactorItemsByItem = new HashMap<>(); + + public static void registerSimulationItem(int id, Item item) { + reactorItemsById.put(id, item); + reactorItemsByItem.put(item, id); + } + + public static @Nullable Item getSimulationItem(int id) { + return reactorItemsById.get(id); + } + + public static @Nullable Integer getSimulationItemId(Item item) { + return reactorItemsByItem.get(item); + } + + public static void init() { + registerSimulationItem(1, ItemList.URANIUM_1X_ROD); + registerSimulationItem(2, ItemList.URANIUM_2X_ROD); + registerSimulationItem(3, ItemList.URANIUM_4X_ROD); + registerSimulationItem(7, ItemList.NEUTRON_REFLECTOR); + registerSimulationItem(8, ItemList.THICK_NEUTRON_REFLECTOR); + registerSimulationItem(9, ItemList.BASIC_HEAT_VENT); + registerSimulationItem(10, ItemList.ADVANCED_HEAT_VENT); + registerSimulationItem(11, ItemList.REACTOR_HEAT_VENT); + registerSimulationItem(12, ItemList.COMPONENT_HEAT_VENT); + registerSimulationItem(13, ItemList.OVERCLOCKED_HEAT_VENT); + registerSimulationItem(14, ItemList.COOLANT_CELL_10k); + registerSimulationItem(15, ItemList.COOLANT_CELL_30k); + registerSimulationItem(16, ItemList.COOLANT_CELL_60k); + registerSimulationItem(17, ItemList.BASIC_HEAT_EXCHANGER); + registerSimulationItem(18, ItemList.ADVANCED_HEAT_EXCHANGER); + registerSimulationItem(19, ItemList.REACTOR_HEAT_EXCHANGER); + registerSimulationItem(20, ItemList.COMPONENT_HEAT_EXCHANGER); + // registerSimulationItem(21, ItemList.); + // registerSimulationItem(22, ItemList.); + // registerSimulationItem(23, ItemList.); + registerSimulationItem(24, ItemList.RSH_CONDENSATOR); + registerSimulationItem(25, ItemList.LZH_CONDENSATOR); + // registerSimulationItem(26, ItemList.); + // registerSimulationItem(27, ItemList.); + // registerSimulationItem(28, ItemList.); + registerSimulationItem(35, ItemList.IRIDIUM_NEUTRON_REFLECTOR); + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationResult.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationResult.java new file mode 100644 index 0000000..8e20ad3 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationResult.java @@ -0,0 +1,175 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import javax.annotation.Nullable; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.recursive_pineapple.nuclear_horizons.NuclearHorizons; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorCore; + +import io.netty.buffer.ByteBuf; + +public class SimulationResult { + public SimulationConfig config; + + public long + start = System.nanoTime(), + end = System.nanoTime(), + totalEU, + totalHU, + totalTempSecs, + totalHullHeating, + totalHullCooling; + + public Long + maxHullCooling; + + public int + minEUpT = Integer.MAX_VALUE, maxEUpT, + minHUpS = Integer.MAX_VALUE, maxHUpS, + minTemp = Integer.MAX_VALUE, maxTemp, + simTime, activeTime, pausedTime; + + public Integer + timeToNormal, + timeToBurn, + timeToEvaporate, + timeToHurt, + timeToLava, + timeToExplode; + + public SimulationComponentResult[] componentResults = new SimulationComponentResult[TileReactorCore.COL_COUNT * TileReactorCore.ROW_COUNT]; + + public static @Nullable SimulationResult read(ByteBuf buffer) { + byte[] data = new byte[buffer.readInt()]; + + if(data.length == 0) { + return null; + } + + buffer.readBytes(data); + + try { + return SimulationResult.load(SimulatorProtos.SimulationResult.parseFrom(data)); + } catch (InvalidProtocolBufferException e) { + NuclearHorizons.LOG.error("Could not read data for SimulationResult", e); + return null; + } + } + + public static void write(ByteBuf buffer, SimulationResult result) { + if(result == null) { + buffer.writeInt(0); + } else { + var data = result.save().toByteArray(); + buffer.writeInt(data.length); + buffer.writeBytes(data); + } + } + + public SimulatorProtos.SimulationResult save() { + var builder = SimulatorProtos.SimulationResult.newBuilder() + .setStart(start) + .setEnd(end) + .setTotalEU(totalEU) + .setMinEUpT(minEUpT) + .setMaxEUpT(maxEUpT) + .setTotalHU(totalHU) + .setMinHUpS(minHUpS) + .setMaxHUpS(maxHUpS) + .setTotalTempSecs(totalTempSecs) + .setMinTemp(minTemp) + .setMaxTemp(maxTemp) + .setTotalHullHeating(totalHullHeating) + .setTotalHullCooling(totalHullCooling) + .setSimTime(simTime) + .setActiveTime(activeTime) + .setPausedTime(pausedTime) + .addAllComponents( + IntStream.range(0, componentResults.length) + .mapToObj(i -> { + var c = componentResults[i]; + + if(c == null) { + return null; + } else { + return SimulatorProtos.ComponentResult.newBuilder() + .setIndex(i) + .setTotalAirHeating(c.totalAirHeating) + .setTotalHullHeating(c.totalHullHeating) + .setTotalHullCooling(c.totalHullCooling) + .setTotalTempSecs(c.totalTempSecs) + .setTotalEUOutput(c.totalEUOutput) + .setMinTemp(c.minTemp) + .setMaxTemp(c.maxTemp) + .setReplaceCount(c.replaceCount) + .build(); + } + }) + .filter(i -> i != null) + .collect(Collectors.toList()) + ); + + if(timeToNormal != null) builder.setTimeToNormal(timeToNormal); + if(timeToBurn != null) builder.setTimeToBurn(timeToBurn); + if(timeToEvaporate != null) builder.setTimeToEvaporate(timeToEvaporate); + if(timeToHurt != null) builder.setTimeToHurt(timeToHurt); + if(timeToLava != null) builder.setTimeToLava(timeToLava); + if(timeToExplode != null) builder.setTimeToExplode(timeToExplode); + + return builder.build(); + } + + public static SimulationResult load(SimulatorProtos.SimulationResult data) { + SimulationResult result = new SimulationResult(); + + result.start = data.getStart(); + result.end = data.getEnd(); + result.totalEU = data.getTotalEU(); + result.minEUpT = data.getMinEUpT(); + result.maxEUpT = data.getMaxEUpT(); + result.totalHU = data.getTotalHU(); + result.minHUpS = data.getMinHUpS(); + result.maxHUpS = data.getMaxHUpS(); + result.totalTempSecs = data.getTotalTempSecs(); + result.minTemp = data.getMinTemp(); + result.maxTemp = data.getMaxTemp(); + result.totalHullHeating = data.getTotalHullHeating(); + result.totalHullCooling = data.getTotalHullCooling(); + result.simTime = data.getSimTime(); + result.activeTime = data.getActiveTime(); + result.pausedTime = data.getPausedTime(); + + for(int i = 0; i < data.getComponentsCount(); i++) { + var c = data.getComponents(i); + + var comp = new SimulationComponentResult(); + + comp.totalAirHeating = c.getTotalAirHeating(); + comp.totalHullHeating = c.getTotalHullHeating(); + comp.totalHullCooling = c.getTotalHullCooling(); + comp.totalTempSecs = c.getTotalTempSecs(); + comp.totalEUOutput = c.getTotalEUOutput(); + comp.minTemp = c.getMinTemp(); + comp.maxTemp = c.getMaxTemp(); + comp.replaceCount = c.getReplaceCount(); + + result.componentResults[c.getIndex()] = comp; + } + + if(data.hasTimeToNormal()) result.timeToNormal = data.getTimeToNormal(); + if(data.hasTimeToBurn()) result.timeToBurn = data.getTimeToBurn(); + if(data.hasTimeToEvaporate()) result.timeToEvaporate = data.getTimeToEvaporate(); + if(data.hasTimeToHurt()) result.timeToHurt = data.getTimeToHurt(); + if(data.hasTimeToLava()) result.timeToLava = data.getTimeToLava(); + if(data.hasTimeToExplode()) result.timeToExplode = data.getTimeToExplode(); + + return result; + } + + public double duration() { + return (end - start) / 1e9d; + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/Simulator.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/Simulator.java new file mode 100644 index 0000000..1823146 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/Simulator.java @@ -0,0 +1,446 @@ +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +import java.util.Arrays; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import javax.annotation.Nullable; + +import com.recursive_pineapple.nuclear_horizons.NuclearHorizons; +import com.recursive_pineapple.nuclear_horizons.networking.PacketDispatcher; +import com.recursive_pineapple.nuclear_horizons.networking.PacketDispatcher.ReactorSimulationFinishedMessage; +import com.recursive_pineapple.nuclear_horizons.reactors.components.ComponentRegistry; +import com.recursive_pineapple.nuclear_horizons.reactors.components.IComponentAdapter; +import com.recursive_pineapple.nuclear_horizons.reactors.components.IReactorGrid; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorCore; +import com.recursive_pineapple.nuclear_horizons.reactors.tile.TileReactorSimulator; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class Simulator { + + private final TileReactorSimulator parent; + private final ExecutorService thread_pool = Executors.newFixedThreadPool(1); + + private Future simulation; + + public Simulator(TileReactorSimulator parent) { + this.parent = parent; + } + + public boolean isRunning() { + return simulation != null && !simulation.isDone(); + } + + public void start(SimulationConfig config) { + if(simulation != null) { + simulation.cancel(true); + } + + simulation = thread_pool.submit(() -> runSimulation(config)); + } + + public void cancel() { + simulation.cancel(true); + simulation = null; + } + + private SimulationResult runSimulation(SimulationConfig config) { + SimulatedReactor reactor = new SimulatedReactor(); + reactor.config = config; + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.GRAY.toString() + EnumChatFormatting.ITALIC.toString() + + "Started reactor simulation." + ) + ); + + reactor.run(); + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.GRAY.toString() + EnumChatFormatting.ITALIC.toString() + + "Reactor simulation finished after " + + String.format("%.3f seconds.", reactor.result.duration()) + ) + ); + + reactor.result.config = config; + return reactor.result; + } + + public void pollFinished() { + if(simulation != null && simulation.isDone()) { + try { + var result = simulation.get(0l, TimeUnit.NANOSECONDS); + simulation = null; + + var msg = new ReactorSimulationFinishedMessage(); + + msg.dimensionId = parent.getWorldObj().provider.dimensionId; + msg.x = parent.xCoord; + msg.y = parent.yCoord; + msg.z = parent.zCoord; + msg.result = result; + + NuclearHorizons.LOG.info(String.format("Simulation finished after %.3fs (%.3fns per tick)", result.duration(), (result.duration() * 1e9d / result.simTime))); + PacketDispatcher.DISPATCHER.sendToServer(msg); + } catch (InterruptedException | CancellationException | ExecutionException e) { + NuclearHorizons.LOG.warn("Simulation did not finish", e); + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage( + new ChatComponentText( + EnumChatFormatting.RED + + "Simulation crashed, check the server logs for more details. (" + + e.getClass().getName() + + ")" + ) + ); + + simulation = null; + } catch (TimeoutException e) { + // do nothing + } + } + } + + private static class SimulatedReactor implements IReactorGrid { + + private static final int COL_COUNT = TileReactorCore.COL_COUNT; + private static final int ROW_COUNT = TileReactorCore.ROW_COUNT; + + public ItemStack[] contents = new ItemStack[COL_COUNT * ROW_COUNT]; + public IComponentAdapter[] components = new IComponentAdapter[COL_COUNT * ROW_COUNT]; + + public int reactorTickCounter = 0, storedHeat, addedHU, pulseCounter; + public boolean pulseActive, suspended; + public double addedEU; + public Integer nextUnpause; + + public SimulationConfig config; + + public SimulationResult result = new SimulationResult(); + public SimulationComponentResult[] componentResults = new SimulationComponentResult[COL_COUNT * ROW_COUNT]; + public SimulationComponentResult currentComponent; + + @Override + public int getWidth() { + return COL_COUNT; + } + + @Override + public int getHeight() { + return ROW_COUNT; + } + + @Override + public @Nullable IComponentAdapter getComponent(int x, int y) { + if(x < 0 || x >= COL_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for x: %d, must conform to x >= 0, x < %d", x, COL_COUNT)); + } + + if(y < 0 || y >= ROW_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for y: %d, must conform to y >= 0, y < %d", y, ROW_COUNT)); + } + + int index = y * COL_COUNT + x; + + var adapter = this.components[index]; + if(adapter != null) { + return adapter; + } + + var item = this.contents[index]; + if(item != null) { + adapter = ComponentRegistry.getAdapter(item, this, x, y); + this.components[index] = adapter; + } + + return adapter; + } + + @Override + public @Nullable ItemStack getItem(int x, int y) { + if(x < 0 || x >= COL_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for x: %d, must conform to x >= 0, x < %d", x, COL_COUNT)); + } + + if(y < 0 || y >= ROW_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for y: %d, must conform to y >= 0, y < %d", y, ROW_COUNT)); + } + + int index = y * COL_COUNT + x; + + return this.contents[index]; + } + + @Override + public void setItem(int x, int y, @Nullable ItemStack item) { + if(x < 0 || x >= COL_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for x: %d, must conform to x >= 0, x < %d", x, COL_COUNT)); + } + + if(y < 0 || y >= ROW_COUNT) { + throw new IllegalArgumentException(String.format("Illegal value for y: %d, must conform to y >= 0, y < %d", y, ROW_COUNT)); + } + + int index = y * COL_COUNT + x; + + this.contents[index] = item; + this.components[index] = item != null && ComponentRegistry.isReactorItem(item) + ? ComponentRegistry.getAdapter(item, this, x, y) + : null; + } + + @Override + public boolean isActive() { + if(suspended) { + return false; + } + + if(nextUnpause != null && reactorTickCounter < nextUnpause) { + return false; + } + + if(config.pulsed) { + return pulseActive; + } + + return true; + } + + @Override + public int getHullHeat() { + return storedHeat; + } + + @Override + public int getMaxHullHeat() { + int maxHeat = 5000; + + for(int row = 0; row < ROW_COUNT; row++) { + for(int col = 0; col < COL_COUNT; col++) { + var component = getComponent(col, row); + if(component != null) { + maxHeat += component.getReactorMaxHeatIncrease(); + } + } + } + + return maxHeat; + } + + @Override + public void setHullHeat(int newHeat) { + this.storedHeat = newHeat; + } + + @Override + public void addHullHeat(int delta) { + this.storedHeat += delta; + + if(delta > 0) { + currentComponent.totalHullHeating += delta; + } else { + currentComponent.totalHullCooling += -delta; + } + } + + @Override + public int addAirHeat(int delta) { + result.totalHU += delta * 2; + addedHU += delta * 2; + currentComponent.totalAirHeating += delta * 2; + + return 0; + } + + @Override + public void addEU(double eu) { + result.totalEU += eu; + currentComponent.totalEUOutput += eu; + addedEU += eu; + } + + @Override + public boolean isFluid() { + return config.fluid; + } + + public void run() { + this.reactorTickCounter = 0; + + Arrays.fill(components, null); + Arrays.fill(contents, null); + + for(int i = 0; i < components.length; i++) { + contents[i] = config.getStackInSlot(i); + componentResults[i] = new SimulationComponentResult(); + + var comp = getComponent(i % COL_COUNT, i / COL_COUNT); + if(comp != null) { + comp.addHeat(config.components[i].initialHeat); + } + } + + result.componentResults = componentResults; + + this.pulseActive = true; + this.storedHeat = config.initialHeat; + + while(reactorTickCounter < config.maxSimulationTicks) { + if(reactorTickCounter % 2 == 0) { + this.addedEU = 0; + } else { + this.addedHU = 0; + } + + for(int row = 0; row < ROW_COUNT; row++) { + for(int col = 0; col < COL_COUNT; col++) { + int index = row * COL_COUNT + col; + + var component = getComponent(col, row); + + if(component != null) { + currentComponent = componentResults[index]; + + if(reactorTickCounter % 2 == 0) { + component.onEnergyTick(); + } else { + component.onHeatTick(); + } + + var heat = component.getStoredHeat(); + + currentComponent.totalTempSecs += heat * 2; + + if(heat < currentComponent.minTemp) { + currentComponent.minTemp = heat; + } + + if(heat > currentComponent.maxTemp) { + currentComponent.maxTemp = heat; + } + + var compConfig = config.components[index]; + + if(compConfig.hasAutomation && component.getStoredHeat() > compConfig.replacementThreshold) { + components[index] = null; + contents[index] = null; + } + + // may be set to null by the component itself, or to e.g. a depleted fuel rod + if(contents[index] == null || contents[index].getItem() != compConfig.item) { + currentComponent.replaceCount++; + contents[index] = new ItemStack(compConfig.item); + } + } + } + } + + if(reactorTickCounter % 2 == 0) { + int eupt = (int) (this.addedEU / 20); + + if(eupt < result.minEUpT) { + result.minEUpT = eupt; + } + + if(eupt > result.maxEUpT) { + result.maxEUpT = eupt; + } + } else { + int hups = this.addedHU; + + if(hups < result.minHUpS) { + result.minHUpS = hups; + } + + if(hups > result.maxHUpS) { + result.maxHUpS = hups; + } + + if(storedHeat < result.minTemp) { + result.minTemp = storedHeat; + } + + if(storedHeat > result.maxTemp) { + result.maxTemp = storedHeat; + } + + result.totalTempSecs += storedHeat * 2; + + double ratio = storedHeat / (double)getMaxHullHeat(); + + if(result.timeToEvaporate != null && result.timeToNormal == null && ratio < 0.5) { + result.timeToNormal = reactorTickCounter; + } + + if(result.timeToBurn == null && ratio >= 0.4) { + result.timeToBurn = reactorTickCounter; + } + + if(result.timeToEvaporate == null && ratio >= 0.5) { + result.timeToEvaporate = reactorTickCounter; + } + + if(result.timeToHurt == null && ratio >= 0.7) { + result.timeToHurt = reactorTickCounter; + } + + if(result.timeToLava == null && ratio >= 0.85) { + result.timeToLava = reactorTickCounter; + } + + if(result.timeToExplode == null && ratio >= 1) { + result.timeToExplode = reactorTickCounter; + break; + } + } + + if(isActive()) { + result.activeTime++; + } else { + result.pausedTime++; + } + + if(config.pulsed) { + pulseCounter++; + + if(pulseActive) { + if(pulseCounter >= config.onPulse) { + pulseActive = false; + pulseCounter -= config.onPulse; + } + } else { + if(pulseCounter >= config.offPulse) { + pulseActive = true; + pulseCounter -= config.offPulse; + } + } + } + + result.simTime++; + + reactorTickCounter++; + } + + result.end = System.nanoTime(); + + for(int i = 0; i < components.length; i++) { + var c = getComponent(i % COL_COUNT, i / COL_COUNT); + + if(c != null) { + c.modifySimulationResults(result, i); + } + } + } + } +} diff --git a/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulatorProtos.java b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulatorProtos.java new file mode 100644 index 0000000..8ec8001 --- /dev/null +++ b/src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulatorProtos.java @@ -0,0 +1,5980 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/main/java/com/recursive_pineapple/nuclear_horizons/reactors/tile/simulator/SimulationConfigProto.proto + +// Protobuf Java Version: 3.25.3 +package com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator; + +public final class SimulatorProtos { + private SimulatorProtos() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface SimulationConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:SimulationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * bool pulsed = 1; + * @return The pulsed. + */ + boolean getPulsed(); + + /** + * bool automated = 2; + * @return The automated. + */ + boolean getAutomated(); + + /** + * bool fluid = 3; + * @return The fluid. + */ + boolean getFluid(); + + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + int getInitialHeat(); + + /** + * int32 onPulse = 5; + * @return The onPulse. + */ + int getOnPulse(); + + /** + * int32 offPulse = 6; + * @return The offPulse. + */ + int getOffPulse(); + + /** + * int32 suspendTemp = 7; + * @return The suspendTemp. + */ + int getSuspendTemp(); + + /** + * int32 resumeTemp = 8; + * @return The resumeTemp. + */ + int getResumeTemp(); + + /** + * int32 maxSimulationTicks = 9; + * @return The maxSimulationTicks. + */ + int getMaxSimulationTicks(); + + /** + * repeated .ComponentConfig components = 10; + */ + java.util.List + getComponentsList(); + /** + * repeated .ComponentConfig components = 10; + */ + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getComponents(int index); + /** + * repeated .ComponentConfig components = 10; + */ + int getComponentsCount(); + /** + * repeated .ComponentConfig components = 10; + */ + java.util.List + getComponentsOrBuilderList(); + /** + * repeated .ComponentConfig components = 10; + */ + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder getComponentsOrBuilder( + int index); + } + /** + * Protobuf type {@code SimulationConfig} + */ + public static final class SimulationConfig extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:SimulationConfig) + SimulationConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use SimulationConfig.newBuilder() to construct. + private SimulationConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SimulationConfig() { + components_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SimulationConfig(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.Builder.class); + } + + public static final int PULSED_FIELD_NUMBER = 1; + private boolean pulsed_ = false; + /** + * bool pulsed = 1; + * @return The pulsed. + */ + @java.lang.Override + public boolean getPulsed() { + return pulsed_; + } + + public static final int AUTOMATED_FIELD_NUMBER = 2; + private boolean automated_ = false; + /** + * bool automated = 2; + * @return The automated. + */ + @java.lang.Override + public boolean getAutomated() { + return automated_; + } + + public static final int FLUID_FIELD_NUMBER = 3; + private boolean fluid_ = false; + /** + * bool fluid = 3; + * @return The fluid. + */ + @java.lang.Override + public boolean getFluid() { + return fluid_; + } + + public static final int INITIALHEAT_FIELD_NUMBER = 4; + private int initialHeat_ = 0; + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + @java.lang.Override + public int getInitialHeat() { + return initialHeat_; + } + + public static final int ONPULSE_FIELD_NUMBER = 5; + private int onPulse_ = 0; + /** + * int32 onPulse = 5; + * @return The onPulse. + */ + @java.lang.Override + public int getOnPulse() { + return onPulse_; + } + + public static final int OFFPULSE_FIELD_NUMBER = 6; + private int offPulse_ = 0; + /** + * int32 offPulse = 6; + * @return The offPulse. + */ + @java.lang.Override + public int getOffPulse() { + return offPulse_; + } + + public static final int SUSPENDTEMP_FIELD_NUMBER = 7; + private int suspendTemp_ = 0; + /** + * int32 suspendTemp = 7; + * @return The suspendTemp. + */ + @java.lang.Override + public int getSuspendTemp() { + return suspendTemp_; + } + + public static final int RESUMETEMP_FIELD_NUMBER = 8; + private int resumeTemp_ = 0; + /** + * int32 resumeTemp = 8; + * @return The resumeTemp. + */ + @java.lang.Override + public int getResumeTemp() { + return resumeTemp_; + } + + public static final int MAXSIMULATIONTICKS_FIELD_NUMBER = 9; + private int maxSimulationTicks_ = 0; + /** + * int32 maxSimulationTicks = 9; + * @return The maxSimulationTicks. + */ + @java.lang.Override + public int getMaxSimulationTicks() { + return maxSimulationTicks_; + } + + public static final int COMPONENTS_FIELD_NUMBER = 10; + @SuppressWarnings("serial") + private java.util.List components_; + /** + * repeated .ComponentConfig components = 10; + */ + @java.lang.Override + public java.util.List getComponentsList() { + return components_; + } + /** + * repeated .ComponentConfig components = 10; + */ + @java.lang.Override + public java.util.List + getComponentsOrBuilderList() { + return components_; + } + /** + * repeated .ComponentConfig components = 10; + */ + @java.lang.Override + public int getComponentsCount() { + return components_.size(); + } + /** + * repeated .ComponentConfig components = 10; + */ + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getComponents(int index) { + return components_.get(index); + } + /** + * repeated .ComponentConfig components = 10; + */ + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder getComponentsOrBuilder( + int index) { + return components_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (pulsed_ != false) { + output.writeBool(1, pulsed_); + } + if (automated_ != false) { + output.writeBool(2, automated_); + } + if (fluid_ != false) { + output.writeBool(3, fluid_); + } + if (initialHeat_ != 0) { + output.writeInt32(4, initialHeat_); + } + if (onPulse_ != 0) { + output.writeInt32(5, onPulse_); + } + if (offPulse_ != 0) { + output.writeInt32(6, offPulse_); + } + if (suspendTemp_ != 0) { + output.writeInt32(7, suspendTemp_); + } + if (resumeTemp_ != 0) { + output.writeInt32(8, resumeTemp_); + } + if (maxSimulationTicks_ != 0) { + output.writeInt32(9, maxSimulationTicks_); + } + for (int i = 0; i < components_.size(); i++) { + output.writeMessage(10, components_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pulsed_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, pulsed_); + } + if (automated_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(2, automated_); + } + if (fluid_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, fluid_); + } + if (initialHeat_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, initialHeat_); + } + if (onPulse_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, onPulse_); + } + if (offPulse_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, offPulse_); + } + if (suspendTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, suspendTemp_); + } + if (resumeTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, resumeTemp_); + } + if (maxSimulationTicks_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, maxSimulationTicks_); + } + for (int i = 0; i < components_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(10, components_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig)) { + return super.equals(obj); + } + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig other = (com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig) obj; + + if (getPulsed() + != other.getPulsed()) return false; + if (getAutomated() + != other.getAutomated()) return false; + if (getFluid() + != other.getFluid()) return false; + if (getInitialHeat() + != other.getInitialHeat()) return false; + if (getOnPulse() + != other.getOnPulse()) return false; + if (getOffPulse() + != other.getOffPulse()) return false; + if (getSuspendTemp() + != other.getSuspendTemp()) return false; + if (getResumeTemp() + != other.getResumeTemp()) return false; + if (getMaxSimulationTicks() + != other.getMaxSimulationTicks()) return false; + if (!getComponentsList() + .equals(other.getComponentsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PULSED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getPulsed()); + hash = (37 * hash) + AUTOMATED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getAutomated()); + hash = (37 * hash) + FLUID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getFluid()); + hash = (37 * hash) + INITIALHEAT_FIELD_NUMBER; + hash = (53 * hash) + getInitialHeat(); + hash = (37 * hash) + ONPULSE_FIELD_NUMBER; + hash = (53 * hash) + getOnPulse(); + hash = (37 * hash) + OFFPULSE_FIELD_NUMBER; + hash = (53 * hash) + getOffPulse(); + hash = (37 * hash) + SUSPENDTEMP_FIELD_NUMBER; + hash = (53 * hash) + getSuspendTemp(); + hash = (37 * hash) + RESUMETEMP_FIELD_NUMBER; + hash = (53 * hash) + getResumeTemp(); + hash = (37 * hash) + MAXSIMULATIONTICKS_FIELD_NUMBER; + hash = (53 * hash) + getMaxSimulationTicks(); + if (getComponentsCount() > 0) { + hash = (37 * hash) + COMPONENTS_FIELD_NUMBER; + hash = (53 * hash) + getComponentsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code SimulationConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:SimulationConfig) + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.Builder.class); + } + + // Construct using com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + pulsed_ = false; + automated_ = false; + fluid_ = false; + initialHeat_ = 0; + onPulse_ = 0; + offPulse_ = 0; + suspendTemp_ = 0; + resumeTemp_ = 0; + maxSimulationTicks_ = 0; + if (componentsBuilder_ == null) { + components_ = java.util.Collections.emptyList(); + } else { + components_ = null; + componentsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000200); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationConfig_descriptor; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig getDefaultInstanceForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig build() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig buildPartial() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig result = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig result) { + if (componentsBuilder_ == null) { + if (((bitField0_ & 0x00000200) != 0)) { + components_ = java.util.Collections.unmodifiableList(components_); + bitField0_ = (bitField0_ & ~0x00000200); + } + result.components_ = components_; + } else { + result.components_ = componentsBuilder_.build(); + } + } + + private void buildPartial0(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.pulsed_ = pulsed_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.automated_ = automated_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.fluid_ = fluid_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.initialHeat_ = initialHeat_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.onPulse_ = onPulse_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.offPulse_ = offPulse_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.suspendTemp_ = suspendTemp_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.resumeTemp_ = resumeTemp_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.maxSimulationTicks_ = maxSimulationTicks_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig) { + return mergeFrom((com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig other) { + if (other == com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig.getDefaultInstance()) return this; + if (other.getPulsed() != false) { + setPulsed(other.getPulsed()); + } + if (other.getAutomated() != false) { + setAutomated(other.getAutomated()); + } + if (other.getFluid() != false) { + setFluid(other.getFluid()); + } + if (other.getInitialHeat() != 0) { + setInitialHeat(other.getInitialHeat()); + } + if (other.getOnPulse() != 0) { + setOnPulse(other.getOnPulse()); + } + if (other.getOffPulse() != 0) { + setOffPulse(other.getOffPulse()); + } + if (other.getSuspendTemp() != 0) { + setSuspendTemp(other.getSuspendTemp()); + } + if (other.getResumeTemp() != 0) { + setResumeTemp(other.getResumeTemp()); + } + if (other.getMaxSimulationTicks() != 0) { + setMaxSimulationTicks(other.getMaxSimulationTicks()); + } + if (componentsBuilder_ == null) { + if (!other.components_.isEmpty()) { + if (components_.isEmpty()) { + components_ = other.components_; + bitField0_ = (bitField0_ & ~0x00000200); + } else { + ensureComponentsIsMutable(); + components_.addAll(other.components_); + } + onChanged(); + } + } else { + if (!other.components_.isEmpty()) { + if (componentsBuilder_.isEmpty()) { + componentsBuilder_.dispose(); + componentsBuilder_ = null; + components_ = other.components_; + bitField0_ = (bitField0_ & ~0x00000200); + componentsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getComponentsFieldBuilder() : null; + } else { + componentsBuilder_.addAllMessages(other.components_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + pulsed_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + automated_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + fluid_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + initialHeat_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + onPulse_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + offPulse_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + suspendTemp_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + resumeTemp_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + maxSimulationTicks_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 82: { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig m = + input.readMessage( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.parser(), + extensionRegistry); + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(m); + } else { + componentsBuilder_.addMessage(m); + } + break; + } // case 82 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private boolean pulsed_ ; + /** + * bool pulsed = 1; + * @return The pulsed. + */ + @java.lang.Override + public boolean getPulsed() { + return pulsed_; + } + /** + * bool pulsed = 1; + * @param value The pulsed to set. + * @return This builder for chaining. + */ + public Builder setPulsed(boolean value) { + + pulsed_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * bool pulsed = 1; + * @return This builder for chaining. + */ + public Builder clearPulsed() { + bitField0_ = (bitField0_ & ~0x00000001); + pulsed_ = false; + onChanged(); + return this; + } + + private boolean automated_ ; + /** + * bool automated = 2; + * @return The automated. + */ + @java.lang.Override + public boolean getAutomated() { + return automated_; + } + /** + * bool automated = 2; + * @param value The automated to set. + * @return This builder for chaining. + */ + public Builder setAutomated(boolean value) { + + automated_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * bool automated = 2; + * @return This builder for chaining. + */ + public Builder clearAutomated() { + bitField0_ = (bitField0_ & ~0x00000002); + automated_ = false; + onChanged(); + return this; + } + + private boolean fluid_ ; + /** + * bool fluid = 3; + * @return The fluid. + */ + @java.lang.Override + public boolean getFluid() { + return fluid_; + } + /** + * bool fluid = 3; + * @param value The fluid to set. + * @return This builder for chaining. + */ + public Builder setFluid(boolean value) { + + fluid_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * bool fluid = 3; + * @return This builder for chaining. + */ + public Builder clearFluid() { + bitField0_ = (bitField0_ & ~0x00000004); + fluid_ = false; + onChanged(); + return this; + } + + private int initialHeat_ ; + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + @java.lang.Override + public int getInitialHeat() { + return initialHeat_; + } + /** + * int32 initialHeat = 4; + * @param value The initialHeat to set. + * @return This builder for chaining. + */ + public Builder setInitialHeat(int value) { + + initialHeat_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 initialHeat = 4; + * @return This builder for chaining. + */ + public Builder clearInitialHeat() { + bitField0_ = (bitField0_ & ~0x00000008); + initialHeat_ = 0; + onChanged(); + return this; + } + + private int onPulse_ ; + /** + * int32 onPulse = 5; + * @return The onPulse. + */ + @java.lang.Override + public int getOnPulse() { + return onPulse_; + } + /** + * int32 onPulse = 5; + * @param value The onPulse to set. + * @return This builder for chaining. + */ + public Builder setOnPulse(int value) { + + onPulse_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 onPulse = 5; + * @return This builder for chaining. + */ + public Builder clearOnPulse() { + bitField0_ = (bitField0_ & ~0x00000010); + onPulse_ = 0; + onChanged(); + return this; + } + + private int offPulse_ ; + /** + * int32 offPulse = 6; + * @return The offPulse. + */ + @java.lang.Override + public int getOffPulse() { + return offPulse_; + } + /** + * int32 offPulse = 6; + * @param value The offPulse to set. + * @return This builder for chaining. + */ + public Builder setOffPulse(int value) { + + offPulse_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 offPulse = 6; + * @return This builder for chaining. + */ + public Builder clearOffPulse() { + bitField0_ = (bitField0_ & ~0x00000020); + offPulse_ = 0; + onChanged(); + return this; + } + + private int suspendTemp_ ; + /** + * int32 suspendTemp = 7; + * @return The suspendTemp. + */ + @java.lang.Override + public int getSuspendTemp() { + return suspendTemp_; + } + /** + * int32 suspendTemp = 7; + * @param value The suspendTemp to set. + * @return This builder for chaining. + */ + public Builder setSuspendTemp(int value) { + + suspendTemp_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 suspendTemp = 7; + * @return This builder for chaining. + */ + public Builder clearSuspendTemp() { + bitField0_ = (bitField0_ & ~0x00000040); + suspendTemp_ = 0; + onChanged(); + return this; + } + + private int resumeTemp_ ; + /** + * int32 resumeTemp = 8; + * @return The resumeTemp. + */ + @java.lang.Override + public int getResumeTemp() { + return resumeTemp_; + } + /** + * int32 resumeTemp = 8; + * @param value The resumeTemp to set. + * @return This builder for chaining. + */ + public Builder setResumeTemp(int value) { + + resumeTemp_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 resumeTemp = 8; + * @return This builder for chaining. + */ + public Builder clearResumeTemp() { + bitField0_ = (bitField0_ & ~0x00000080); + resumeTemp_ = 0; + onChanged(); + return this; + } + + private int maxSimulationTicks_ ; + /** + * int32 maxSimulationTicks = 9; + * @return The maxSimulationTicks. + */ + @java.lang.Override + public int getMaxSimulationTicks() { + return maxSimulationTicks_; + } + /** + * int32 maxSimulationTicks = 9; + * @param value The maxSimulationTicks to set. + * @return This builder for chaining. + */ + public Builder setMaxSimulationTicks(int value) { + + maxSimulationTicks_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * int32 maxSimulationTicks = 9; + * @return This builder for chaining. + */ + public Builder clearMaxSimulationTicks() { + bitField0_ = (bitField0_ & ~0x00000100); + maxSimulationTicks_ = 0; + onChanged(); + return this; + } + + private java.util.List components_ = + java.util.Collections.emptyList(); + private void ensureComponentsIsMutable() { + if (!((bitField0_ & 0x00000200) != 0)) { + components_ = new java.util.ArrayList(components_); + bitField0_ |= 0x00000200; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder> componentsBuilder_; + + /** + * repeated .ComponentConfig components = 10; + */ + public java.util.List getComponentsList() { + if (componentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(components_); + } else { + return componentsBuilder_.getMessageList(); + } + } + /** + * repeated .ComponentConfig components = 10; + */ + public int getComponentsCount() { + if (componentsBuilder_ == null) { + return components_.size(); + } else { + return componentsBuilder_.getCount(); + } + } + /** + * repeated .ComponentConfig components = 10; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getComponents(int index) { + if (componentsBuilder_ == null) { + return components_.get(index); + } else { + return componentsBuilder_.getMessage(index); + } + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder setComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.set(index, value); + onChanged(); + } else { + componentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder setComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.set(index, builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder addComponents(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.add(value); + onChanged(); + } else { + componentsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder addComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.add(index, value); + onChanged(); + } else { + componentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder addComponents( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder addComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(index, builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder addAllComponents( + java.lang.Iterable values) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, components_); + onChanged(); + } else { + componentsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder clearComponents() { + if (componentsBuilder_ == null) { + components_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000200); + onChanged(); + } else { + componentsBuilder_.clear(); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public Builder removeComponents(int index) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.remove(index); + onChanged(); + } else { + componentsBuilder_.remove(index); + } + return this; + } + /** + * repeated .ComponentConfig components = 10; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder getComponentsBuilder( + int index) { + return getComponentsFieldBuilder().getBuilder(index); + } + /** + * repeated .ComponentConfig components = 10; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder getComponentsOrBuilder( + int index) { + if (componentsBuilder_ == null) { + return components_.get(index); } else { + return componentsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .ComponentConfig components = 10; + */ + public java.util.List + getComponentsOrBuilderList() { + if (componentsBuilder_ != null) { + return componentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(components_); + } + } + /** + * repeated .ComponentConfig components = 10; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder addComponentsBuilder() { + return getComponentsFieldBuilder().addBuilder( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.getDefaultInstance()); + } + /** + * repeated .ComponentConfig components = 10; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder addComponentsBuilder( + int index) { + return getComponentsFieldBuilder().addBuilder( + index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.getDefaultInstance()); + } + /** + * repeated .ComponentConfig components = 10; + */ + public java.util.List + getComponentsBuilderList() { + return getComponentsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder> + getComponentsFieldBuilder() { + if (componentsBuilder_ == null) { + componentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder>( + components_, + ((bitField0_ & 0x00000200) != 0), + getParentForChildren(), + isClean()); + components_ = null; + } + return componentsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:SimulationConfig) + } + + // @@protoc_insertion_point(class_scope:SimulationConfig) + private static final com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig(); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SimulationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ComponentConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:ComponentConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 index = 1; + * @return The index. + */ + int getIndex(); + + /** + * int32 item = 2; + * @return The item. + */ + int getItem(); + + /** + * bool hasAutomation = 3; + * @return The hasAutomation. + */ + boolean getHasAutomation(); + + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + int getInitialHeat(); + + /** + * int32 replacementThreshold = 5; + * @return The replacementThreshold. + */ + int getReplacementThreshold(); + + /** + * int32 reactorPause = 6; + * @return The reactorPause. + */ + int getReactorPause(); + } + /** + * Protobuf type {@code ComponentConfig} + */ + public static final class ComponentConfig extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ComponentConfig) + ComponentConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComponentConfig.newBuilder() to construct. + private ComponentConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ComponentConfig() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ComponentConfig(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder.class); + } + + public static final int INDEX_FIELD_NUMBER = 1; + private int index_ = 0; + /** + * int32 index = 1; + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + + public static final int ITEM_FIELD_NUMBER = 2; + private int item_ = 0; + /** + * int32 item = 2; + * @return The item. + */ + @java.lang.Override + public int getItem() { + return item_; + } + + public static final int HASAUTOMATION_FIELD_NUMBER = 3; + private boolean hasAutomation_ = false; + /** + * bool hasAutomation = 3; + * @return The hasAutomation. + */ + @java.lang.Override + public boolean getHasAutomation() { + return hasAutomation_; + } + + public static final int INITIALHEAT_FIELD_NUMBER = 4; + private int initialHeat_ = 0; + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + @java.lang.Override + public int getInitialHeat() { + return initialHeat_; + } + + public static final int REPLACEMENTTHRESHOLD_FIELD_NUMBER = 5; + private int replacementThreshold_ = 0; + /** + * int32 replacementThreshold = 5; + * @return The replacementThreshold. + */ + @java.lang.Override + public int getReplacementThreshold() { + return replacementThreshold_; + } + + public static final int REACTORPAUSE_FIELD_NUMBER = 6; + private int reactorPause_ = 0; + /** + * int32 reactorPause = 6; + * @return The reactorPause. + */ + @java.lang.Override + public int getReactorPause() { + return reactorPause_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (index_ != 0) { + output.writeInt32(1, index_); + } + if (item_ != 0) { + output.writeInt32(2, item_); + } + if (hasAutomation_ != false) { + output.writeBool(3, hasAutomation_); + } + if (initialHeat_ != 0) { + output.writeInt32(4, initialHeat_); + } + if (replacementThreshold_ != 0) { + output.writeInt32(5, replacementThreshold_); + } + if (reactorPause_ != 0) { + output.writeInt32(6, reactorPause_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (index_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, index_); + } + if (item_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, item_); + } + if (hasAutomation_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, hasAutomation_); + } + if (initialHeat_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, initialHeat_); + } + if (replacementThreshold_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, replacementThreshold_); + } + if (reactorPause_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, reactorPause_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig)) { + return super.equals(obj); + } + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig other = (com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig) obj; + + if (getIndex() + != other.getIndex()) return false; + if (getItem() + != other.getItem()) return false; + if (getHasAutomation() + != other.getHasAutomation()) return false; + if (getInitialHeat() + != other.getInitialHeat()) return false; + if (getReplacementThreshold() + != other.getReplacementThreshold()) return false; + if (getReactorPause() + != other.getReactorPause()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + getIndex(); + hash = (37 * hash) + ITEM_FIELD_NUMBER; + hash = (53 * hash) + getItem(); + hash = (37 * hash) + HASAUTOMATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getHasAutomation()); + hash = (37 * hash) + INITIALHEAT_FIELD_NUMBER; + hash = (53 * hash) + getInitialHeat(); + hash = (37 * hash) + REPLACEMENTTHRESHOLD_FIELD_NUMBER; + hash = (53 * hash) + getReplacementThreshold(); + hash = (37 * hash) + REACTORPAUSE_FIELD_NUMBER; + hash = (53 * hash) + getReactorPause(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ComponentConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ComponentConfig) + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.Builder.class); + } + + // Construct using com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + index_ = 0; + item_ = 0; + hasAutomation_ = false; + initialHeat_ = 0; + replacementThreshold_ = 0; + reactorPause_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentConfig_descriptor; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getDefaultInstanceForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig build() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig buildPartial() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig result = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.index_ = index_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.item_ = item_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.hasAutomation_ = hasAutomation_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.initialHeat_ = initialHeat_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.replacementThreshold_ = replacementThreshold_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.reactorPause_ = reactorPause_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig) { + return mergeFrom((com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig other) { + if (other == com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig.getDefaultInstance()) return this; + if (other.getIndex() != 0) { + setIndex(other.getIndex()); + } + if (other.getItem() != 0) { + setItem(other.getItem()); + } + if (other.getHasAutomation() != false) { + setHasAutomation(other.getHasAutomation()); + } + if (other.getInitialHeat() != 0) { + setInitialHeat(other.getInitialHeat()); + } + if (other.getReplacementThreshold() != 0) { + setReplacementThreshold(other.getReplacementThreshold()); + } + if (other.getReactorPause() != 0) { + setReactorPause(other.getReactorPause()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + index_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + item_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + hasAutomation_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + initialHeat_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + replacementThreshold_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + reactorPause_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int index_ ; + /** + * int32 index = 1; + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + /** + * int32 index = 1; + * @param value The index to set. + * @return This builder for chaining. + */ + public Builder setIndex(int value) { + + index_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 index = 1; + * @return This builder for chaining. + */ + public Builder clearIndex() { + bitField0_ = (bitField0_ & ~0x00000001); + index_ = 0; + onChanged(); + return this; + } + + private int item_ ; + /** + * int32 item = 2; + * @return The item. + */ + @java.lang.Override + public int getItem() { + return item_; + } + /** + * int32 item = 2; + * @param value The item to set. + * @return This builder for chaining. + */ + public Builder setItem(int value) { + + item_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 item = 2; + * @return This builder for chaining. + */ + public Builder clearItem() { + bitField0_ = (bitField0_ & ~0x00000002); + item_ = 0; + onChanged(); + return this; + } + + private boolean hasAutomation_ ; + /** + * bool hasAutomation = 3; + * @return The hasAutomation. + */ + @java.lang.Override + public boolean getHasAutomation() { + return hasAutomation_; + } + /** + * bool hasAutomation = 3; + * @param value The hasAutomation to set. + * @return This builder for chaining. + */ + public Builder setHasAutomation(boolean value) { + + hasAutomation_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * bool hasAutomation = 3; + * @return This builder for chaining. + */ + public Builder clearHasAutomation() { + bitField0_ = (bitField0_ & ~0x00000004); + hasAutomation_ = false; + onChanged(); + return this; + } + + private int initialHeat_ ; + /** + * int32 initialHeat = 4; + * @return The initialHeat. + */ + @java.lang.Override + public int getInitialHeat() { + return initialHeat_; + } + /** + * int32 initialHeat = 4; + * @param value The initialHeat to set. + * @return This builder for chaining. + */ + public Builder setInitialHeat(int value) { + + initialHeat_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 initialHeat = 4; + * @return This builder for chaining. + */ + public Builder clearInitialHeat() { + bitField0_ = (bitField0_ & ~0x00000008); + initialHeat_ = 0; + onChanged(); + return this; + } + + private int replacementThreshold_ ; + /** + * int32 replacementThreshold = 5; + * @return The replacementThreshold. + */ + @java.lang.Override + public int getReplacementThreshold() { + return replacementThreshold_; + } + /** + * int32 replacementThreshold = 5; + * @param value The replacementThreshold to set. + * @return This builder for chaining. + */ + public Builder setReplacementThreshold(int value) { + + replacementThreshold_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 replacementThreshold = 5; + * @return This builder for chaining. + */ + public Builder clearReplacementThreshold() { + bitField0_ = (bitField0_ & ~0x00000010); + replacementThreshold_ = 0; + onChanged(); + return this; + } + + private int reactorPause_ ; + /** + * int32 reactorPause = 6; + * @return The reactorPause. + */ + @java.lang.Override + public int getReactorPause() { + return reactorPause_; + } + /** + * int32 reactorPause = 6; + * @param value The reactorPause to set. + * @return This builder for chaining. + */ + public Builder setReactorPause(int value) { + + reactorPause_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 reactorPause = 6; + * @return This builder for chaining. + */ + public Builder clearReactorPause() { + bitField0_ = (bitField0_ & ~0x00000020); + reactorPause_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:ComponentConfig) + } + + // @@protoc_insertion_point(class_scope:ComponentConfig) + private static final com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig(); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComponentConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface SimulationResultOrBuilder extends + // @@protoc_insertion_point(interface_extends:SimulationResult) + com.google.protobuf.MessageOrBuilder { + + /** + * int64 start = 1; + * @return The start. + */ + long getStart(); + + /** + * int64 end = 2; + * @return The end. + */ + long getEnd(); + + /** + * int64 totalEU = 3; + * @return The totalEU. + */ + long getTotalEU(); + + /** + * int32 minEUpT = 4; + * @return The minEUpT. + */ + int getMinEUpT(); + + /** + * int32 maxEUpT = 5; + * @return The maxEUpT. + */ + int getMaxEUpT(); + + /** + * int64 totalHU = 6; + * @return The totalHU. + */ + long getTotalHU(); + + /** + * int32 minHUpS = 7; + * @return The minHUpS. + */ + int getMinHUpS(); + + /** + * int32 maxHUpS = 8; + * @return The maxHUpS. + */ + int getMaxHUpS(); + + /** + * int64 totalTempSecs = 9; + * @return The totalTempSecs. + */ + long getTotalTempSecs(); + + /** + * int32 minTemp = 10; + * @return The minTemp. + */ + int getMinTemp(); + + /** + * int32 maxTemp = 11; + * @return The maxTemp. + */ + int getMaxTemp(); + + /** + * int64 totalHullHeating = 12; + * @return The totalHullHeating. + */ + long getTotalHullHeating(); + + /** + * int64 totalHullCooling = 13; + * @return The totalHullCooling. + */ + long getTotalHullCooling(); + + /** + * int32 simTime = 14; + * @return The simTime. + */ + int getSimTime(); + + /** + * int32 activeTime = 15; + * @return The activeTime. + */ + int getActiveTime(); + + /** + * int32 pausedTime = 16; + * @return The pausedTime. + */ + int getPausedTime(); + + /** + * optional int32 timeToNormal = 17; + * @return Whether the timeToNormal field is set. + */ + boolean hasTimeToNormal(); + /** + * optional int32 timeToNormal = 17; + * @return The timeToNormal. + */ + int getTimeToNormal(); + + /** + * optional int32 timeToBurn = 18; + * @return Whether the timeToBurn field is set. + */ + boolean hasTimeToBurn(); + /** + * optional int32 timeToBurn = 18; + * @return The timeToBurn. + */ + int getTimeToBurn(); + + /** + * optional int32 timeToEvaporate = 19; + * @return Whether the timeToEvaporate field is set. + */ + boolean hasTimeToEvaporate(); + /** + * optional int32 timeToEvaporate = 19; + * @return The timeToEvaporate. + */ + int getTimeToEvaporate(); + + /** + * optional int32 timeToHurt = 20; + * @return Whether the timeToHurt field is set. + */ + boolean hasTimeToHurt(); + /** + * optional int32 timeToHurt = 20; + * @return The timeToHurt. + */ + int getTimeToHurt(); + + /** + * optional int32 timeToLava = 21; + * @return Whether the timeToLava field is set. + */ + boolean hasTimeToLava(); + /** + * optional int32 timeToLava = 21; + * @return The timeToLava. + */ + int getTimeToLava(); + + /** + * optional int32 timeToExplode = 22; + * @return Whether the timeToExplode field is set. + */ + boolean hasTimeToExplode(); + /** + * optional int32 timeToExplode = 22; + * @return The timeToExplode. + */ + int getTimeToExplode(); + + /** + * repeated .ComponentResult components = 23; + */ + java.util.List + getComponentsList(); + /** + * repeated .ComponentResult components = 23; + */ + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getComponents(int index); + /** + * repeated .ComponentResult components = 23; + */ + int getComponentsCount(); + /** + * repeated .ComponentResult components = 23; + */ + java.util.List + getComponentsOrBuilderList(); + /** + * repeated .ComponentResult components = 23; + */ + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder getComponentsOrBuilder( + int index); + } + /** + * Protobuf type {@code SimulationResult} + */ + public static final class SimulationResult extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:SimulationResult) + SimulationResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use SimulationResult.newBuilder() to construct. + private SimulationResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SimulationResult() { + components_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SimulationResult(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.Builder.class); + } + + private int bitField0_; + public static final int START_FIELD_NUMBER = 1; + private long start_ = 0L; + /** + * int64 start = 1; + * @return The start. + */ + @java.lang.Override + public long getStart() { + return start_; + } + + public static final int END_FIELD_NUMBER = 2; + private long end_ = 0L; + /** + * int64 end = 2; + * @return The end. + */ + @java.lang.Override + public long getEnd() { + return end_; + } + + public static final int TOTALEU_FIELD_NUMBER = 3; + private long totalEU_ = 0L; + /** + * int64 totalEU = 3; + * @return The totalEU. + */ + @java.lang.Override + public long getTotalEU() { + return totalEU_; + } + + public static final int MINEUPT_FIELD_NUMBER = 4; + private int minEUpT_ = 0; + /** + * int32 minEUpT = 4; + * @return The minEUpT. + */ + @java.lang.Override + public int getMinEUpT() { + return minEUpT_; + } + + public static final int MAXEUPT_FIELD_NUMBER = 5; + private int maxEUpT_ = 0; + /** + * int32 maxEUpT = 5; + * @return The maxEUpT. + */ + @java.lang.Override + public int getMaxEUpT() { + return maxEUpT_; + } + + public static final int TOTALHU_FIELD_NUMBER = 6; + private long totalHU_ = 0L; + /** + * int64 totalHU = 6; + * @return The totalHU. + */ + @java.lang.Override + public long getTotalHU() { + return totalHU_; + } + + public static final int MINHUPS_FIELD_NUMBER = 7; + private int minHUpS_ = 0; + /** + * int32 minHUpS = 7; + * @return The minHUpS. + */ + @java.lang.Override + public int getMinHUpS() { + return minHUpS_; + } + + public static final int MAXHUPS_FIELD_NUMBER = 8; + private int maxHUpS_ = 0; + /** + * int32 maxHUpS = 8; + * @return The maxHUpS. + */ + @java.lang.Override + public int getMaxHUpS() { + return maxHUpS_; + } + + public static final int TOTALTEMPSECS_FIELD_NUMBER = 9; + private long totalTempSecs_ = 0L; + /** + * int64 totalTempSecs = 9; + * @return The totalTempSecs. + */ + @java.lang.Override + public long getTotalTempSecs() { + return totalTempSecs_; + } + + public static final int MINTEMP_FIELD_NUMBER = 10; + private int minTemp_ = 0; + /** + * int32 minTemp = 10; + * @return The minTemp. + */ + @java.lang.Override + public int getMinTemp() { + return minTemp_; + } + + public static final int MAXTEMP_FIELD_NUMBER = 11; + private int maxTemp_ = 0; + /** + * int32 maxTemp = 11; + * @return The maxTemp. + */ + @java.lang.Override + public int getMaxTemp() { + return maxTemp_; + } + + public static final int TOTALHULLHEATING_FIELD_NUMBER = 12; + private long totalHullHeating_ = 0L; + /** + * int64 totalHullHeating = 12; + * @return The totalHullHeating. + */ + @java.lang.Override + public long getTotalHullHeating() { + return totalHullHeating_; + } + + public static final int TOTALHULLCOOLING_FIELD_NUMBER = 13; + private long totalHullCooling_ = 0L; + /** + * int64 totalHullCooling = 13; + * @return The totalHullCooling. + */ + @java.lang.Override + public long getTotalHullCooling() { + return totalHullCooling_; + } + + public static final int SIMTIME_FIELD_NUMBER = 14; + private int simTime_ = 0; + /** + * int32 simTime = 14; + * @return The simTime. + */ + @java.lang.Override + public int getSimTime() { + return simTime_; + } + + public static final int ACTIVETIME_FIELD_NUMBER = 15; + private int activeTime_ = 0; + /** + * int32 activeTime = 15; + * @return The activeTime. + */ + @java.lang.Override + public int getActiveTime() { + return activeTime_; + } + + public static final int PAUSEDTIME_FIELD_NUMBER = 16; + private int pausedTime_ = 0; + /** + * int32 pausedTime = 16; + * @return The pausedTime. + */ + @java.lang.Override + public int getPausedTime() { + return pausedTime_; + } + + public static final int TIMETONORMAL_FIELD_NUMBER = 17; + private int timeToNormal_ = 0; + /** + * optional int32 timeToNormal = 17; + * @return Whether the timeToNormal field is set. + */ + @java.lang.Override + public boolean hasTimeToNormal() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * optional int32 timeToNormal = 17; + * @return The timeToNormal. + */ + @java.lang.Override + public int getTimeToNormal() { + return timeToNormal_; + } + + public static final int TIMETOBURN_FIELD_NUMBER = 18; + private int timeToBurn_ = 0; + /** + * optional int32 timeToBurn = 18; + * @return Whether the timeToBurn field is set. + */ + @java.lang.Override + public boolean hasTimeToBurn() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * optional int32 timeToBurn = 18; + * @return The timeToBurn. + */ + @java.lang.Override + public int getTimeToBurn() { + return timeToBurn_; + } + + public static final int TIMETOEVAPORATE_FIELD_NUMBER = 19; + private int timeToEvaporate_ = 0; + /** + * optional int32 timeToEvaporate = 19; + * @return Whether the timeToEvaporate field is set. + */ + @java.lang.Override + public boolean hasTimeToEvaporate() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * optional int32 timeToEvaporate = 19; + * @return The timeToEvaporate. + */ + @java.lang.Override + public int getTimeToEvaporate() { + return timeToEvaporate_; + } + + public static final int TIMETOHURT_FIELD_NUMBER = 20; + private int timeToHurt_ = 0; + /** + * optional int32 timeToHurt = 20; + * @return Whether the timeToHurt field is set. + */ + @java.lang.Override + public boolean hasTimeToHurt() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * optional int32 timeToHurt = 20; + * @return The timeToHurt. + */ + @java.lang.Override + public int getTimeToHurt() { + return timeToHurt_; + } + + public static final int TIMETOLAVA_FIELD_NUMBER = 21; + private int timeToLava_ = 0; + /** + * optional int32 timeToLava = 21; + * @return Whether the timeToLava field is set. + */ + @java.lang.Override + public boolean hasTimeToLava() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * optional int32 timeToLava = 21; + * @return The timeToLava. + */ + @java.lang.Override + public int getTimeToLava() { + return timeToLava_; + } + + public static final int TIMETOEXPLODE_FIELD_NUMBER = 22; + private int timeToExplode_ = 0; + /** + * optional int32 timeToExplode = 22; + * @return Whether the timeToExplode field is set. + */ + @java.lang.Override + public boolean hasTimeToExplode() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * optional int32 timeToExplode = 22; + * @return The timeToExplode. + */ + @java.lang.Override + public int getTimeToExplode() { + return timeToExplode_; + } + + public static final int COMPONENTS_FIELD_NUMBER = 23; + @SuppressWarnings("serial") + private java.util.List components_; + /** + * repeated .ComponentResult components = 23; + */ + @java.lang.Override + public java.util.List getComponentsList() { + return components_; + } + /** + * repeated .ComponentResult components = 23; + */ + @java.lang.Override + public java.util.List + getComponentsOrBuilderList() { + return components_; + } + /** + * repeated .ComponentResult components = 23; + */ + @java.lang.Override + public int getComponentsCount() { + return components_.size(); + } + /** + * repeated .ComponentResult components = 23; + */ + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getComponents(int index) { + return components_.get(index); + } + /** + * repeated .ComponentResult components = 23; + */ + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder getComponentsOrBuilder( + int index) { + return components_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (start_ != 0L) { + output.writeInt64(1, start_); + } + if (end_ != 0L) { + output.writeInt64(2, end_); + } + if (totalEU_ != 0L) { + output.writeInt64(3, totalEU_); + } + if (minEUpT_ != 0) { + output.writeInt32(4, minEUpT_); + } + if (maxEUpT_ != 0) { + output.writeInt32(5, maxEUpT_); + } + if (totalHU_ != 0L) { + output.writeInt64(6, totalHU_); + } + if (minHUpS_ != 0) { + output.writeInt32(7, minHUpS_); + } + if (maxHUpS_ != 0) { + output.writeInt32(8, maxHUpS_); + } + if (totalTempSecs_ != 0L) { + output.writeInt64(9, totalTempSecs_); + } + if (minTemp_ != 0) { + output.writeInt32(10, minTemp_); + } + if (maxTemp_ != 0) { + output.writeInt32(11, maxTemp_); + } + if (totalHullHeating_ != 0L) { + output.writeInt64(12, totalHullHeating_); + } + if (totalHullCooling_ != 0L) { + output.writeInt64(13, totalHullCooling_); + } + if (simTime_ != 0) { + output.writeInt32(14, simTime_); + } + if (activeTime_ != 0) { + output.writeInt32(15, activeTime_); + } + if (pausedTime_ != 0) { + output.writeInt32(16, pausedTime_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeInt32(17, timeToNormal_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeInt32(18, timeToBurn_); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeInt32(19, timeToEvaporate_); + } + if (((bitField0_ & 0x00000008) != 0)) { + output.writeInt32(20, timeToHurt_); + } + if (((bitField0_ & 0x00000010) != 0)) { + output.writeInt32(21, timeToLava_); + } + if (((bitField0_ & 0x00000020) != 0)) { + output.writeInt32(22, timeToExplode_); + } + for (int i = 0; i < components_.size(); i++) { + output.writeMessage(23, components_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (start_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, start_); + } + if (end_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, end_); + } + if (totalEU_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, totalEU_); + } + if (minEUpT_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, minEUpT_); + } + if (maxEUpT_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, maxEUpT_); + } + if (totalHU_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(6, totalHU_); + } + if (minHUpS_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, minHUpS_); + } + if (maxHUpS_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, maxHUpS_); + } + if (totalTempSecs_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(9, totalTempSecs_); + } + if (minTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, minTemp_); + } + if (maxTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, maxTemp_); + } + if (totalHullHeating_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(12, totalHullHeating_); + } + if (totalHullCooling_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(13, totalHullCooling_); + } + if (simTime_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(14, simTime_); + } + if (activeTime_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(15, activeTime_); + } + if (pausedTime_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(16, pausedTime_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(17, timeToNormal_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(18, timeToBurn_); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(19, timeToEvaporate_); + } + if (((bitField0_ & 0x00000008) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(20, timeToHurt_); + } + if (((bitField0_ & 0x00000010) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(21, timeToLava_); + } + if (((bitField0_ & 0x00000020) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(22, timeToExplode_); + } + for (int i = 0; i < components_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(23, components_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult)) { + return super.equals(obj); + } + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult other = (com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult) obj; + + if (getStart() + != other.getStart()) return false; + if (getEnd() + != other.getEnd()) return false; + if (getTotalEU() + != other.getTotalEU()) return false; + if (getMinEUpT() + != other.getMinEUpT()) return false; + if (getMaxEUpT() + != other.getMaxEUpT()) return false; + if (getTotalHU() + != other.getTotalHU()) return false; + if (getMinHUpS() + != other.getMinHUpS()) return false; + if (getMaxHUpS() + != other.getMaxHUpS()) return false; + if (getTotalTempSecs() + != other.getTotalTempSecs()) return false; + if (getMinTemp() + != other.getMinTemp()) return false; + if (getMaxTemp() + != other.getMaxTemp()) return false; + if (getTotalHullHeating() + != other.getTotalHullHeating()) return false; + if (getTotalHullCooling() + != other.getTotalHullCooling()) return false; + if (getSimTime() + != other.getSimTime()) return false; + if (getActiveTime() + != other.getActiveTime()) return false; + if (getPausedTime() + != other.getPausedTime()) return false; + if (hasTimeToNormal() != other.hasTimeToNormal()) return false; + if (hasTimeToNormal()) { + if (getTimeToNormal() + != other.getTimeToNormal()) return false; + } + if (hasTimeToBurn() != other.hasTimeToBurn()) return false; + if (hasTimeToBurn()) { + if (getTimeToBurn() + != other.getTimeToBurn()) return false; + } + if (hasTimeToEvaporate() != other.hasTimeToEvaporate()) return false; + if (hasTimeToEvaporate()) { + if (getTimeToEvaporate() + != other.getTimeToEvaporate()) return false; + } + if (hasTimeToHurt() != other.hasTimeToHurt()) return false; + if (hasTimeToHurt()) { + if (getTimeToHurt() + != other.getTimeToHurt()) return false; + } + if (hasTimeToLava() != other.hasTimeToLava()) return false; + if (hasTimeToLava()) { + if (getTimeToLava() + != other.getTimeToLava()) return false; + } + if (hasTimeToExplode() != other.hasTimeToExplode()) return false; + if (hasTimeToExplode()) { + if (getTimeToExplode() + != other.getTimeToExplode()) return false; + } + if (!getComponentsList() + .equals(other.getComponentsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + START_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getStart()); + hash = (37 * hash) + END_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getEnd()); + hash = (37 * hash) + TOTALEU_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalEU()); + hash = (37 * hash) + MINEUPT_FIELD_NUMBER; + hash = (53 * hash) + getMinEUpT(); + hash = (37 * hash) + MAXEUPT_FIELD_NUMBER; + hash = (53 * hash) + getMaxEUpT(); + hash = (37 * hash) + TOTALHU_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalHU()); + hash = (37 * hash) + MINHUPS_FIELD_NUMBER; + hash = (53 * hash) + getMinHUpS(); + hash = (37 * hash) + MAXHUPS_FIELD_NUMBER; + hash = (53 * hash) + getMaxHUpS(); + hash = (37 * hash) + TOTALTEMPSECS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalTempSecs()); + hash = (37 * hash) + MINTEMP_FIELD_NUMBER; + hash = (53 * hash) + getMinTemp(); + hash = (37 * hash) + MAXTEMP_FIELD_NUMBER; + hash = (53 * hash) + getMaxTemp(); + hash = (37 * hash) + TOTALHULLHEATING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalHullHeating()); + hash = (37 * hash) + TOTALHULLCOOLING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalHullCooling()); + hash = (37 * hash) + SIMTIME_FIELD_NUMBER; + hash = (53 * hash) + getSimTime(); + hash = (37 * hash) + ACTIVETIME_FIELD_NUMBER; + hash = (53 * hash) + getActiveTime(); + hash = (37 * hash) + PAUSEDTIME_FIELD_NUMBER; + hash = (53 * hash) + getPausedTime(); + if (hasTimeToNormal()) { + hash = (37 * hash) + TIMETONORMAL_FIELD_NUMBER; + hash = (53 * hash) + getTimeToNormal(); + } + if (hasTimeToBurn()) { + hash = (37 * hash) + TIMETOBURN_FIELD_NUMBER; + hash = (53 * hash) + getTimeToBurn(); + } + if (hasTimeToEvaporate()) { + hash = (37 * hash) + TIMETOEVAPORATE_FIELD_NUMBER; + hash = (53 * hash) + getTimeToEvaporate(); + } + if (hasTimeToHurt()) { + hash = (37 * hash) + TIMETOHURT_FIELD_NUMBER; + hash = (53 * hash) + getTimeToHurt(); + } + if (hasTimeToLava()) { + hash = (37 * hash) + TIMETOLAVA_FIELD_NUMBER; + hash = (53 * hash) + getTimeToLava(); + } + if (hasTimeToExplode()) { + hash = (37 * hash) + TIMETOEXPLODE_FIELD_NUMBER; + hash = (53 * hash) + getTimeToExplode(); + } + if (getComponentsCount() > 0) { + hash = (37 * hash) + COMPONENTS_FIELD_NUMBER; + hash = (53 * hash) + getComponentsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code SimulationResult} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:SimulationResult) + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.Builder.class); + } + + // Construct using com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + start_ = 0L; + end_ = 0L; + totalEU_ = 0L; + minEUpT_ = 0; + maxEUpT_ = 0; + totalHU_ = 0L; + minHUpS_ = 0; + maxHUpS_ = 0; + totalTempSecs_ = 0L; + minTemp_ = 0; + maxTemp_ = 0; + totalHullHeating_ = 0L; + totalHullCooling_ = 0L; + simTime_ = 0; + activeTime_ = 0; + pausedTime_ = 0; + timeToNormal_ = 0; + timeToBurn_ = 0; + timeToEvaporate_ = 0; + timeToHurt_ = 0; + timeToLava_ = 0; + timeToExplode_ = 0; + if (componentsBuilder_ == null) { + components_ = java.util.Collections.emptyList(); + } else { + components_ = null; + componentsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00400000); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_SimulationResult_descriptor; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult getDefaultInstanceForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.getDefaultInstance(); + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult build() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult buildPartial() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult result = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult result) { + if (componentsBuilder_ == null) { + if (((bitField0_ & 0x00400000) != 0)) { + components_ = java.util.Collections.unmodifiableList(components_); + bitField0_ = (bitField0_ & ~0x00400000); + } + result.components_ = components_; + } else { + result.components_ = componentsBuilder_.build(); + } + } + + private void buildPartial0(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.start_ = start_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.end_ = end_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.totalEU_ = totalEU_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.minEUpT_ = minEUpT_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.maxEUpT_ = maxEUpT_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.totalHU_ = totalHU_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.minHUpS_ = minHUpS_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.maxHUpS_ = maxHUpS_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.totalTempSecs_ = totalTempSecs_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.minTemp_ = minTemp_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.maxTemp_ = maxTemp_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.totalHullHeating_ = totalHullHeating_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.totalHullCooling_ = totalHullCooling_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.simTime_ = simTime_; + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.activeTime_ = activeTime_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.pausedTime_ = pausedTime_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00010000) != 0)) { + result.timeToNormal_ = timeToNormal_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00020000) != 0)) { + result.timeToBurn_ = timeToBurn_; + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00040000) != 0)) { + result.timeToEvaporate_ = timeToEvaporate_; + to_bitField0_ |= 0x00000004; + } + if (((from_bitField0_ & 0x00080000) != 0)) { + result.timeToHurt_ = timeToHurt_; + to_bitField0_ |= 0x00000008; + } + if (((from_bitField0_ & 0x00100000) != 0)) { + result.timeToLava_ = timeToLava_; + to_bitField0_ |= 0x00000010; + } + if (((from_bitField0_ & 0x00200000) != 0)) { + result.timeToExplode_ = timeToExplode_; + to_bitField0_ |= 0x00000020; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult) { + return mergeFrom((com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult other) { + if (other == com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult.getDefaultInstance()) return this; + if (other.getStart() != 0L) { + setStart(other.getStart()); + } + if (other.getEnd() != 0L) { + setEnd(other.getEnd()); + } + if (other.getTotalEU() != 0L) { + setTotalEU(other.getTotalEU()); + } + if (other.getMinEUpT() != 0) { + setMinEUpT(other.getMinEUpT()); + } + if (other.getMaxEUpT() != 0) { + setMaxEUpT(other.getMaxEUpT()); + } + if (other.getTotalHU() != 0L) { + setTotalHU(other.getTotalHU()); + } + if (other.getMinHUpS() != 0) { + setMinHUpS(other.getMinHUpS()); + } + if (other.getMaxHUpS() != 0) { + setMaxHUpS(other.getMaxHUpS()); + } + if (other.getTotalTempSecs() != 0L) { + setTotalTempSecs(other.getTotalTempSecs()); + } + if (other.getMinTemp() != 0) { + setMinTemp(other.getMinTemp()); + } + if (other.getMaxTemp() != 0) { + setMaxTemp(other.getMaxTemp()); + } + if (other.getTotalHullHeating() != 0L) { + setTotalHullHeating(other.getTotalHullHeating()); + } + if (other.getTotalHullCooling() != 0L) { + setTotalHullCooling(other.getTotalHullCooling()); + } + if (other.getSimTime() != 0) { + setSimTime(other.getSimTime()); + } + if (other.getActiveTime() != 0) { + setActiveTime(other.getActiveTime()); + } + if (other.getPausedTime() != 0) { + setPausedTime(other.getPausedTime()); + } + if (other.hasTimeToNormal()) { + setTimeToNormal(other.getTimeToNormal()); + } + if (other.hasTimeToBurn()) { + setTimeToBurn(other.getTimeToBurn()); + } + if (other.hasTimeToEvaporate()) { + setTimeToEvaporate(other.getTimeToEvaporate()); + } + if (other.hasTimeToHurt()) { + setTimeToHurt(other.getTimeToHurt()); + } + if (other.hasTimeToLava()) { + setTimeToLava(other.getTimeToLava()); + } + if (other.hasTimeToExplode()) { + setTimeToExplode(other.getTimeToExplode()); + } + if (componentsBuilder_ == null) { + if (!other.components_.isEmpty()) { + if (components_.isEmpty()) { + components_ = other.components_; + bitField0_ = (bitField0_ & ~0x00400000); + } else { + ensureComponentsIsMutable(); + components_.addAll(other.components_); + } + onChanged(); + } + } else { + if (!other.components_.isEmpty()) { + if (componentsBuilder_.isEmpty()) { + componentsBuilder_.dispose(); + componentsBuilder_ = null; + components_ = other.components_; + bitField0_ = (bitField0_ & ~0x00400000); + componentsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getComponentsFieldBuilder() : null; + } else { + componentsBuilder_.addAllMessages(other.components_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + start_ = input.readInt64(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + end_ = input.readInt64(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + totalEU_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + minEUpT_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + maxEUpT_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + totalHU_ = input.readInt64(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + minHUpS_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + maxHUpS_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + totalTempSecs_ = input.readInt64(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + minTemp_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + maxTemp_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + totalHullHeating_ = input.readInt64(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + totalHullCooling_ = input.readInt64(); + bitField0_ |= 0x00001000; + break; + } // case 104 + case 112: { + simTime_ = input.readInt32(); + bitField0_ |= 0x00002000; + break; + } // case 112 + case 120: { + activeTime_ = input.readInt32(); + bitField0_ |= 0x00004000; + break; + } // case 120 + case 128: { + pausedTime_ = input.readInt32(); + bitField0_ |= 0x00008000; + break; + } // case 128 + case 136: { + timeToNormal_ = input.readInt32(); + bitField0_ |= 0x00010000; + break; + } // case 136 + case 144: { + timeToBurn_ = input.readInt32(); + bitField0_ |= 0x00020000; + break; + } // case 144 + case 152: { + timeToEvaporate_ = input.readInt32(); + bitField0_ |= 0x00040000; + break; + } // case 152 + case 160: { + timeToHurt_ = input.readInt32(); + bitField0_ |= 0x00080000; + break; + } // case 160 + case 168: { + timeToLava_ = input.readInt32(); + bitField0_ |= 0x00100000; + break; + } // case 168 + case 176: { + timeToExplode_ = input.readInt32(); + bitField0_ |= 0x00200000; + break; + } // case 176 + case 186: { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult m = + input.readMessage( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.parser(), + extensionRegistry); + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(m); + } else { + componentsBuilder_.addMessage(m); + } + break; + } // case 186 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private long start_ ; + /** + * int64 start = 1; + * @return The start. + */ + @java.lang.Override + public long getStart() { + return start_; + } + /** + * int64 start = 1; + * @param value The start to set. + * @return This builder for chaining. + */ + public Builder setStart(long value) { + + start_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int64 start = 1; + * @return This builder for chaining. + */ + public Builder clearStart() { + bitField0_ = (bitField0_ & ~0x00000001); + start_ = 0L; + onChanged(); + return this; + } + + private long end_ ; + /** + * int64 end = 2; + * @return The end. + */ + @java.lang.Override + public long getEnd() { + return end_; + } + /** + * int64 end = 2; + * @param value The end to set. + * @return This builder for chaining. + */ + public Builder setEnd(long value) { + + end_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int64 end = 2; + * @return This builder for chaining. + */ + public Builder clearEnd() { + bitField0_ = (bitField0_ & ~0x00000002); + end_ = 0L; + onChanged(); + return this; + } + + private long totalEU_ ; + /** + * int64 totalEU = 3; + * @return The totalEU. + */ + @java.lang.Override + public long getTotalEU() { + return totalEU_; + } + /** + * int64 totalEU = 3; + * @param value The totalEU to set. + * @return This builder for chaining. + */ + public Builder setTotalEU(long value) { + + totalEU_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int64 totalEU = 3; + * @return This builder for chaining. + */ + public Builder clearTotalEU() { + bitField0_ = (bitField0_ & ~0x00000004); + totalEU_ = 0L; + onChanged(); + return this; + } + + private int minEUpT_ ; + /** + * int32 minEUpT = 4; + * @return The minEUpT. + */ + @java.lang.Override + public int getMinEUpT() { + return minEUpT_; + } + /** + * int32 minEUpT = 4; + * @param value The minEUpT to set. + * @return This builder for chaining. + */ + public Builder setMinEUpT(int value) { + + minEUpT_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 minEUpT = 4; + * @return This builder for chaining. + */ + public Builder clearMinEUpT() { + bitField0_ = (bitField0_ & ~0x00000008); + minEUpT_ = 0; + onChanged(); + return this; + } + + private int maxEUpT_ ; + /** + * int32 maxEUpT = 5; + * @return The maxEUpT. + */ + @java.lang.Override + public int getMaxEUpT() { + return maxEUpT_; + } + /** + * int32 maxEUpT = 5; + * @param value The maxEUpT to set. + * @return This builder for chaining. + */ + public Builder setMaxEUpT(int value) { + + maxEUpT_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 maxEUpT = 5; + * @return This builder for chaining. + */ + public Builder clearMaxEUpT() { + bitField0_ = (bitField0_ & ~0x00000010); + maxEUpT_ = 0; + onChanged(); + return this; + } + + private long totalHU_ ; + /** + * int64 totalHU = 6; + * @return The totalHU. + */ + @java.lang.Override + public long getTotalHU() { + return totalHU_; + } + /** + * int64 totalHU = 6; + * @param value The totalHU to set. + * @return This builder for chaining. + */ + public Builder setTotalHU(long value) { + + totalHU_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int64 totalHU = 6; + * @return This builder for chaining. + */ + public Builder clearTotalHU() { + bitField0_ = (bitField0_ & ~0x00000020); + totalHU_ = 0L; + onChanged(); + return this; + } + + private int minHUpS_ ; + /** + * int32 minHUpS = 7; + * @return The minHUpS. + */ + @java.lang.Override + public int getMinHUpS() { + return minHUpS_; + } + /** + * int32 minHUpS = 7; + * @param value The minHUpS to set. + * @return This builder for chaining. + */ + public Builder setMinHUpS(int value) { + + minHUpS_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 minHUpS = 7; + * @return This builder for chaining. + */ + public Builder clearMinHUpS() { + bitField0_ = (bitField0_ & ~0x00000040); + minHUpS_ = 0; + onChanged(); + return this; + } + + private int maxHUpS_ ; + /** + * int32 maxHUpS = 8; + * @return The maxHUpS. + */ + @java.lang.Override + public int getMaxHUpS() { + return maxHUpS_; + } + /** + * int32 maxHUpS = 8; + * @param value The maxHUpS to set. + * @return This builder for chaining. + */ + public Builder setMaxHUpS(int value) { + + maxHUpS_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 maxHUpS = 8; + * @return This builder for chaining. + */ + public Builder clearMaxHUpS() { + bitField0_ = (bitField0_ & ~0x00000080); + maxHUpS_ = 0; + onChanged(); + return this; + } + + private long totalTempSecs_ ; + /** + * int64 totalTempSecs = 9; + * @return The totalTempSecs. + */ + @java.lang.Override + public long getTotalTempSecs() { + return totalTempSecs_; + } + /** + * int64 totalTempSecs = 9; + * @param value The totalTempSecs to set. + * @return This builder for chaining. + */ + public Builder setTotalTempSecs(long value) { + + totalTempSecs_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * int64 totalTempSecs = 9; + * @return This builder for chaining. + */ + public Builder clearTotalTempSecs() { + bitField0_ = (bitField0_ & ~0x00000100); + totalTempSecs_ = 0L; + onChanged(); + return this; + } + + private int minTemp_ ; + /** + * int32 minTemp = 10; + * @return The minTemp. + */ + @java.lang.Override + public int getMinTemp() { + return minTemp_; + } + /** + * int32 minTemp = 10; + * @param value The minTemp to set. + * @return This builder for chaining. + */ + public Builder setMinTemp(int value) { + + minTemp_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * int32 minTemp = 10; + * @return This builder for chaining. + */ + public Builder clearMinTemp() { + bitField0_ = (bitField0_ & ~0x00000200); + minTemp_ = 0; + onChanged(); + return this; + } + + private int maxTemp_ ; + /** + * int32 maxTemp = 11; + * @return The maxTemp. + */ + @java.lang.Override + public int getMaxTemp() { + return maxTemp_; + } + /** + * int32 maxTemp = 11; + * @param value The maxTemp to set. + * @return This builder for chaining. + */ + public Builder setMaxTemp(int value) { + + maxTemp_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * int32 maxTemp = 11; + * @return This builder for chaining. + */ + public Builder clearMaxTemp() { + bitField0_ = (bitField0_ & ~0x00000400); + maxTemp_ = 0; + onChanged(); + return this; + } + + private long totalHullHeating_ ; + /** + * int64 totalHullHeating = 12; + * @return The totalHullHeating. + */ + @java.lang.Override + public long getTotalHullHeating() { + return totalHullHeating_; + } + /** + * int64 totalHullHeating = 12; + * @param value The totalHullHeating to set. + * @return This builder for chaining. + */ + public Builder setTotalHullHeating(long value) { + + totalHullHeating_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + * int64 totalHullHeating = 12; + * @return This builder for chaining. + */ + public Builder clearTotalHullHeating() { + bitField0_ = (bitField0_ & ~0x00000800); + totalHullHeating_ = 0L; + onChanged(); + return this; + } + + private long totalHullCooling_ ; + /** + * int64 totalHullCooling = 13; + * @return The totalHullCooling. + */ + @java.lang.Override + public long getTotalHullCooling() { + return totalHullCooling_; + } + /** + * int64 totalHullCooling = 13; + * @param value The totalHullCooling to set. + * @return This builder for chaining. + */ + public Builder setTotalHullCooling(long value) { + + totalHullCooling_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * int64 totalHullCooling = 13; + * @return This builder for chaining. + */ + public Builder clearTotalHullCooling() { + bitField0_ = (bitField0_ & ~0x00001000); + totalHullCooling_ = 0L; + onChanged(); + return this; + } + + private int simTime_ ; + /** + * int32 simTime = 14; + * @return The simTime. + */ + @java.lang.Override + public int getSimTime() { + return simTime_; + } + /** + * int32 simTime = 14; + * @param value The simTime to set. + * @return This builder for chaining. + */ + public Builder setSimTime(int value) { + + simTime_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * int32 simTime = 14; + * @return This builder for chaining. + */ + public Builder clearSimTime() { + bitField0_ = (bitField0_ & ~0x00002000); + simTime_ = 0; + onChanged(); + return this; + } + + private int activeTime_ ; + /** + * int32 activeTime = 15; + * @return The activeTime. + */ + @java.lang.Override + public int getActiveTime() { + return activeTime_; + } + /** + * int32 activeTime = 15; + * @param value The activeTime to set. + * @return This builder for chaining. + */ + public Builder setActiveTime(int value) { + + activeTime_ = value; + bitField0_ |= 0x00004000; + onChanged(); + return this; + } + /** + * int32 activeTime = 15; + * @return This builder for chaining. + */ + public Builder clearActiveTime() { + bitField0_ = (bitField0_ & ~0x00004000); + activeTime_ = 0; + onChanged(); + return this; + } + + private int pausedTime_ ; + /** + * int32 pausedTime = 16; + * @return The pausedTime. + */ + @java.lang.Override + public int getPausedTime() { + return pausedTime_; + } + /** + * int32 pausedTime = 16; + * @param value The pausedTime to set. + * @return This builder for chaining. + */ + public Builder setPausedTime(int value) { + + pausedTime_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + * int32 pausedTime = 16; + * @return This builder for chaining. + */ + public Builder clearPausedTime() { + bitField0_ = (bitField0_ & ~0x00008000); + pausedTime_ = 0; + onChanged(); + return this; + } + + private int timeToNormal_ ; + /** + * optional int32 timeToNormal = 17; + * @return Whether the timeToNormal field is set. + */ + @java.lang.Override + public boolean hasTimeToNormal() { + return ((bitField0_ & 0x00010000) != 0); + } + /** + * optional int32 timeToNormal = 17; + * @return The timeToNormal. + */ + @java.lang.Override + public int getTimeToNormal() { + return timeToNormal_; + } + /** + * optional int32 timeToNormal = 17; + * @param value The timeToNormal to set. + * @return This builder for chaining. + */ + public Builder setTimeToNormal(int value) { + + timeToNormal_ = value; + bitField0_ |= 0x00010000; + onChanged(); + return this; + } + /** + * optional int32 timeToNormal = 17; + * @return This builder for chaining. + */ + public Builder clearTimeToNormal() { + bitField0_ = (bitField0_ & ~0x00010000); + timeToNormal_ = 0; + onChanged(); + return this; + } + + private int timeToBurn_ ; + /** + * optional int32 timeToBurn = 18; + * @return Whether the timeToBurn field is set. + */ + @java.lang.Override + public boolean hasTimeToBurn() { + return ((bitField0_ & 0x00020000) != 0); + } + /** + * optional int32 timeToBurn = 18; + * @return The timeToBurn. + */ + @java.lang.Override + public int getTimeToBurn() { + return timeToBurn_; + } + /** + * optional int32 timeToBurn = 18; + * @param value The timeToBurn to set. + * @return This builder for chaining. + */ + public Builder setTimeToBurn(int value) { + + timeToBurn_ = value; + bitField0_ |= 0x00020000; + onChanged(); + return this; + } + /** + * optional int32 timeToBurn = 18; + * @return This builder for chaining. + */ + public Builder clearTimeToBurn() { + bitField0_ = (bitField0_ & ~0x00020000); + timeToBurn_ = 0; + onChanged(); + return this; + } + + private int timeToEvaporate_ ; + /** + * optional int32 timeToEvaporate = 19; + * @return Whether the timeToEvaporate field is set. + */ + @java.lang.Override + public boolean hasTimeToEvaporate() { + return ((bitField0_ & 0x00040000) != 0); + } + /** + * optional int32 timeToEvaporate = 19; + * @return The timeToEvaporate. + */ + @java.lang.Override + public int getTimeToEvaporate() { + return timeToEvaporate_; + } + /** + * optional int32 timeToEvaporate = 19; + * @param value The timeToEvaporate to set. + * @return This builder for chaining. + */ + public Builder setTimeToEvaporate(int value) { + + timeToEvaporate_ = value; + bitField0_ |= 0x00040000; + onChanged(); + return this; + } + /** + * optional int32 timeToEvaporate = 19; + * @return This builder for chaining. + */ + public Builder clearTimeToEvaporate() { + bitField0_ = (bitField0_ & ~0x00040000); + timeToEvaporate_ = 0; + onChanged(); + return this; + } + + private int timeToHurt_ ; + /** + * optional int32 timeToHurt = 20; + * @return Whether the timeToHurt field is set. + */ + @java.lang.Override + public boolean hasTimeToHurt() { + return ((bitField0_ & 0x00080000) != 0); + } + /** + * optional int32 timeToHurt = 20; + * @return The timeToHurt. + */ + @java.lang.Override + public int getTimeToHurt() { + return timeToHurt_; + } + /** + * optional int32 timeToHurt = 20; + * @param value The timeToHurt to set. + * @return This builder for chaining. + */ + public Builder setTimeToHurt(int value) { + + timeToHurt_ = value; + bitField0_ |= 0x00080000; + onChanged(); + return this; + } + /** + * optional int32 timeToHurt = 20; + * @return This builder for chaining. + */ + public Builder clearTimeToHurt() { + bitField0_ = (bitField0_ & ~0x00080000); + timeToHurt_ = 0; + onChanged(); + return this; + } + + private int timeToLava_ ; + /** + * optional int32 timeToLava = 21; + * @return Whether the timeToLava field is set. + */ + @java.lang.Override + public boolean hasTimeToLava() { + return ((bitField0_ & 0x00100000) != 0); + } + /** + * optional int32 timeToLava = 21; + * @return The timeToLava. + */ + @java.lang.Override + public int getTimeToLava() { + return timeToLava_; + } + /** + * optional int32 timeToLava = 21; + * @param value The timeToLava to set. + * @return This builder for chaining. + */ + public Builder setTimeToLava(int value) { + + timeToLava_ = value; + bitField0_ |= 0x00100000; + onChanged(); + return this; + } + /** + * optional int32 timeToLava = 21; + * @return This builder for chaining. + */ + public Builder clearTimeToLava() { + bitField0_ = (bitField0_ & ~0x00100000); + timeToLava_ = 0; + onChanged(); + return this; + } + + private int timeToExplode_ ; + /** + * optional int32 timeToExplode = 22; + * @return Whether the timeToExplode field is set. + */ + @java.lang.Override + public boolean hasTimeToExplode() { + return ((bitField0_ & 0x00200000) != 0); + } + /** + * optional int32 timeToExplode = 22; + * @return The timeToExplode. + */ + @java.lang.Override + public int getTimeToExplode() { + return timeToExplode_; + } + /** + * optional int32 timeToExplode = 22; + * @param value The timeToExplode to set. + * @return This builder for chaining. + */ + public Builder setTimeToExplode(int value) { + + timeToExplode_ = value; + bitField0_ |= 0x00200000; + onChanged(); + return this; + } + /** + * optional int32 timeToExplode = 22; + * @return This builder for chaining. + */ + public Builder clearTimeToExplode() { + bitField0_ = (bitField0_ & ~0x00200000); + timeToExplode_ = 0; + onChanged(); + return this; + } + + private java.util.List components_ = + java.util.Collections.emptyList(); + private void ensureComponentsIsMutable() { + if (!((bitField0_ & 0x00400000) != 0)) { + components_ = new java.util.ArrayList(components_); + bitField0_ |= 0x00400000; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder> componentsBuilder_; + + /** + * repeated .ComponentResult components = 23; + */ + public java.util.List getComponentsList() { + if (componentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(components_); + } else { + return componentsBuilder_.getMessageList(); + } + } + /** + * repeated .ComponentResult components = 23; + */ + public int getComponentsCount() { + if (componentsBuilder_ == null) { + return components_.size(); + } else { + return componentsBuilder_.getCount(); + } + } + /** + * repeated .ComponentResult components = 23; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getComponents(int index) { + if (componentsBuilder_ == null) { + return components_.get(index); + } else { + return componentsBuilder_.getMessage(index); + } + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder setComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.set(index, value); + onChanged(); + } else { + componentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder setComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.set(index, builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder addComponents(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.add(value); + onChanged(); + } else { + componentsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder addComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult value) { + if (componentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureComponentsIsMutable(); + components_.add(index, value); + onChanged(); + } else { + componentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder addComponents( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder addComponents( + int index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder builderForValue) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.add(index, builderForValue.build()); + onChanged(); + } else { + componentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder addAllComponents( + java.lang.Iterable values) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, components_); + onChanged(); + } else { + componentsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder clearComponents() { + if (componentsBuilder_ == null) { + components_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00400000); + onChanged(); + } else { + componentsBuilder_.clear(); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public Builder removeComponents(int index) { + if (componentsBuilder_ == null) { + ensureComponentsIsMutable(); + components_.remove(index); + onChanged(); + } else { + componentsBuilder_.remove(index); + } + return this; + } + /** + * repeated .ComponentResult components = 23; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder getComponentsBuilder( + int index) { + return getComponentsFieldBuilder().getBuilder(index); + } + /** + * repeated .ComponentResult components = 23; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder getComponentsOrBuilder( + int index) { + if (componentsBuilder_ == null) { + return components_.get(index); } else { + return componentsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .ComponentResult components = 23; + */ + public java.util.List + getComponentsOrBuilderList() { + if (componentsBuilder_ != null) { + return componentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(components_); + } + } + /** + * repeated .ComponentResult components = 23; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder addComponentsBuilder() { + return getComponentsFieldBuilder().addBuilder( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.getDefaultInstance()); + } + /** + * repeated .ComponentResult components = 23; + */ + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder addComponentsBuilder( + int index) { + return getComponentsFieldBuilder().addBuilder( + index, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.getDefaultInstance()); + } + /** + * repeated .ComponentResult components = 23; + */ + public java.util.List + getComponentsBuilderList() { + return getComponentsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder> + getComponentsFieldBuilder() { + if (componentsBuilder_ == null) { + componentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder>( + components_, + ((bitField0_ & 0x00400000) != 0), + getParentForChildren(), + isClean()); + components_ = null; + } + return componentsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:SimulationResult) + } + + // @@protoc_insertion_point(class_scope:SimulationResult) + private static final com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult(); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SimulationResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.SimulationResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ComponentResultOrBuilder extends + // @@protoc_insertion_point(interface_extends:ComponentResult) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 index = 1; + * @return The index. + */ + int getIndex(); + + /** + * int64 totalAirHeating = 2; + * @return The totalAirHeating. + */ + long getTotalAirHeating(); + + /** + * int64 totalHullHeating = 3; + * @return The totalHullHeating. + */ + long getTotalHullHeating(); + + /** + * int64 totalHullCooling = 4; + * @return The totalHullCooling. + */ + long getTotalHullCooling(); + + /** + * int64 totalTempSecs = 5; + * @return The totalTempSecs. + */ + long getTotalTempSecs(); + + /** + * int32 minTemp = 6; + * @return The minTemp. + */ + int getMinTemp(); + + /** + * int32 maxTemp = 7; + * @return The maxTemp. + */ + int getMaxTemp(); + + /** + * int32 replaceCount = 8; + * @return The replaceCount. + */ + int getReplaceCount(); + + /** + * int64 totalEUOutput = 9; + * @return The totalEUOutput. + */ + long getTotalEUOutput(); + } + /** + * Protobuf type {@code ComponentResult} + */ + public static final class ComponentResult extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ComponentResult) + ComponentResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComponentResult.newBuilder() to construct. + private ComponentResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ComponentResult() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ComponentResult(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder.class); + } + + public static final int INDEX_FIELD_NUMBER = 1; + private int index_ = 0; + /** + * int32 index = 1; + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + + public static final int TOTALAIRHEATING_FIELD_NUMBER = 2; + private long totalAirHeating_ = 0L; + /** + * int64 totalAirHeating = 2; + * @return The totalAirHeating. + */ + @java.lang.Override + public long getTotalAirHeating() { + return totalAirHeating_; + } + + public static final int TOTALHULLHEATING_FIELD_NUMBER = 3; + private long totalHullHeating_ = 0L; + /** + * int64 totalHullHeating = 3; + * @return The totalHullHeating. + */ + @java.lang.Override + public long getTotalHullHeating() { + return totalHullHeating_; + } + + public static final int TOTALHULLCOOLING_FIELD_NUMBER = 4; + private long totalHullCooling_ = 0L; + /** + * int64 totalHullCooling = 4; + * @return The totalHullCooling. + */ + @java.lang.Override + public long getTotalHullCooling() { + return totalHullCooling_; + } + + public static final int TOTALTEMPSECS_FIELD_NUMBER = 5; + private long totalTempSecs_ = 0L; + /** + * int64 totalTempSecs = 5; + * @return The totalTempSecs. + */ + @java.lang.Override + public long getTotalTempSecs() { + return totalTempSecs_; + } + + public static final int MINTEMP_FIELD_NUMBER = 6; + private int minTemp_ = 0; + /** + * int32 minTemp = 6; + * @return The minTemp. + */ + @java.lang.Override + public int getMinTemp() { + return minTemp_; + } + + public static final int MAXTEMP_FIELD_NUMBER = 7; + private int maxTemp_ = 0; + /** + * int32 maxTemp = 7; + * @return The maxTemp. + */ + @java.lang.Override + public int getMaxTemp() { + return maxTemp_; + } + + public static final int REPLACECOUNT_FIELD_NUMBER = 8; + private int replaceCount_ = 0; + /** + * int32 replaceCount = 8; + * @return The replaceCount. + */ + @java.lang.Override + public int getReplaceCount() { + return replaceCount_; + } + + public static final int TOTALEUOUTPUT_FIELD_NUMBER = 9; + private long totalEUOutput_ = 0L; + /** + * int64 totalEUOutput = 9; + * @return The totalEUOutput. + */ + @java.lang.Override + public long getTotalEUOutput() { + return totalEUOutput_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (index_ != 0) { + output.writeInt32(1, index_); + } + if (totalAirHeating_ != 0L) { + output.writeInt64(2, totalAirHeating_); + } + if (totalHullHeating_ != 0L) { + output.writeInt64(3, totalHullHeating_); + } + if (totalHullCooling_ != 0L) { + output.writeInt64(4, totalHullCooling_); + } + if (totalTempSecs_ != 0L) { + output.writeInt64(5, totalTempSecs_); + } + if (minTemp_ != 0) { + output.writeInt32(6, minTemp_); + } + if (maxTemp_ != 0) { + output.writeInt32(7, maxTemp_); + } + if (replaceCount_ != 0) { + output.writeInt32(8, replaceCount_); + } + if (totalEUOutput_ != 0L) { + output.writeInt64(9, totalEUOutput_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (index_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, index_); + } + if (totalAirHeating_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, totalAirHeating_); + } + if (totalHullHeating_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, totalHullHeating_); + } + if (totalHullCooling_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, totalHullCooling_); + } + if (totalTempSecs_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, totalTempSecs_); + } + if (minTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, minTemp_); + } + if (maxTemp_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, maxTemp_); + } + if (replaceCount_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, replaceCount_); + } + if (totalEUOutput_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(9, totalEUOutput_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult)) { + return super.equals(obj); + } + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult other = (com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult) obj; + + if (getIndex() + != other.getIndex()) return false; + if (getTotalAirHeating() + != other.getTotalAirHeating()) return false; + if (getTotalHullHeating() + != other.getTotalHullHeating()) return false; + if (getTotalHullCooling() + != other.getTotalHullCooling()) return false; + if (getTotalTempSecs() + != other.getTotalTempSecs()) return false; + if (getMinTemp() + != other.getMinTemp()) return false; + if (getMaxTemp() + != other.getMaxTemp()) return false; + if (getReplaceCount() + != other.getReplaceCount()) return false; + if (getTotalEUOutput() + != other.getTotalEUOutput()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + getIndex(); + hash = (37 * hash) + TOTALAIRHEATING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalAirHeating()); + hash = (37 * hash) + TOTALHULLHEATING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalHullHeating()); + hash = (37 * hash) + TOTALHULLCOOLING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalHullCooling()); + hash = (37 * hash) + TOTALTEMPSECS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalTempSecs()); + hash = (37 * hash) + MINTEMP_FIELD_NUMBER; + hash = (53 * hash) + getMinTemp(); + hash = (37 * hash) + MAXTEMP_FIELD_NUMBER; + hash = (53 * hash) + getMaxTemp(); + hash = (37 * hash) + REPLACECOUNT_FIELD_NUMBER; + hash = (53 * hash) + getReplaceCount(); + hash = (37 * hash) + TOTALEUOUTPUT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalEUOutput()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ComponentResult} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ComponentResult) + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.class, com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.Builder.class); + } + + // Construct using com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + index_ = 0; + totalAirHeating_ = 0L; + totalHullHeating_ = 0L; + totalHullCooling_ = 0L; + totalTempSecs_ = 0L; + minTemp_ = 0; + maxTemp_ = 0; + replaceCount_ = 0; + totalEUOutput_ = 0L; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.internal_static_ComponentResult_descriptor; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getDefaultInstanceForType() { + return com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.getDefaultInstance(); + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult build() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult buildPartial() { + com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult result = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.index_ = index_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.totalAirHeating_ = totalAirHeating_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.totalHullHeating_ = totalHullHeating_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.totalHullCooling_ = totalHullCooling_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.totalTempSecs_ = totalTempSecs_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.minTemp_ = minTemp_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.maxTemp_ = maxTemp_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.replaceCount_ = replaceCount_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.totalEUOutput_ = totalEUOutput_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult) { + return mergeFrom((com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult other) { + if (other == com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult.getDefaultInstance()) return this; + if (other.getIndex() != 0) { + setIndex(other.getIndex()); + } + if (other.getTotalAirHeating() != 0L) { + setTotalAirHeating(other.getTotalAirHeating()); + } + if (other.getTotalHullHeating() != 0L) { + setTotalHullHeating(other.getTotalHullHeating()); + } + if (other.getTotalHullCooling() != 0L) { + setTotalHullCooling(other.getTotalHullCooling()); + } + if (other.getTotalTempSecs() != 0L) { + setTotalTempSecs(other.getTotalTempSecs()); + } + if (other.getMinTemp() != 0) { + setMinTemp(other.getMinTemp()); + } + if (other.getMaxTemp() != 0) { + setMaxTemp(other.getMaxTemp()); + } + if (other.getReplaceCount() != 0) { + setReplaceCount(other.getReplaceCount()); + } + if (other.getTotalEUOutput() != 0L) { + setTotalEUOutput(other.getTotalEUOutput()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + index_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + totalAirHeating_ = input.readInt64(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + totalHullHeating_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + totalHullCooling_ = input.readInt64(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + totalTempSecs_ = input.readInt64(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + minTemp_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + maxTemp_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + replaceCount_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + totalEUOutput_ = input.readInt64(); + bitField0_ |= 0x00000100; + break; + } // case 72 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int index_ ; + /** + * int32 index = 1; + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + /** + * int32 index = 1; + * @param value The index to set. + * @return This builder for chaining. + */ + public Builder setIndex(int value) { + + index_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 index = 1; + * @return This builder for chaining. + */ + public Builder clearIndex() { + bitField0_ = (bitField0_ & ~0x00000001); + index_ = 0; + onChanged(); + return this; + } + + private long totalAirHeating_ ; + /** + * int64 totalAirHeating = 2; + * @return The totalAirHeating. + */ + @java.lang.Override + public long getTotalAirHeating() { + return totalAirHeating_; + } + /** + * int64 totalAirHeating = 2; + * @param value The totalAirHeating to set. + * @return This builder for chaining. + */ + public Builder setTotalAirHeating(long value) { + + totalAirHeating_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int64 totalAirHeating = 2; + * @return This builder for chaining. + */ + public Builder clearTotalAirHeating() { + bitField0_ = (bitField0_ & ~0x00000002); + totalAirHeating_ = 0L; + onChanged(); + return this; + } + + private long totalHullHeating_ ; + /** + * int64 totalHullHeating = 3; + * @return The totalHullHeating. + */ + @java.lang.Override + public long getTotalHullHeating() { + return totalHullHeating_; + } + /** + * int64 totalHullHeating = 3; + * @param value The totalHullHeating to set. + * @return This builder for chaining. + */ + public Builder setTotalHullHeating(long value) { + + totalHullHeating_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int64 totalHullHeating = 3; + * @return This builder for chaining. + */ + public Builder clearTotalHullHeating() { + bitField0_ = (bitField0_ & ~0x00000004); + totalHullHeating_ = 0L; + onChanged(); + return this; + } + + private long totalHullCooling_ ; + /** + * int64 totalHullCooling = 4; + * @return The totalHullCooling. + */ + @java.lang.Override + public long getTotalHullCooling() { + return totalHullCooling_; + } + /** + * int64 totalHullCooling = 4; + * @param value The totalHullCooling to set. + * @return This builder for chaining. + */ + public Builder setTotalHullCooling(long value) { + + totalHullCooling_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int64 totalHullCooling = 4; + * @return This builder for chaining. + */ + public Builder clearTotalHullCooling() { + bitField0_ = (bitField0_ & ~0x00000008); + totalHullCooling_ = 0L; + onChanged(); + return this; + } + + private long totalTempSecs_ ; + /** + * int64 totalTempSecs = 5; + * @return The totalTempSecs. + */ + @java.lang.Override + public long getTotalTempSecs() { + return totalTempSecs_; + } + /** + * int64 totalTempSecs = 5; + * @param value The totalTempSecs to set. + * @return This builder for chaining. + */ + public Builder setTotalTempSecs(long value) { + + totalTempSecs_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int64 totalTempSecs = 5; + * @return This builder for chaining. + */ + public Builder clearTotalTempSecs() { + bitField0_ = (bitField0_ & ~0x00000010); + totalTempSecs_ = 0L; + onChanged(); + return this; + } + + private int minTemp_ ; + /** + * int32 minTemp = 6; + * @return The minTemp. + */ + @java.lang.Override + public int getMinTemp() { + return minTemp_; + } + /** + * int32 minTemp = 6; + * @param value The minTemp to set. + * @return This builder for chaining. + */ + public Builder setMinTemp(int value) { + + minTemp_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 minTemp = 6; + * @return This builder for chaining. + */ + public Builder clearMinTemp() { + bitField0_ = (bitField0_ & ~0x00000020); + minTemp_ = 0; + onChanged(); + return this; + } + + private int maxTemp_ ; + /** + * int32 maxTemp = 7; + * @return The maxTemp. + */ + @java.lang.Override + public int getMaxTemp() { + return maxTemp_; + } + /** + * int32 maxTemp = 7; + * @param value The maxTemp to set. + * @return This builder for chaining. + */ + public Builder setMaxTemp(int value) { + + maxTemp_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 maxTemp = 7; + * @return This builder for chaining. + */ + public Builder clearMaxTemp() { + bitField0_ = (bitField0_ & ~0x00000040); + maxTemp_ = 0; + onChanged(); + return this; + } + + private int replaceCount_ ; + /** + * int32 replaceCount = 8; + * @return The replaceCount. + */ + @java.lang.Override + public int getReplaceCount() { + return replaceCount_; + } + /** + * int32 replaceCount = 8; + * @param value The replaceCount to set. + * @return This builder for chaining. + */ + public Builder setReplaceCount(int value) { + + replaceCount_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 replaceCount = 8; + * @return This builder for chaining. + */ + public Builder clearReplaceCount() { + bitField0_ = (bitField0_ & ~0x00000080); + replaceCount_ = 0; + onChanged(); + return this; + } + + private long totalEUOutput_ ; + /** + * int64 totalEUOutput = 9; + * @return The totalEUOutput. + */ + @java.lang.Override + public long getTotalEUOutput() { + return totalEUOutput_; + } + /** + * int64 totalEUOutput = 9; + * @param value The totalEUOutput to set. + * @return This builder for chaining. + */ + public Builder setTotalEUOutput(long value) { + + totalEUOutput_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * int64 totalEUOutput = 9; + * @return This builder for chaining. + */ + public Builder clearTotalEUOutput() { + bitField0_ = (bitField0_ & ~0x00000100); + totalEUOutput_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:ComponentResult) + } + + // @@protoc_insertion_point(class_scope:ComponentResult) + private static final com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult(); + } + + public static com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComponentResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.recursive_pineapple.nuclear_horizons.reactors.tile.simulator.SimulatorProtos.ComponentResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_SimulationConfig_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_SimulationConfig_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ComponentConfig_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ComponentConfig_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_SimulationResult_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_SimulationResult_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ComponentResult_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ComponentResult_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\njsrc/main/java/com/recursive_pineapple/" + + "nuclear_horizons/reactors/tile/simulator" + + "/SimulationConfigProto.proto\"\347\001\n\020Simulat" + + "ionConfig\022\016\n\006pulsed\030\001 \001(\010\022\021\n\tautomated\030\002" + + " \001(\010\022\r\n\005fluid\030\003 \001(\010\022\023\n\013initialHeat\030\004 \001(\005" + + "\022\017\n\007onPulse\030\005 \001(\005\022\020\n\010offPulse\030\006 \001(\005\022\023\n\013s" + + "uspendTemp\030\007 \001(\005\022\022\n\nresumeTemp\030\010 \001(\005\022\032\n\022" + + "maxSimulationTicks\030\t \001(\005\022$\n\ncomponents\030\n" + + " \003(\0132\020.ComponentConfig\"\216\001\n\017ComponentConf" + + "ig\022\r\n\005index\030\001 \001(\005\022\014\n\004item\030\002 \001(\005\022\025\n\rhasAu" + + "tomation\030\003 \001(\010\022\023\n\013initialHeat\030\004 \001(\005\022\034\n\024r" + + "eplacementThreshold\030\005 \001(\005\022\024\n\014reactorPaus" + + "e\030\006 \001(\005\"\344\004\n\020SimulationResult\022\r\n\005start\030\001 " + + "\001(\003\022\013\n\003end\030\002 \001(\003\022\017\n\007totalEU\030\003 \001(\003\022\017\n\007min" + + "EUpT\030\004 \001(\005\022\017\n\007maxEUpT\030\005 \001(\005\022\017\n\007totalHU\030\006" + + " \001(\003\022\017\n\007minHUpS\030\007 \001(\005\022\017\n\007maxHUpS\030\010 \001(\005\022\025" + + "\n\rtotalTempSecs\030\t \001(\003\022\017\n\007minTemp\030\n \001(\005\022\017" + + "\n\007maxTemp\030\013 \001(\005\022\030\n\020totalHullHeating\030\014 \001(" + + "\003\022\030\n\020totalHullCooling\030\r \001(\003\022\017\n\007simTime\030\016" + + " \001(\005\022\022\n\nactiveTime\030\017 \001(\005\022\022\n\npausedTime\030\020" + + " \001(\005\022\031\n\014timeToNormal\030\021 \001(\005H\000\210\001\001\022\027\n\ntimeT" + + "oBurn\030\022 \001(\005H\001\210\001\001\022\034\n\017timeToEvaporate\030\023 \001(" + + "\005H\002\210\001\001\022\027\n\ntimeToHurt\030\024 \001(\005H\003\210\001\001\022\027\n\ntimeT" + + "oLava\030\025 \001(\005H\004\210\001\001\022\032\n\rtimeToExplode\030\026 \001(\005H" + + "\005\210\001\001\022$\n\ncomponents\030\027 \003(\0132\020.ComponentResu" + + "ltB\017\n\r_timeToNormalB\r\n\013_timeToBurnB\022\n\020_t" + + "imeToEvaporateB\r\n\013_timeToHurtB\r\n\013_timeTo" + + "LavaB\020\n\016_timeToExplode\"\323\001\n\017ComponentResu" + + "lt\022\r\n\005index\030\001 \001(\005\022\027\n\017totalAirHeating\030\002 \001" + + "(\003\022\030\n\020totalHullHeating\030\003 \001(\003\022\030\n\020totalHul" + + "lCooling\030\004 \001(\003\022\025\n\rtotalTempSecs\030\005 \001(\003\022\017\n" + + "\007minTemp\030\006 \001(\005\022\017\n\007maxTemp\030\007 \001(\005\022\024\n\014repla" + + "ceCount\030\010 \001(\005\022\025\n\rtotalEUOutput\030\t \001(\003BS\n@" + + "com.recursive_pineapple.nuclear_horizons" + + ".reactors.tile.simulatorB\017SimulatorProto" + + "sb\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_SimulationConfig_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_SimulationConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_SimulationConfig_descriptor, + new java.lang.String[] { "Pulsed", "Automated", "Fluid", "InitialHeat", "OnPulse", "OffPulse", "SuspendTemp", "ResumeTemp", "MaxSimulationTicks", "Components", }); + internal_static_ComponentConfig_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_ComponentConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ComponentConfig_descriptor, + new java.lang.String[] { "Index", "Item", "HasAutomation", "InitialHeat", "ReplacementThreshold", "ReactorPause", }); + internal_static_SimulationResult_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_SimulationResult_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_SimulationResult_descriptor, + new java.lang.String[] { "Start", "End", "TotalEU", "MinEUpT", "MaxEUpT", "TotalHU", "MinHUpS", "MaxHUpS", "TotalTempSecs", "MinTemp", "MaxTemp", "TotalHullHeating", "TotalHullCooling", "SimTime", "ActiveTime", "PausedTime", "TimeToNormal", "TimeToBurn", "TimeToEvaporate", "TimeToHurt", "TimeToLava", "TimeToExplode", "Components", }); + internal_static_ComponentResult_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_ComponentResult_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ComponentResult_descriptor, + new java.lang.String[] { "Index", "TotalAirHeating", "TotalHullHeating", "TotalHullCooling", "TotalTempSecs", "MinTemp", "MaxTemp", "ReplaceCount", "TotalEUOutput", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/resources/assets/nuclear_horizons/lang/en_US.lang b/src/main/resources/assets/nuclear_horizons/lang/en_US.lang index e1554da..9a96c31 100644 --- a/src/main/resources/assets/nuclear_horizons/lang/en_US.lang +++ b/src/main/resources/assets/nuclear_horizons/lang/en_US.lang @@ -34,3 +34,93 @@ item.iridiumNeutronReflector.name=Iridium Neutron Reflector fluid.nh_coolant=Coolant fluid.nh_hot_coolant=Hot Coolant + +death.attack.hot_fluid.player=%1$s was fried to crisp + +nh_tooltip.durability=Durability: %1$,d / %2$,d +nh_tooltip.undestructable=Undestructable +nh_tooltip.stored_heat=Stored Heat: %1$,d / %2$,d +nh_tooltip.prelude=Every two seconds, this component will: +nh_tooltip.more_info=Hold Shift for more info. + +nh_tooltip.fuel_rod.gen_stats=Generate %1$,d * n * (n + 1) HU\nGenerate %2$,d * n * (n + 1) EU\nWhere n = %3$d + Number of adjacent rods and reflectors +nh_tooltip.fuel_rod.mox_stats=\nIf the reactor's hull heat is above 50%, the HU output will be multiplied by 2.\nThe EU output will always be multiplied by 1 + %1$f * (Current Heat / Max Heat). +nh_tooltip.fuel_rod.heat_epilogue=\nIf there are adjacent components which can contain heat, heat will be spread among them evenly.\nOtherwise, heat will be added to the reactor hull. + +nh_tooltip.mover.reactor_xfer=Transfer up to %d HU between the reactor and itself. +nh_tooltip.exchanger.comp_xfer=Transfer up to %d HU between its neighbours and itself. +nh_tooltip.vent.void_self=Dissipate up to %d HU from itself. +nh_tooltip.vent.void_adj=Dissipate up to %d HU from its neighbours. +nh_tooltip.vent.fluid_disclaimer=Note: In a fluid reactor, each HU vented is converted to 2 HU (2mB) of hot coolant. + +nh_tooltip.results.title=\nSimulation Results: +nh_tooltip.sim.results.avg_temp=Avg Temp: %s +nh_tooltip.sim.results.min_temp=Min Temp: %s +nh_tooltip.sim.results.max_temp=Max Temp: %s +nh_tooltip.sim.results.avg_hull_cooling=Avg Hull Cooling: %s +nh_tooltip.sim.results.avg_hull_cooling_with_max=Avg Hull Cooling: %s / %s +nh_tooltip.sim.results.avg_hull_heating=Avg Hull Heating: %s +nh_tooltip.sim.results.heating_per_item=HU Per Item (Hull Only): %s +nh_tooltip.sim.results.avg_heat_output=Avg Heat Output: %s +nh_tooltip.sim.results.avg_heat_output_with_max=Avg Heat Output: %s / %s +nh_tooltip.sim.results.replace_count=Replaced %d times +nh_tooltip.sim.results.avg_power=Avg Power: %s +nh_tooltip.sim.results.power_per_item=Power Per Item: %s + +nh_gui.reactor.title=Nuclear Reactor +nh_gui.reactor.player_inv=Inventory +nh_gui.reactor.stored_hu=HU: %,d +nh_gui.reactor.eu_output=EU/t: %,d +nh_gui.reactor.hu_output=HU/s: %,d + +nh_gui.sim.results.title=Simulation Results +nh_gui.sim.results.no_results=No simulation results available +nh_gui.sim.results.runtime=Simulation ran for %s +nh_gui.sim.results.time_to_normal=Reached a normal temp. at %s +nh_gui.sim.results.time_to_burn=Reached burn threshold at %s +nh_gui.sim.results.time_to_evaporate=Reached evaporate threshold at %s +nh_gui.sim.results.time_to_hurt=Reached hurt threshold at %s +nh_gui.sim.results.time_to_lava=Reached lava threshold at %s +nh_gui.sim.results.time_to_explosion=Exploded at %s + +nh_gui.sim.title=Nuclear Reactor Simulator + +nh_gui.sim.actions.start=Start +nh_gui.sim.actions.cancel=Cancel +nh_gui.sim.actions.edit_comp_automation=right click to edit automation + +nh_gui.sim.results.none=N/A +nh_gui.sim.results.seconds=%,ds +nh_gui.sim.results.eu_per_tick=%,d EU/t +nh_gui.sim.results.hu_per_sec=%,d HU/s +nh_gui.sim.results.hu_total=%,d HU +nh_gui.sim.results.eu_total=%,d EU + +nh_gui.sim.results.active_time=Active time: %s +nh_gui.sim.results.inactive_time=Inactive time: %s +nh_gui.sim.results.avg_power=Avg Power: %s +nh_gui.sim.results.min_power=Min Power: %s +nh_gui.sim.results.max_power=Max Power: %s +nh_gui.sim.results.avg_vent_cooling=Avg Vent Cooling: %s +nh_gui.sim.results.min_vent_cooling=Min Vent Cooling: %s +nh_gui.sim.results.max_vent_cooling=Max Vent Cooling: %s +nh_gui.sim.results.avg_hull_temp=Avg Hull Temp: %s +nh_gui.sim.results.min_hull_temp=Min Hull Temp: %s +nh_gui.sim.results.max_hull_temp=Max Hull Temp: %s + +nh_gui.sim.settings.title=Reactor Settings +nh_gui.sim.settings.true=True +nh_gui.sim.settings.false=False +nh_gui.sim.settings.planner_code=Planner Code: +nh_gui.sim.settings.max_simulation_ticks=Max Simulation Ticks: +nh_gui.sim.settings.fluid=Fluid: +nh_gui.sim.settings.pulsed=Pulsed: +nh_gui.sim.settings.on_pulse=On Pulse: +nh_gui.sim.settings.off_pulse=Off Pulse: +nh_gui.sim.settings.suspend_temp=Suspend Temp: +nh_gui.sim.settings.resume_temp=Resume Temp: +nh_gui.sim.settings.initial_reactor_heat=Initial Reactor Heat: + +nh_gui.sim.comp_settings.title=Component Automation Settings +nh_gui.sim.comp_settings.active=Active Component: %s +nh_gui.sim.comp_settings.xy=X=%1$d Y=%2$d (Name=%3$s) diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber.png deleted file mode 100644 index dfcd0cd..0000000 Binary files a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber.png and /dev/null differ diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_side.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_side.png new file mode 100644 index 0000000..a9fa530 Binary files /dev/null and b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_side.png differ diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_top.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_top.png new file mode 100644 index 0000000..3646f7e Binary files /dev/null and b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_chamber_top.png differ diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side.png new file mode 100644 index 0000000..9f02b4f Binary files /dev/null and b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side.png differ diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png new file mode 100644 index 0000000..1a4f72d Binary files /dev/null and b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png differ diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png.mcmeta b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png.mcmeta new file mode 100644 index 0000000..0114da6 --- /dev/null +++ b/src/main/resources/assets/nuclear_horizons/textures/blocks/reactor_core_side_active.png.mcmeta @@ -0,0 +1,11 @@ +{ + "animation": { + "frametime": 20, + "frames": [ + 0, + 1, + 2, + 3 + ] + } +} diff --git a/src/main/resources/assets/nuclear_horizons/textures/blocks/thermal_sensor.png b/src/main/resources/assets/nuclear_horizons/textures/blocks/thermal_sensor.png index 8a72ea3..7a1621d 100644 Binary files a/src/main/resources/assets/nuclear_horizons/textures/blocks/thermal_sensor.png and b/src/main/resources/assets/nuclear_horizons/textures/blocks/thermal_sensor.png differ