fancier PWR gauges, larger PWRs, fixes, finite corium fluid

This commit is contained in:
Boblet 2023-08-24 16:38:55 +02:00
parent a4a570b10a
commit 549ecc0917
11 changed files with 153 additions and 18 deletions

View File

@ -10,6 +10,10 @@
* Liquid sodium
* Valid PWR coolant with high efficiency rating
* Made by liquefacting sodium
* Liquid thorium salt
* Valid PWR coolant
* Has a high flux multiplication rate, boosting fuels
* After cooling, the depleted salt has to be reprocessed using a chemical plant
## Changed
* Bedrock fluorite ore now yields actual ore instead of fluorite directly
@ -18,6 +22,7 @@
* The automatic buzzsaw can now use wood oil, ethanol, fish oil and heavy oil to run
* Fluorite ore is now centrifugable
* Fluorite crystals now centrifuge into slightly less fluorite but also yield sodalite
* Blast resistance values for most resistant blocks have been changed, most blocks now have much lower resistance which means there's now a practical difference between concrete and ducrete. Resistance values also match the block's cost more closely.
## Fixed
* Fixed FEnSU's IO limit not working properly
@ -28,3 +33,6 @@
* Fixed blast furnace output overstacking
* Fixed potential crash caused by centrifuges trying to create a recipe using non-registered items
* Fixed chemplant GUI crashing when too many upgrades are applied to a short duration recipe
* Corium is now a finite fluid, fixing an issue where a single fuel rod can be used to create a giant blob of corium, lagging out the server
* Fixed bullets not being able to pass things like tall grass
* Whether the player has received a guide book is now saved as part of the extprop which might fix an issue where offline mode players get a new book on every start

View File

@ -2384,7 +2384,7 @@ public class ModBlocks {
corium_fluid = new CoriumFluid().setDensity(600000).setViscosity(12000).setLuminosity(10).setTemperature(1500).setUnlocalizedName("corium_fluid");
FluidRegistry.registerFluid(corium_fluid);
corium_block = new CoriumBlock(corium_fluid, fluidcorium).setBlockName("corium_block").setResistance(500F);
corium_block = new CoriumFinite(corium_fluid, fluidcorium).setBlockName("corium_block").setResistance(500F);
volcanic_lava_fluid = new VolcanicFluid().setLuminosity(15).setDensity(3000).setViscosity(3000).setTemperature(1300).setUnlocalizedName("volcanic_lava_fluid");
FluidRegistry.registerFluid(volcanic_lava_fluid);

View File

@ -0,0 +1,84 @@
package com.hbm.blocks.fluid;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.ModDamageSource;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.ContaminationUtil.ContaminationType;
import com.hbm.util.ContaminationUtil.HazardType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
public class CoriumFinite extends GenericFiniteFluid {
public CoriumFinite(Fluid fluid, Material material) {
super(fluid, material, "corium_still", "corium_flowing");
setQuantaPerBlock(5);
this.tickRate = 30;
}
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
Block b = world.getBlock(x, y, z);
float res = (float) (Math.sqrt(b.getExplosionResistance(null)) * 3);
if(res < 1)
return true;
Random rand = new Random();
return b.getMaterial().isLiquid() || rand.nextInt((int) res) == 0;
}
@Override
public boolean displaceIfPossible(World world, int x, int y, int z) {
if(world.getBlock(x, y, z).getMaterial().isLiquid()) {
return false;
}
return canDisplace(world, x, y, z);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
entity.setInWeb();
entity.setFire(3);
entity.attackEntityFrom(ModDamageSource.radiation, 2F);
if(entity instanceof EntityLivingBase)
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, 1F);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
super.updateTick(world, x, y, z, rand);
if(!world.isRemote && rand.nextInt(10) == 0 && world.getBlock(x, y - 1, z) != this) {
if(rand.nextInt(3) == 0)
world.setBlock(x, y, z, ModBlocks.block_corium);
else
world.setBlock(x, y, z, ModBlocks.block_corium_cobble);
}
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return 0;
}
@Override
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
return false;
}
}

View File

@ -94,7 +94,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
private static HashMap<BlockPos, Block> fuelRods = new HashMap();
private static HashMap<BlockPos, Block> sources = new HashMap();
private static boolean errored;
private static final int maxSize = 1024;
private static final int maxSize = 4096;
public void assemble(World world, int x, int y, int z, EntityPlayer player) {
assembly.clear();
@ -107,7 +107,15 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
errored = false;
floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player);
if(fuelRods.size() == 0 || sources.size() == 0) errored = true;
if(fuelRods.size() == 0){
sendError(world, x, y, z, "Fuel rods required", player);
errored = true;
}
if(sources.size() == 0) {
sendError(world, x, y, z, "Neutron sources required", player);
errored = true;
}
TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z);

View File

@ -177,7 +177,7 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.motionX * motionMult(), this.posY + this.motionY * motionMult(), this.posZ + this.motionZ * motionMult());
MovingObjectPosition mop = null;
if(!this.isSpectral()) mop = this.worldObj.rayTraceBlocks(pos, nextPos);
if(!this.isSpectral()) mop = this.worldObj.func_147447_a(pos, nextPos, false, true, false);
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
nextPos = Vec3.createVectorHelper(this.posX + this.motionX * motionMult(), this.posY + this.motionY * motionMult(), this.posZ + this.motionZ * motionMult());

