spring cleaning, fixed snowglobe lighting, RBMK cooler new fluid API

This commit is contained in:
Boblet 2022-11-18 14:31:42 +01:00
parent 56cdc3ffe7
commit aa589d30d7
17 changed files with 77 additions and 83 deletions

View File

@ -178,6 +178,8 @@ public class EntityNukeTorex extends Entity {
this.colorMod = 0.8F + rand.nextFloat() * 0.2F;
this.updateColor();
//TODO: add movement types which excludes ground dust from convection sim, then let centered ground dust linger for longer
}
private void update() {

View File

@ -291,34 +291,31 @@ public class Library {
}
public static MovingObjectPosition rayTrace(EntityPlayer player, double length, float interpolation) {
Vec3 vec3 = getPosition(interpolation, player);
vec3.yCoord += player.eyeHeight;
Vec3 vec31 = player.getLook(interpolation);
Vec3 vec32 = vec3.addVector(vec31.xCoord * length, vec31.yCoord * length, vec31.zCoord * length);
return player.worldObj.func_147447_a(vec3, vec32, false, false, true);
Vec3 vec3 = getPosition(interpolation, player);
vec3.yCoord += player.eyeHeight;
Vec3 vec31 = player.getLook(interpolation);
Vec3 vec32 = vec3.addVector(vec31.xCoord * length, vec31.yCoord * length, vec31.zCoord * length);
return player.worldObj.func_147447_a(vec3, vec32, false, false, true);
}
public static MovingObjectPosition rayTrace(EntityPlayer player, double length, float interpolation, boolean allowLiquids, boolean disallowNonCollidingBlocks, boolean mopOnMiss) {
Vec3 vec3 = getPosition(interpolation, player);
vec3.yCoord += player.eyeHeight;
Vec3 vec31 = player.getLook(interpolation);
Vec3 vec32 = vec3.addVector(vec31.xCoord * length, vec31.yCoord * length, vec31.zCoord * length);
return player.worldObj.func_147447_a(vec3, vec32, allowLiquids, disallowNonCollidingBlocks, mopOnMiss);
Vec3 vec3 = getPosition(interpolation, player);
vec3.yCoord += player.eyeHeight;
Vec3 vec31 = player.getLook(interpolation);
Vec3 vec32 = vec3.addVector(vec31.xCoord * length, vec31.yCoord * length, vec31.zCoord * length);
return player.worldObj.func_147447_a(vec3, vec32, allowLiquids, disallowNonCollidingBlocks, mopOnMiss);
}
public static Vec3 getPosition(float interpolation, EntityPlayer player) {
if (interpolation == 1.0F)
{
return Vec3.createVectorHelper(player.posX, player.posY + (player.getEyeHeight() - player.getDefaultEyeHeight()), player.posZ);
}
else
{
double d0 = player.prevPosX + (player.posX - player.prevPosX) * interpolation;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * interpolation + (player.getEyeHeight() - player.getDefaultEyeHeight());
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * interpolation;
return Vec3.createVectorHelper(d0, d1, d2);
}
}
public static Vec3 getPosition(float interpolation, EntityPlayer player) {
if(interpolation == 1.0F) {
return Vec3.createVectorHelper(player.posX, player.posY + (player.getEyeHeight() - player.getDefaultEyeHeight()), player.posZ);
} else {
double d0 = player.prevPosX + (player.posX - player.prevPosX) * interpolation;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * interpolation + (player.getEyeHeight() - player.getDefaultEyeHeight());
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * interpolation;
return Vec3.createVectorHelper(d0, d1, d2);
}
}
public static List<int[]> getBlockPosInPath(int x, int y, int z, int length, Vec3 vec0) {
List<int[]> list = new ArrayList<int[]>();
@ -346,8 +343,6 @@ public class Library {
long batMax = battery.getMaxCharge();
long batCharge = battery.getCharge(slots[index]);
long batRate = battery.getChargeRate();
//in hHE
long toCharge = Math.min(Math.min(power, batRate), batMax - batCharge);
power -= toCharge;
@ -359,31 +354,27 @@ public class Library {
}
public static long chargeTEFromItems(ItemStack[] slots, int index, long power, long maxPower) {
if(slots[index] != null && slots[index].getItem() == ModItems.battery_creative)
{
if(slots[index] != null && slots[index].getItem() == ModItems.battery_creative) {
return maxPower;
}
if(slots[index] != null && slots[index].getItem() == ModItems.fusion_core_infinite)
{
if(slots[index] != null && slots[index].getItem() == ModItems.fusion_core_infinite) {
return maxPower;
}
if(slots[index] != null && slots[index].getItem() instanceof IBatteryItem) {
IBatteryItem battery = (IBatteryItem) slots[index].getItem();
long batCharge = battery.getCharge(slots[index]);
long batRate = battery.getDischargeRate();
//in hHe
long toDischarge = Math.min(Math.min((maxPower - power), batRate), batCharge);
battery.dischargeBattery(slots[index], toDischarge);
power += toDischarge;
}
return power;
}

View File

@ -215,7 +215,6 @@ public class ModEventHandlerClient {
}
if(!ducked && Keyboard.isKeyDown(Keyboard.KEY_O) && Minecraft.getMinecraft().currentScreen == null) {
ducked = true;
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(0, 0, 0, 999, 0));
}

View File

@ -899,15 +899,15 @@ public class ResourceManager {
public static final IModelCustom missileCarrier = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missileCarrier.obj"));
public static final IModelCustom missileBooster = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missileBooster.obj"));
public static final IModelCustom minerRocket = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/minerRocket.obj"));
public static final IModelCustom soyuz = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz.obj"));
public static final IModelCustom soyuz_lander = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz_lander.obj"));
public static final IModelCustom soyuz_module = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz_module.obj"));
public static final IModelCustom soyuz_launcher_legs = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_legs.obj"));
public static final IModelCustom soyuz_launcher_table = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_table.obj"));
public static final IModelCustom soyuz_launcher_tower_base = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_tower_base.obj"));
public static final IModelCustom soyuz_launcher_tower = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_tower.obj"));
public static final IModelCustom soyuz_launcher_support_base = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support_base.obj"));
public static final IModelCustom soyuz_launcher_support = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support.obj"));
public static final IModelCustom soyuz = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz.obj")).asDisplayList();
public static final IModelCustom soyuz_lander = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz_lander.obj")).asDisplayList();
public static final IModelCustom soyuz_module = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/soyuz_module.obj")).asDisplayList();
public static final IModelCustom soyuz_launcher_legs = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_legs.obj"), false).asDisplayList();
public static final IModelCustom soyuz_launcher_table = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_table.obj"), false).asDisplayList();
public static final IModelCustom soyuz_launcher_tower_base = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_tower_base.obj"), false).asDisplayList();
public static final IModelCustom soyuz_launcher_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_tower.obj"), false).asDisplayList();
public static final IModelCustom soyuz_launcher_support_base = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support_base.obj"), false).asDisplayList();
public static final IModelCustom soyuz_launcher_support = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support.obj"), false).asDisplayList();
//Missile Parts
public static final IModelCustom missile_pad = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missilePad.obj"));

View File

@ -7,7 +7,8 @@ import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe;
import com.hbm.lib.RefStrings;
import com.hbm.wiaj.WorldInAJar;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
@ -39,47 +40,51 @@ public class RenderSnowglobe extends TileEntitySpecialRenderer {
this.bindTexture(socket);
snowglobe.renderPart("Socket");
TileEntitySnowglobe te = (TileEntitySnowglobe) tile;
if(te.type.scene != null) {
WorldInAJar world = te.type.scene;
renderer.blockAccess = world;
renderer.enableAO = true;
double size = Math.max(world.sizeX, world.sizeZ);
scale = 4D / size;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(0, 1, 0);
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(world.sizeX * -0.5, 0, world.sizeZ * -0.5);
RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
//i hope everyone involved in the creation of openGL has their nutsack explode
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(TextureMap.locationBlocksTexture);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator.instance.startDrawingQuads();
Minecraft.getMinecraft().entityRenderer.disableLightmap(interp);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setColorOpaque_F(1F, 1F, 1F);
for(int a = 0; a < world.sizeX; a++) {
for(int b = 0; b < world.sizeY; b++) {
for(int c = 0; c < world.sizeZ; c++) {
renderer.renderBlockByRenderType(world.getBlock(a, b, c), a, b, c);
Block block = world.getBlock(a, b, c);
renderer.renderBlockByRenderType(block, a, b, c);
}
}
}
Tessellator.instance.draw();
tess.draw();
GL11.glShadeModel(GL11.GL_FLAT);
}
}
GL11.glPopMatrix();
Minecraft.getMinecraft().entityRenderer.enableLightmap(interp);
RenderHelper.enableStandardItemLighting();
}
}

View File

@ -15,7 +15,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.GuiIngameForge;

View File

@ -5,7 +5,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
@ -92,14 +91,6 @@ public class SoyuzPronter {
}
}
/* TODO
* int list = GL11.glGenLists(1);
* GL11.glNewList(list, GL11.GL_COMPILE);
* //Render
* GL11.glEndList();
* GL11.glCallList(list);
*/
public static void prontSoyuz(int type) {
if(type >= SoyuzSkin.values().length || type < 0)

View File

@ -14,8 +14,6 @@ import com.hbm.entity.effect.EntitySpear;
import com.hbm.entity.projectile.EntityRBMKDebris;
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
import com.hbm.main.MainRegistry;
import com.hbm.main.ModEventHandler;
import com.hbm.main.ModEventHandlerImpact;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.NBTPacket;
import com.hbm.packet.PacketDispatcher;

View File

@ -101,6 +101,7 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
this.fluxBuffer[19] = (int) flux;
}
@SuppressWarnings("incomplete-switch") //shut up
private void prepareScreenInfo() {
for(RBMKScreen screen : this.screens) {

View File

@ -12,7 +12,6 @@ import cpw.mods.fml.common.Optional;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
public class TileEntityRBMKControlManual extends TileEntityRBMKControl implements IControlReceiver {

View File

@ -2,10 +2,12 @@ package com.hbm.tileentity.machine.rbmk;
import java.util.List;
import api.hbm.fluid.IFluidStandardReceiver;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import net.minecraft.entity.Entity;
@ -13,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor {
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor, IFluidStandardReceiver {
private FluidTank tank;
private int lastCooled;
@ -29,6 +31,9 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
if(!worldObj.isRemote) {
if(this.worldObj.getTotalWorldTime() % 20 == 0)
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
if((int)(this.heat) > 750) {
int heatProvided = (int)(this.heat - 750D);
@ -123,4 +128,14 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
return type == tank.getTankType() ? tank.getMaxFill() : 0;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {tank};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tank};
}
}

View File

@ -134,7 +134,7 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
return false;
if(output.getItem() == ModItems.fluid_icon) {
return output.getItemDamage() == gas.getTankType().ordinal() && gas.getFill() + ItemFluidIcon.getQuantity(output) <= gas.getMaxFill();
return output.getItemDamage() == gas.getTankType().getID() && gas.getFill() + ItemFluidIcon.getQuantity(output) <= gas.getMaxFill();
}
if(slots[1] == null)
@ -277,7 +277,7 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
NBTTagCompound data = new NBTTagCompound();
data.setInteger("gas", this.gas.getFill());
data.setInteger("maxGas", this.gas.getMaxFill());
data.setShort("type", (short)this.gas.getTankType().ordinal());
data.setShort("type", (short)this.gas.getTankType().getID());
data.setDouble("progress", this.progress);
return data;
}

View File

@ -4,7 +4,6 @@ import com.hbm.items.machine.ItemRBMKRod;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements IRBMKLoadable {

View File

@ -85,6 +85,7 @@ public class WorldInAJar implements IBlockAccess {
//always render fullbright, if the situation requires it we could add a very rudimentary system that
//darkens blocks id there is a solid one above
@Override
@SideOnly(Side.CLIENT)
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int blockBrightness) {
return 15; //always be on fullbright
}

View File

@ -3,13 +3,10 @@ package com.hbm.world.feature;
import java.util.Random;
import com.hbm.inventory.RecipesCommon.MetaBlock;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.gen.NoiseGeneratorPerlin;
import net.minecraftforge.common.MinecraftForge;

View File

@ -3,7 +3,6 @@ package com.hbm.world.feature;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.bomb.TileEntitySellafield;
import net.minecraft.block.Block;
import net.minecraft.world.World;
@ -68,5 +67,5 @@ public class Sellafield {
world.setBlock(x, y - i, z, block, meta, 2);
}
private void placeCore(World world, int x, int z, double rad) { }
//private void placeCore(World world, int x, int z, double rad) { }
}

View File

@ -2,7 +2,6 @@ package com.hbm.world.worldgen;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
@ -14,7 +13,6 @@ import com.hbm.world.worldgen.components.RuinFeatures.*;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenBeach;
import net.minecraft.world.biome.BiomeGenMesa;
import net.minecraft.world.gen.structure.MapGenStructure;
import net.minecraft.world.gen.structure.MapGenStructureIO;