mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
chungus
This commit is contained in:
parent
ddf03ca95d
commit
f2e974e7d0
@ -786,6 +786,8 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_large_turbine;
|
||||
public static final int guiID_machine_large_turbine = 100;
|
||||
|
||||
public static Block machine_chungus;
|
||||
|
||||
public static Block machine_deaerator;
|
||||
public static final int guiID_machine_deaerator = 74;
|
||||
@ -1763,6 +1765,7 @@ public class ModBlocks {
|
||||
|
||||
machine_turbine = new MachineTurbine(Material.iron).setBlockName("machine_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_turbine");
|
||||
machine_large_turbine = new MachineLargeTurbine(Material.iron).setBlockName("machine_large_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_large_turbine");
|
||||
machine_chungus = new MachineChungus(Material.iron).setBlockName("machine_chungus").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_chungus");
|
||||
|
||||
machine_deaerator = new MachineDeaerator(Material.iron).setBlockName("machine_deaerator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_deaerator");
|
||||
|
||||
@ -2494,6 +2497,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_boiler_electric_off, machine_boiler_electric_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_turbine, machine_turbine.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_large_turbine, machine_large_turbine.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_chungus, machine_chungus.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_deaerator, machine_deaerator.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_waste_drum, machine_waste_drum.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_storage_drum, machine_storage_drum.getUnlocalizedName());
|
||||
|
||||
39
src/main/java/com/hbm/blocks/machine/MachineChungus.java
Normal file
39
src/main/java/com/hbm/blocks/machine/MachineChungus.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChungus;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineChungus extends BlockDummyable {
|
||||
|
||||
public MachineChungus(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityChungus();
|
||||
|
||||
if(meta >= 6)
|
||||
return new TileEntityProxyCombo(false, true, true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] { 3, 0, 10, 4, 2, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
@ -178,6 +178,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineReactor.class, new RenderBreeder());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySolarBoiler.class, new RenderSolarBoiler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStorageDrum.class, new RenderStorageDrum());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChungus.class, new RenderChungus());
|
||||
//AMS
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSBase.class, new RenderAMSBase());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSEmitter.class, new RenderAMSEmitter());
|
||||
|
||||
@ -468,6 +468,7 @@ public class MainRegistry {
|
||||
GameRegistry.registerTileEntity(TileEntityDemonLamp.class, "tileentity_demonlamp");
|
||||
GameRegistry.registerTileEntity(TileEntityStorageDrum.class, "tileentity_waste_storage_drum");
|
||||
GameRegistry.registerTileEntity(TileEntityDeaerator.class, "tileentity_deaerator");
|
||||
GameRegistry.registerTileEntity(TileEntityChungus.class, "tileentity_chungus");
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKRod.class, "tileentity_rbmk_rod");
|
||||
GameRegistry.registerTileEntity(TileEntityRBMKControlManual.class, "tileentity_rbmk_control");
|
||||
|
||||
@ -72,6 +72,7 @@ public class ResourceManager {
|
||||
|
||||
//Large Turbine
|
||||
public static final IModelCustom turbine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbine.obj"));
|
||||
public static final IModelCustom chungus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chungus.obj"));
|
||||
|
||||
//IGen
|
||||
public static final IModelCustom igen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/igen.obj"));
|
||||
@ -316,6 +317,7 @@ public class ResourceManager {
|
||||
|
||||
//Large Turbine
|
||||
public static final ResourceLocation turbine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbine.png");
|
||||
public static final ResourceLocation chungus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chungus.png");
|
||||
|
||||
//IGen
|
||||
public static final ResourceLocation igen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen.png");
|
||||
|
||||
61
src/main/java/com/hbm/render/tileentity/RenderChungus.java
Normal file
61
src/main/java/com/hbm/render/tileentity/RenderChungus.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntityChungus;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderChungus extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
|
||||
switch(tile.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F);
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, 0, -3);
|
||||
|
||||
bindTexture(ResourceManager.chungus_tex);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
ResourceManager.chungus.renderPart("Body");
|
||||
ResourceManager.chungus.renderPart("Lever");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
TileEntityChungus turbine = (TileEntityChungus) tile;
|
||||
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
GL11.glRotatef(turbine.lastRotor + (turbine.rotor - turbine.lastRotor) * f, 0, 0, 1);
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
|
||||
ResourceManager.chungus.renderPart("Blades");
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
}
|
||||
239
src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java
Normal file
239
src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java
Normal file
@ -0,0 +1,239 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChungus extends TileEntity implements IFluidAcceptor, IFluidSource, ISource, INBTPacketReceiver {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000000L;
|
||||
private boolean shouldTurn;
|
||||
public float rotor;
|
||||
public float lastRotor;
|
||||
|
||||
public List<IConsumer> list1 = new ArrayList();
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public TileEntityChungus() {
|
||||
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(FluidType.STEAM, 1000000000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.WATER, 1000000000, 1);
|
||||
}
|
||||
|
||||
@Untested
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
Object[] outs = MachineRecipes.getTurbineOutput(tanks[0].getTankType());
|
||||
|
||||
tanks[1].setTankType((FluidType) outs[0]);
|
||||
|
||||
int processMax = (int) Math.ceil(tanks[0].getFill() / (Integer)outs[2]); //the maximum amount of cycles total
|
||||
int processSteam = tanks[0].getFill() / (Integer)outs[2]; //the maximum amount of cycles depending on steam
|
||||
int processWater = (tanks[1].getMaxFill() - tanks[1].getFill()) / (Integer)outs[1]; //the maximum amount of cycles depending on water
|
||||
|
||||
int cycles = Math.min(processMax, Math.min(processSteam, processWater));
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - (Integer)outs[2] * cycles);
|
||||
tanks[1].setFill(tanks[1].getFill() + (Integer)outs[1] * cycles);
|
||||
|
||||
power += (Integer)outs[3] * cycles;
|
||||
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
|
||||
shouldTurn = cycles > 0;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setBoolean("operational", shouldTurn);
|
||||
this.networkPack(data, 150);
|
||||
|
||||
} else {
|
||||
|
||||
this.lastRotor = this.rotor;
|
||||
|
||||
if(shouldTurn) {
|
||||
|
||||
this.rotor += 30F;
|
||||
|
||||
if(this.rotor >= 360) {
|
||||
this.rotor -= 360;
|
||||
this.lastRotor -= 360;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
this.power = data.getLong("power");
|
||||
this.shouldTurn = data.getBoolean("operational");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "steam");
|
||||
power = nbt.getLong("power");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "steam");
|
||||
nbt.setLong("power", power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ffgeua(xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
dir = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
fillFluid(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * -2, yCoord, zCoord + dir.offsetZ * -2, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return worldObj.getTotalWorldTime() % 2 == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if(index < 2 && tanks[index] != null)
|
||||
tanks[index].setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
if(index < 2 && tanks[index] != null)
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTank> getTanks() {
|
||||
List<FluidTank> list = new ArrayList();
|
||||
list.add(tanks[0]);
|
||||
list.add(tanks[1]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return list2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
list2.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list1.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,6 @@ import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
@ -49,7 +48,6 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
return "container.machineLargeTurbine";
|
||||
}
|
||||
|
||||
@Untested
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
3181
src/main/resources/assets/hbm/models/machines/chungus.obj
Normal file
3181
src/main/resources/assets/hbm/models/machines/chungus.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 521 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 18 KiB |
Loading…
x
Reference in New Issue
Block a user