View File

@ -18,6 +18,8 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
public static final String key = "NTM_EXT_PLAYER";
public EntityPlayer player;
public boolean hasReceivedBook = false;
public boolean enableHUD = true;
public boolean enableBackpack = true;
@ -150,6 +152,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
NBTTagCompound props = new NBTTagCompound();
props.setBoolean("hasReceivedBook", hasReceivedBook);
props.setFloat("shield", shield);
props.setFloat("maxShield", maxShield);
props.setBoolean("enableBackpack", enableBackpack);
@ -164,6 +167,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmPlayerProps");
if(props != null) {
this.hasReceivedBook = props.getBoolean("hasReceivedBook");
this.shield = props.getFloat("shield");
this.maxShield = props.getFloat("maxShield");
this.enableBackpack = props.getBoolean("enableBackpack");

View File

@ -9,8 +9,6 @@ import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.util.GaugeUtil;
import com.hbm.render.util.GaugeUtil.Gauge;
import com.hbm.tileentity.machine.TileEntityPWRController;
import net.minecraft.client.Minecraft;
@ -18,6 +16,7 @@ import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@ -25,6 +24,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
public class GUIPWR extends GuiInfoContainer {
@ -118,8 +118,11 @@ public class GUIPWR extends GuiInfoContainer {
int c = (int) (controller.rodLevel * 52 / 100);
drawTexturedModalRect(guiLeft + 53, guiTop + 54, 176, 40, c, 2);
GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity);
GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacity);
//GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity);
//GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacity);
drawGauge(guiLeft + 124, guiTop + 40, (double) controller.coreHeat / (double) controller.coreHeatCapacity);
drawGauge(guiLeft + 160, guiTop + 40, (double) controller.hullHeat / (double) controller.hullHeatCapacity);
if(controller.typeLoaded != -1 && controller.amountLoaded > 0) {
ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded);
@ -135,6 +138,37 @@ public class GUIPWR extends GuiInfoContainer {
this.field.drawTextBox();
}
private void drawGauge(int x, int y, double d) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
d = MathHelper.clamp_double(d, 0, 1);
float angle = (float) Math.toRadians(-d * 270 - 45);
Vec3 tip = Vec3.createVectorHelper(0, 5, 0);
Vec3 left = Vec3.createVectorHelper(1, -2, 0);
Vec3 right = Vec3.createVectorHelper(-1, -2, 0);
tip.rotateAroundZ(angle);
left.rotateAroundZ(angle);
right.rotateAroundZ(angle);
Tessellator tess = Tessellator.instance;
tess.startDrawing(GL11.GL_TRIANGLES);
tess.setColorOpaque_F(0F, 0F, 0F);
double mult = 1.5;
tess.addVertex(x + tip.xCoord * mult, y + tip.yCoord * mult, this.zLevel);
tess.addVertex(x + left.xCoord * mult, y + left.yCoord * mult, this.zLevel);
tess.addVertex(x + right.xCoord * mult, y + right.yCoord * mult, this.zLevel);
tess.setColorOpaque_F(0.75F, 0F, 0F);
tess.addVertex(x + tip.xCoord, y + tip.yCoord, this.zLevel);
tess.addVertex(x + left.xCoord, y + left.yCoord, this.zLevel);
tess.addVertex(x + right.xCoord, y + right.yCoord, this.zLevel);
tess.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int i) {

View File

@ -176,10 +176,13 @@ public class ModEventHandler {
if(MobConfig.enableDucks && event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasDucked"))
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("Press O to Duck!", MainRegistry.proxy.ID_DUCK, 30_000), (EntityPlayerMP) event.player);
if(event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasGuide")) {
HbmPlayerProps props = HbmPlayerProps.getData(event.player);
if(!props.hasReceivedBook) {
event.player.inventory.addItemStackToInventory(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()));
event.player.inventoryContainer.detectAndSendChanges();
event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).setBoolean("hasGuide", true);
props.hasReceivedBook = true;
}
}
}

View File

@ -297,7 +297,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
double coolingEff = (double) this.channelCount / (double) this.rodCount * 0.1D; //10% cooling if numbers match
if(coolingEff > 1D) coolingEff = 1D;
int heatToUse = (int) (this.hullHeat * coolingEff * trait.getEfficiency(HeatingType.PWR));
int heatToUse = Math.min(this.hullHeat, (int) (this.hullHeat * coolingEff * trait.getEfficiency(HeatingType.PWR)));
HeatingStep step = trait.getFirstStep();
int coolCycles = tanks[0].getFill() / step.amountReq;
int hotCycles = (tanks[1].getMaxFill() - tanks[1].getFill()) / step.amountProduced;

View File

@ -22,7 +22,6 @@ import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -305,12 +304,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
if(corium) {
for(int i = h; i >= 0; i--) {
if(i <= h + 1 - reduce) {
worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.corium_block);
} else {
worldObj.setBlock(xCoord, yCoord + i, zCoord, Blocks.air);
}
worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.corium_block, 5, 3);
worldObj.markBlockForUpdate(xCoord, yCoord + i, zCoord);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB