Merge branch 'locale_update' of https://github.com/EverMine/Hbm-s-Nuclear-Tech-GIT into locale_update

This commit is contained in:
ItsMakar 2025-02-20 09:31:25 +02:00
commit 66feaf292f
3 changed files with 82 additions and 73 deletions

View File

@ -21,8 +21,8 @@ import net.minecraft.world.World;
public class ParticleHaze extends EntityFX {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/haze.png");
private TextureManager theRenderEngine;
private int maxAge;
private final TextureManager theRenderEngine;
private final int maxAge;
public ParticleHaze(TextureManager p_i1213_1_, World p_i1218_1_, double p_i1218_2_, double p_i1218_4_, double p_i1218_6_) {
super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_);
@ -94,6 +94,7 @@ public class ParticleHaze extends EntityFX {
Random rand = new Random(50);
GL11.glPushMatrix();
for(int i = 0; i < 25; i++) {
double dX = rand.nextGaussian() * 2.5D;
@ -115,9 +116,8 @@ public class ParticleHaze extends EntityFX {
tess.addVertexWithUV((double) (pX + p_70539_3_ * size + p_70539_6_ * size), (double) (pY + p_70539_4_ * size), (double) (pZ + p_70539_5_ * size + p_70539_7_ * size), 0, 0);
tess.addVertexWithUV((double) (pX + p_70539_3_ * size - p_70539_6_ * size), (double) (pY - p_70539_4_ * size), (double) (pZ + p_70539_5_ * size - p_70539_7_ * size), 0, 1);
tess.draw();
GL11.glTranslatef((float) -dX, (float) -dY, (float) -dZ);
}
GL11.glPopMatrix();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);

View File

@ -21,14 +21,14 @@ import net.minecraft.world.World;
public class ParticleRadiationFog extends EntityFX {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/fog.png");
private TextureManager theRenderEngine;
private final TextureManager theRenderEngine;
private int maxAge;
public ParticleRadiationFog(TextureManager p_i1213_1_, World p_i1218_1_, double p_i1218_2_, double p_i1218_4_, double p_i1218_6_) {
super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_);
theRenderEngine = p_i1213_1_;
maxAge = 100 + rand.nextInt(40);
this.particleRed = this.particleGreen = this.particleBlue = 0;
this.particleScale = 7.5F;
}
@ -41,7 +41,7 @@ public class ParticleRadiationFog extends EntityFX {
this.particleRed = red;
this.particleGreen = green;
this.particleBlue = blue;
this.particleScale = scale;
}
@ -49,14 +49,14 @@ public class ParticleRadiationFog extends EntityFX {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(maxAge < 400)
{
maxAge = 400;
}
this.particleAge++;
if (this.particleAge >= maxAge)
{
this.setDead();
@ -78,11 +78,11 @@ public class ParticleRadiationFog extends EntityFX {
}
public void renderParticle(Tessellator tess, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
this.theRenderEngine.bindTexture(texture);
float alpha = 0;
alpha = (float) Math.sin(particleAge * Math.PI / (400F)) * 0.125F;
GL11.glColor4f(0.85F, 0.9F, 0.5F, alpha);
@ -92,22 +92,23 @@ public class ParticleRadiationFog extends EntityFX {
GL11.glDepthMask(false);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
RenderHelper.disableStandardItemLighting();
Random rand = new Random(50);
GL11.glPushMatrix();
for(int i = 0; i < 25; i++) {
double dX = (rand.nextGaussian() - 1D) * 2.5D;
double dY = (rand.nextGaussian() - 1D) * 0.15D;
double dZ = (rand.nextGaussian() - 1D) * 2.5D;
double size = rand.nextDouble() * particleScale;
GL11.glTranslatef((float) dX, (float) dY, (float) dZ);
float pX = (float) ((this.prevPosX + (this.posX - this.prevPosX) * (double)p_70539_2_ - interpPosX) + rand.nextGaussian() * 0.5);
float pY = (float) ((this.prevPosY + (this.posY - this.prevPosY) * (double)p_70539_2_ - interpPosY) + rand.nextGaussian() * 0.5);
float pZ = (float) ((this.prevPosZ + (this.posZ - this.prevPosZ) * (double)p_70539_2_ - interpPosZ) + rand.nextGaussian() * 0.5);
tess.startDrawingQuads();
tess.setNormal(0.0F, 1.0F, 0.0F);
tess.setBrightness(240);
@ -116,14 +117,13 @@ public class ParticleRadiationFog extends EntityFX {
tess.addVertexWithUV((double)(pX + p_70539_3_ * size + p_70539_6_ * size), (double)(pY + p_70539_4_ * size), (double)(pZ + p_70539_5_ * size + p_70539_7_ * size), 0, 0);
tess.addVertexWithUV((double)(pX + p_70539_3_ * size - p_70539_6_ * size), (double)(pY - p_70539_4_ * size), (double)(pZ + p_70539_5_ * size - p_70539_7_ * size), 0, 1);
tess.draw();
GL11.glTranslatef((float) -dX, (float) -dY, (float) -dZ);
}
GL11.glPopMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthMask(true);
GL11.glPolygonOffset(0.0F, 0.0F);
GL11.glEnable(GL11.GL_LIGHTING);
}

View File

@ -12,6 +12,7 @@ import com.hbm.inventory.gui.GUIMachineRotaryFurnace;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.recipes.RotaryFurnaceRecipes;
import com.hbm.inventory.recipes.RotaryFurnaceRecipes.RotaryFurnaceRecipe;
import com.hbm.lib.Library;
@ -42,7 +43,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IGUIProvider, IFluidCopiable, IConditionalInvAccess {
public FluidTank[] tanks;
public boolean isProgressing;
public float progress;
@ -52,7 +53,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
public boolean isVenting;
public MaterialStack output;
public static final int maxOutput = MaterialShapes.BLOCK.q(16);
public int anim;
public int lastAnim;
@ -71,12 +72,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
@Override
public void updateEntity() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
if(!worldObj.isRemote) {
tanks[0].setType(3, slots);
for(DirPos pos : getSteamPos()) {
@ -86,16 +87,16 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
if(tanks[0].getTankType() != Fluids.NONE) for(DirPos pos : getFluidPos()) {
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
if(smoke.getFill() > 0) this.sendFluid(smoke, worldObj, xCoord + rot.offsetX, yCoord + 5, zCoord + rot.offsetZ, Library.POS_Y);
if(this.output != null) {
int prev = this.output.amount;
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
MaterialStack leftover = CrucibleUtil.pourSingleStack(worldObj, xCoord + 0.5D + rot.offsetX * 2.875D, yCoord + 1.25D, zCoord + 0.5D + rot.offsetZ * 2.875D, 6, true, this.output, MaterialShapes.INGOT.q(1), impact);
this.output = leftover;
if(prev != this.output.amount) {
this.output = leftover;
NBTTagCompound data = new NBTTagCompound();
@ -107,31 +108,31 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
data.setFloat("len", Math.max(1F, yCoord + 1 - (float) (Math.ceil(impact.yCoord) - 1.125)));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + rot.offsetX * 2.875D, yCoord + 0.75, zCoord + 0.5D + rot.offsetZ * 2.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
}
if(output.amount <= 0) this.output = null;
}
RotaryFurnaceRecipe recipe = RotaryFurnaceRecipes.getRecipe(slots[0], slots[1], slots[2]);
this.isProgressing = false;
if(recipe != null) {
if(this.burnTime <= 0 && slots[4] != null && TileEntityFurnace.isItemFuel(slots[4])) {
this.maxBurnTime = this.burnTime = TileEntityFurnace.getItemBurnTime(slots[4]) / 2;
this.decrStackSize(4, 1);
this.markChanged();
}
if(this.canProcess(recipe)) {
this.progress += 1F / recipe.duration;
tanks[1].setFill(tanks[1].getFill() - recipe.steam);
steamUsed += recipe.steam;
this.isProgressing = true;
if(this.progress >= 1F) {
this.progress -= 1F;
this.consumeItems(recipe);
if(this.output == null) {
this.output = recipe.output.copy();
} else {
@ -139,11 +140,11 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
}
this.markDirty();
}
} else {
this.progress = 0;
}
if(this.steamUsed >= 100) {
int steamReturn = this.steamUsed / 100;
int canReturn = tanks[2].getMaxFill() - tanks[2].getFill();
@ -151,28 +152,28 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
this.steamUsed -= doesReturn * 100;
tanks[2].setFill(tanks[2].getFill() + doesReturn);
}
} else {
this.progress = 0;
}
this.isVenting = false;
if(this.burnTime > 0) {
this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 10F);
this.burnTime--;
}
this.networkPackNT(50);
} else {
if(this.burnTime > 0 && MainRegistry.proxy.me().getDistance(xCoord, yCoord, zCoord) < 25) {
Random rand = worldObj.rand;
worldObj.spawnParticle("flame", xCoord + 0.5 + dir.offsetX * 0.5 + rot.offsetX + rand.nextGaussian() * 0.25, yCoord + 0.375, zCoord + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ + rand.nextGaussian() * 0.25, 0, 0, 0);
}
if(isVenting && worldObj.getTotalWorldTime() % 2 == 0) {
NBTTagCompound fx = new NBTTagCompound();
fx.setString("type", "tower");
fx.setFloat("lift", 10F);
@ -202,7 +203,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
buf.writeFloat(progress);
buf.writeInt(burnTime);
buf.writeInt(maxBurnTime);
if(this.output != null) {
buf.writeBoolean(true);
buf.writeInt(this.output.material.id);
@ -211,7 +212,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
buf.writeBoolean(false);
}
}
@Override public void deserialize(ByteBuf buf) {
super.deserialize(buf);
tanks[0].deserialize(buf);
@ -222,14 +223,14 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
progress = buf.readFloat();
burnTime = buf.readInt();
maxBurnTime = buf.readInt();
if(buf.readBoolean()) {
this.output = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt());
} else {
this.output = null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
@ -239,8 +240,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
this.progress = nbt.getFloat("prog");
this.burnTime = nbt.getInteger("burn");
this.maxBurnTime = nbt.getInteger("maxBurn");
if (nbt.hasKey("outType")) {
NTMMaterial mat = Mats.matById.get(nbt.getInteger("outType"));
this.output = new MaterialStack(mat, nbt.getInteger("outAmount"));
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
@ -250,32 +255,36 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
nbt.setFloat("prog", progress);
nbt.setInteger("burn", burnTime);
nbt.setInteger("maxBurn", maxBurnTime);
if (this.output != null) {
nbt.setInteger("outType", this.output.material.id);
nbt.setInteger("outAmount", this.output.amount);
}
}
public DirPos[] getSteamPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
return new DirPos[] {
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite())
};
}
public DirPos[] getFluidPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot),
new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot)
};
}
public boolean canProcess(RotaryFurnaceRecipe recipe) {
if(this.burnTime <= 0) return false;
if(recipe.fluid != null) {
if(this.tanks[0].getTankType() != recipe.fluid.type) return false;
if(this.tanks[0].getFill() < recipe.fluid.fill) return false;
@ -284,19 +293,19 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
if(tanks[1].getFill() < recipe.steam) return false;
if(tanks[2].getMaxFill() - tanks[2].getFill() < recipe.steam / 100) return false;
if(this.steamUsed > 100) return false;
if(this.output != null) {
if(this.output.material != recipe.output.material) return false;
if(this.output.amount + recipe.output.amount > this.maxOutput) return false;
}
return true;
}
public void consumeItems(RotaryFurnaceRecipe recipe) {
for(AStack aStack : recipe.ingredients) {
for(int i = 0; i < 3; i++) {
ItemStack stack = slots[i];
if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) {
@ -305,19 +314,19 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
}
}
}
if(recipe.fluid != null) {
this.tanks[0].setFill(tanks[0].getFill() - recipe.fluid.fill);
}
}
@Override
public void pollute(PollutionType type, float amount) {
FluidTank tank = type == PollutionType.SOOT ? smoke : type == PollutionType.HEAVYMETAL ? smoke_leaded : smoke_poison;
int fluidAmount = (int) Math.ceil(amount * 100);
tank.setFill(tank.getFill() + fluidAmount);
if(tank.getFill() > tank.getMaxFill()) {
int overflow = tank.getFill() - tank.getMaxFill();
tank.setFill(tank.getMaxFill());
@ -332,12 +341,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
@Override public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack) { return slot < 3 || slot == 4; }
@Override public boolean canExtractItem(int x, int y, int z, int slot, ItemStack stack, int side) { return false; }
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 2,
@ -348,10 +357,10 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
zCoord + 3
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
@ -364,7 +373,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
BlockPos core = new BlockPos(xCoord, yCoord, zCoord);
//Red
if(side == dir.getOpposite().ordinal() && pos.equals(core.clone().offset(dir, -1).offset(rot, -2))) return new int[] {0};
//Yellow
@ -373,7 +382,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
if(side == dir.getOpposite().ordinal() && pos.equals(core.clone().offset(dir, -1))) return new int[] {2};
//Fuel
if(side == dir.ordinal() && pos.equals(core.clone().offset(dir, 1).offset(rot, -1))) return new int[] {4};
return new int[] { };
}