wa'er pumps, new capacitor, fixes

This commit is contained in:
Bob 2023-09-10 21:02:20 +02:00
parent 360177414a
commit 37eb69e47d
30 changed files with 1672 additions and 8 deletions

View File

@ -660,6 +660,9 @@ public class ModBlocks {
public static Block nuke_n45;
public static Block nuke_fstbmb;
public static Block bomb_multi;
public static Block pump_steam;
public static Block pump_electric;
public static Block heater_firebox;
public static Block heater_oven;
@ -771,6 +774,7 @@ public class ModBlocks {
public static Block capacitor_gold;
public static Block capacitor_niobium;
public static Block capacitor_tantalium;
public static Block capacitor_schrabidate;
public static Block machine_coal_off;
public static Block machine_coal_on;
@ -1821,6 +1825,9 @@ public class ModBlocks {
semtex = new BlockSemtex().setBlockName("semtex").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.nukeTab).setHardness(0.0F).setBlockTextureName(RefStrings.MODID + ":semtex");
c4 = new BlockC4().setBlockName("c4").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.nukeTab).setHardness(0.0F).setBlockTextureName(RefStrings.MODID + ":c4");
fissure_bomb = new BlockFissureBomb().setBlockName("fissure_bomb").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.nukeTab).setHardness(0.0F).setBlockTextureName(RefStrings.MODID + ":fissure_bomb");
pump_steam = new MachinePump().setBlockName("pump_steam").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pump_steam");
pump_electric = new MachinePump().setBlockName("pump_electric").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pump_electric");
heater_firebox = new HeaterFirebox().setBlockName("heater_firebox").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
heater_oven = new HeaterOven().setBlockName("heater_oven").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
@ -1924,7 +1931,8 @@ public class ModBlocks {
capacitor_copper = new MachineCapacitor(Material.iron, 1_000_000L, "copper").setBlockName("capacitor_copper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper");
capacitor_gold = new MachineCapacitor(Material.iron, 5_000_000L, "gold").setBlockName("capacitor_gold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName("gold_block");
capacitor_niobium = new MachineCapacitor(Material.iron, 25_000_000L, "niobium").setBlockName("capacitor_niobium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_niobium");
capacitor_tantalium = new MachineCapacitor(Material.iron, 100_000_000L, "tantalium").setBlockName("capacitor_tantalium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_tantalium");
capacitor_tantalium = new MachineCapacitor(Material.iron, 150_000_000L, "tantalium").setBlockName("capacitor_tantalium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_tantalium");
capacitor_schrabidate = new MachineCapacitor(Material.iron, 50_000_000_000L, "schrabidate").setBlockName("capacitor_schrabidate").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_schrabidate");
machine_coal_off = new MachineCoal(false).setBlockName("machine_coal_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_coal_on = new MachineCoal(true).setBlockName("machine_coal_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
@ -3089,6 +3097,8 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_press, machine_press.getUnlocalizedName());
GameRegistry.registerBlock(machine_epress, machine_epress.getUnlocalizedName());
register(machine_conveyor_press);
register(pump_steam);
register(pump_electric);
register(heater_firebox);
register(heater_oven);
register(machine_ashpit);
@ -3277,6 +3287,7 @@ public class ModBlocks {
register(capacitor_gold);
register(capacitor_niobium);
register(capacitor_tantalium);
register(capacitor_schrabidate);
GameRegistry.registerBlock(machine_transformer, machine_transformer.getUnlocalizedName());
GameRegistry.registerBlock(machine_transformer_20, machine_transformer_20.getUnlocalizedName());
GameRegistry.registerBlock(machine_transformer_dnt, machine_transformer_dnt.getUnlocalizedName());

View File

@ -0,0 +1,100 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachinePumpElectric;
import com.hbm.tileentity.machine.TileEntityMachinePumpSteam;
import com.hbm.util.BobMathUtil;
import com.hbm.util.I18nUtil;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class MachinePump extends BlockDummyable implements ITooltipProvider, ILookOverlay {
public MachinePump() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) {
if(this == ModBlocks.pump_steam) return new TileEntityMachinePumpSteam();
if(this == ModBlocks.pump_electric) return new TileEntityMachinePumpElectric();
}
if(meta >= 6) {
if(this == ModBlocks.pump_steam) return new TileEntityProxyCombo().fluid();
if(this == ModBlocks.pump_electric) return new TileEntityProxyCombo().fluid().power();
}
return null;
}
@Override
public int[] getDimensions() {
return new int[] {3, 0, 1, 1, 1, 1};
}
@Override
public int getOffset() {
return 1;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ + 1);
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ - 1);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
List<String> text = new ArrayList();
if(te instanceof TileEntityMachinePumpSteam) {
TileEntityMachinePumpSteam pump = (TileEntityMachinePumpSteam) te;
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + I18nUtil.resolveKey(pump.steam.getTankType().getUnlocalizedName()) + ": " + String.format("%,d", pump.steam.getFill()) + " / " + String.format("%,d", pump.steam.getMaxFill()) + "mB");
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + I18nUtil.resolveKey(pump.lps.getTankType().getUnlocalizedName()) + ": " + String.format("%,d", pump.lps.getFill()) + " / " + String.format("%,d", pump.lps.getMaxFill()) + "mB");
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + I18nUtil.resolveKey(pump.water.getTankType().getUnlocalizedName()) + ": " + String.format("%,d", pump.water.getFill()) + " / " + String.format("%,d", pump.water.getMaxFill()) + "mB");
}
if(te instanceof TileEntityMachinePumpElectric) {
TileEntityMachinePumpElectric pump = (TileEntityMachinePumpElectric) te;
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + String.format("%,d", pump.power) + " / " + String.format("%,d", pump.maxPower) + "HE");
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + I18nUtil.resolveKey(pump.water.getTankType().getUnlocalizedName()) + ": " + String.format("%,d", pump.water.getFill()) + " / " + String.format("%,d", pump.water.getMaxFill()) + "mB");
}
if(pos[1] > 70) {
text.add("&[" + (BobMathUtil.getBlink() ? 0xff0000 : 0xffff00) + "&]! ! ! ALTITUDE ! ! !");
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -102,7 +102,7 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
}
float rad = radiation.get(newCoord);
if(rad > RadiationConfig.fogRad && world != null && world.rand.nextInt(RadiationConfig.fogCh) == 0 && world.getChunkFromChunkCoords(coord.chunkXPos, coord.chunkZPos).isChunkLoaded) {
if(rad > RadiationConfig.fogRad && world != null && world.rand.nextInt(RadiationConfig.fogCh) == 0 && world.getChunkProvider().chunkExists(coord.chunkXPos, coord.chunkZPos)) {
int x = coord.chunkXPos * 16 + world.rand.nextInt(16);
int z = coord.chunkZPos * 16 + world.rand.nextInt(16);

View File

@ -63,6 +63,7 @@ public class OreDictManager {
public static final String KEY_LEAVES = "treeLeaves";
public static final String KEY_SAPLING = "treeSapling";
public static final String KEY_SAND = "sand";
public static final String KEY_COBBLESTONE = "cobblestone";
public static final String KEY_BLACK = "dyeBlack";
public static final String KEY_RED = "dyeRed";

View File

@ -101,8 +101,11 @@ public class GUIScreenTemplateFolder extends GuiScreen {
for(int i = 0; i < AssemblerRecipes.recipeList.size(); i++) {
if(AssemblerRecipes.hidden.get(AssemblerRecipes.recipeList.get(i)) != null &&
AssemblerRecipes.hidden.get(AssemblerRecipes.recipeList.get(i)).contains(player.getHeldItem().getItem()))
allStacks.add(new ItemStack(ModItems.assembly_template, 1, i));
AssemblerRecipes.hidden.get(AssemblerRecipes.recipeList.get(i)).contains(player.getHeldItem().getItem())) {
ComparableStack comp = AssemblerRecipes.recipeList.get(i);
allStacks.add(ItemAssemblyTemplate.writeType(new ItemStack(ModItems.assembly_template, 1, i), comp));
}
}
isJournal = true;

View File

@ -225,6 +225,22 @@ public class AnvilRecipes {
new ComparableStack(ModItems.circuit_aluminium, 1 * ukModifier)
}, new AnvilOutput(new ItemStack(ModBlocks.machine_assembler))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new OreDictStack(KEY_COBBLESTONE, 8),
new OreDictStack(KEY_PLANKS, 16),
new OreDictStack(IRON.ingot(), 4),
new OreDictStack(CU.plate(), 8)
}, new AnvilOutput(new ItemStack(ModBlocks.pump_steam))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new ComparableStack(Blocks.stonebrick, 8),
new OreDictStack(STEEL.plate(), 16),
new ComparableStack(ModItems.motor, 2),
new ComparableStack(ModItems.circuit_copper, 1)
}, new AnvilOutput(new ItemStack(ModBlocks.pump_electric))).setTier(3));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new ComparableStack(Blocks.furnace),

View File

@ -289,6 +289,8 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPistonInserter.class, new RenderPistonInserter());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConveyorPress.class, new RenderConveyorPress());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRadioTelex.class, new RenderTelex());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePumpSteam.class, new RenderPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePumpElectric.class, new RenderPump());
//Foundry
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryBasin.class, new RenderFoundry());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryMold.class, new RenderFoundry());

View File

@ -287,6 +287,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.capacitor_gold, 1), new Object[] { "PPP", "ICI", "WWW", 'P', STEEL.plate(), 'I', ANY_PLASTIC.ingot(), 'C', GOLD.block(), 'W', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.capacitor_niobium, 1), new Object[] { "PPP", "ICI", "WWW", 'P', STEEL.plate(), 'I', RUBBER.ingot(), 'C', NB.block(), 'W', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.capacitor_tantalium, 1), new Object[] { "PPP", "ICI", "WWW", 'P', STEEL.plate(), 'I', ANY_RESISTANTALLOY.ingot(), 'C', TA.block(), 'W', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.capacitor_schrabidate, 1), new Object[] { "PPP", "ICI", "WWW", 'P', STEEL.plate(), 'I', ANY_RESISTANTALLOY.ingot(), 'C', SBD.block(), 'W', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.machine_coal_off, 1), new Object[] { "STS", "SCS", "SFS", 'S', STEEL.ingot(), 'T', ModItems.tank_steel, 'C', MINGRADE.ingot(), 'F', Blocks.furnace });
addRecipeAuto(new ItemStack(ModBlocks.machine_boiler_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', STEEL.ingot(), 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', Blocks.furnace });
addRecipeAuto(new ItemStack(ModBlocks.machine_boiler_electric_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', DESH.ingot(), 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', ModBlocks.machine_electric_furnace_off });

View File

@ -289,7 +289,8 @@ public class MainRegistry {
SiegeTier.registerTiers();
HazardRegistry.registerItems();
HazardRegistry.registerTrafos();
OreDictManager.registerGroups();
OreDictManager.registerGroups(); //important to run first
OreDictManager.registerOres();
Library.superuser.add("192af5d7-ed0f-48d8-bd89-9d41af8524f8");
Library.superuser.add("5aee1e3d-3767-4987-a222-e7ce1fbdf88e");
@ -806,7 +807,6 @@ public class MainRegistry {
// MUST be initialized AFTER achievements!!
BobmazonOfferFactory.init();
OreDictManager.registerOres();
IMCHandler.registerHandler("blastfurnace", new IMCBlastFurnace());
IMCHandler.registerHandler("crystallizer", new IMCCrystallizer());

View File

@ -125,6 +125,8 @@ public class ModEventHandlerImpact {
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLoad(WorldEvent.Load event) {
TomSaveData.resetLastCached();
if(GeneralConfig.enableImpactWorldProvider) {
DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, WorldProviderNTM.class, true);

View File

@ -96,6 +96,9 @@ public class ResourceManager {
//Gas Turbine
public static final IModelCustom turbinegas = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbinegas.obj"));
//Pumps
public static final IModelCustom pump = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/pump.obj")).asDisplayList();
//Large Turbine
public static final IModelCustom steam_engine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/steam_engine.obj")).asDisplayList();
public static final IModelCustom turbine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbine.obj"));
@ -449,6 +452,10 @@ public class ResourceManager {
//Gas Turbine
public static final ResourceLocation turbinegas_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbinegas.png");
//Pumps
public static final ResourceLocation pump_steam_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pump_steam.png");
public static final ResourceLocation pump_electric_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pump_electric.png");
//Large Turbine
public static final ResourceLocation steam_engine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/steam_engine.png");

View File

@ -0,0 +1,102 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.tileentity.machine.TileEntityMachinePumpBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderPump extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
switch(tile.getBlockMetadata() - BlockDummyable.offset) {
case 3: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(180, 0F, 1F, 0F); break;
case 2: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(0, 0F, 1F, 0F); break;
}
TileEntityMachinePumpBase engine = (TileEntityMachinePumpBase) tile;
float angle = engine.lastRotor + (engine.rotor - engine.lastRotor) * interp;
renderCommon(angle, engine.getBlockType() == ModBlocks.pump_steam ? 0 : 1);
//renderCommon(0, engine.getBlockType() == ModBlocks.pump_steam ? 0 : 1);
GL11.glPopMatrix();
}
private void renderCommon(double rot, int type) {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
if(type == 0) bindTexture(ResourceManager.pump_steam_tex);
else bindTexture(ResourceManager.pump_electric_tex);
ResourceManager.pump.renderPart("Base");
GL11.glPushMatrix();
GL11.glTranslated(0, 2.25, 0);
GL11.glRotated(rot - 90, 0, 0, 1);
GL11.glTranslated(0, -2.25, 0);
ResourceManager.pump.renderPart("Rotor");
GL11.glPopMatrix();
double sin = Math.sin(rot * Math.PI / 180D) * 0.5D - 0.5D;
double cos = Math.cos(rot * Math.PI / 180D) * 0.5D;
double ang = Math.acos(cos / 2D);
double cath = Math.sqrt(1 + (cos * cos) / 2);
GL11.glPushMatrix();
GL11.glTranslated(0, 1 - cath + sin, 0);
GL11.glTranslated(0, 4.75, 0);
GL11.glRotated(ang * 180D / Math.PI - 90D, 0, 0, -1);
GL11.glTranslated(0, -4.75, 0);
ResourceManager.pump.renderPart("Arms");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 1 - cath + sin, 0);
ResourceManager.pump.renderPart("Piston");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.pump_steam);
}
@Override
public Item[] getItemsForRenderer() {
return new Item[] {
Item.getItemFromBlock(ModBlocks.pump_steam),
Item.getItemFromBlock(ModBlocks.pump_electric)
};
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -3, 0);
GL11.glScaled(2.5, 2.5, 2.5);
}
public void renderCommonWithStack(ItemStack item) {
RenderPump.this.renderCommon(System.currentTimeMillis() % 3600 * 0.1F, item.getItem() == Item.getItemFromBlock(ModBlocks.pump_steam) ? 0 : 1);
}};
}
}

View File

@ -71,7 +71,7 @@ public class RenderSteamEngine extends TileEntitySpecialRenderer implements IIte
GL11.glPopMatrix();
GL11.glPushMatrix();
double cath = Math.sqrt(3.515625D - (cos * cos));
double cath = Math.sqrt(3.515625D - (cos * cos) / 2);
GL11.glTranslated(1.875 - cath + sin, 0, 0); //the difference that "1.875 - cath" makes is minuscule but very much noticeable
ResourceManager.steam_engine.renderPart("Piston");
GL11.glPopMatrix();

View File

@ -32,6 +32,10 @@ public class TomSaveData extends WorldSavedData {
public static TomSaveData getLastCachedOrNull() {
return lastCachedUnsafe;
}
public static void resetLastCached() {
lastCachedUnsafe = null;
}
public TomSaveData(String tagName) {
super(tagName);

View File

@ -277,6 +277,9 @@ public class TileMappings {
put(TileEntityHeatBoiler.class, "tileentity_heat_boiler");
put(TileEntityHeatBoilerIndustrial.class, "tileentity_heat_boiler_industrial");
put(TileEntityMachinePumpSteam.class, "tileentity_steam_pump");
put(TileEntityMachinePumpElectric.class, "tileentity_electric_pump");
put(TileEntityFoundryMold.class, "tileentity_foundry_mold");
put(TileEntityFoundryBasin.class, "tileentity_foundry_basin");
put(TileEntityFoundryChannel.class, "tileentity_foundry_channel");

View File

@ -0,0 +1,119 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver {
public FluidTank water;
public boolean isOn = false;
public float rotor;
public float lastRotor;
public void updateEntity() {
if(!worldObj.isRemote) {
for(DirPos pos : getConPos()) {
if(water.getFill() > 0) this.sendFluid(water, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
this.isOn = false;
if(this.canOperate() && yCoord <= 70) {
this.isOn = true;
this.operate();
}
NBTTagCompound data = this.getSync();
INBTPacketReceiver.networkPack(this, data, 150);
} else {
this.lastRotor = this.rotor;
if(this.isOn) this.rotor += 10F;
if(this.rotor >= 360F) {
this.rotor -= 360F;
this.lastRotor -= 360F;
MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.steamEngineOperate", 0.5F, 0.75F);
}
}
}
protected NBTTagCompound getSync() {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
water.writeToNBT(data, "w");
return data;
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.isOn = nbt.getBoolean("isOn");
water.readFromNBT(nbt, "w");
}
protected abstract boolean canOperate();
protected abstract void operate();
protected DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord, Library.NEG_X),
new DirPos(xCoord, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
};
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {water};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {water};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[0];
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 1,
yCoord,
zCoord - 1,
xCoord + 2,
yCoord + 5,
zCoord + 2
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -0,0 +1,69 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase implements IEnergyUser {
public long power;
public static final long maxPower = 10_000;
public TileEntityMachinePumpElectric() {
super();
water = new FluidTank(Fluids.WATER, 1_000_000);
}
public void updateEntity() {
if(!worldObj.isRemote) {
if(worldObj.getTotalWorldTime() % 20 == 0) for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
super.updateEntity();
}
protected NBTTagCompound getSync() {
NBTTagCompound data = super.getSync();
data.setLong("power", power);
return data;
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
super.networkUnpack(nbt);
this.power = nbt.getLong("power");
}
@Override
protected boolean canOperate() {
return power >= 1_000 && water.getFill() < water.getMaxFill();
}
@Override
protected void operate() {
this.power -= 1_000;
water.setFill(Math.min(water.getFill() + 10_000, water.getMaxFill()));
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
@Override
public void setPower(long power) {
this.power = power;
}
}

View File

@ -0,0 +1,76 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.util.fauxpointtwelve.DirPos;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase {
public FluidTank steam;
public FluidTank lps;
public TileEntityMachinePumpSteam() {
super();
water = new FluidTank(Fluids.WATER, 100_000);
steam = new FluidTank(Fluids.STEAM, 1_000);
lps = new FluidTank(Fluids.SPENTSTEAM, 10);
}
public void updateEntity() {
if(!worldObj.isRemote) {
for(DirPos pos : getConPos()) {
this.trySubscribe(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(lps.getFill() > 0) {
this.sendFluid(lps, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
}
super.updateEntity();
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {water, steam, lps};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {water, lps};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {steam};
}
protected NBTTagCompound getSync() {
NBTTagCompound data = super.getSync();
steam.writeToNBT(data, "s");
lps.writeToNBT(data, "l");
return data;
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
super.networkUnpack(nbt);
steam.readFromNBT(nbt, "s");
lps.readFromNBT(nbt, "l");
}
@Override
protected boolean canOperate() {
return steam.getFill() >= 100 && lps.getMaxFill() - lps.getFill() > 0 && water.getFill() < water.getMaxFill();
}
@Override
protected void operate() {
steam.setFill(steam.getFill() - 100);
lps.setFill(lps.getFill() + 1);
water.setFill(Math.min(water.getFill() + 1000, water.getMaxFill()));
}
}

View File

@ -1,5 +1,8 @@
package com.hbm.tileentity.network;
import java.util.ArrayList;
import java.util.List;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.gui.GuiScreenRadioTelex;
import com.hbm.tileentity.IGUIProvider;
@ -104,6 +107,7 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv
this.deleteOnReceive = true;
} else if(c == eol) {
if(this.writingLine < 4) this.writingLine++;
this.markDirty();
} else if(c == bell) {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 2F, 0.5F);
} else if(c == print) {
@ -113,6 +117,7 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv
this.writingLine = 0;
} else {
this.rxBuffer[this.writingLine] += c;
this.markDirty();
}
}
}
@ -174,7 +179,11 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv
public void print() {
ItemStack stack = new ItemStack(Items.paper);
ItemStackUtil.addTooltipToStack(stack, rxBuffer);
List<String> text = new ArrayList();
for(int i = 0; i < 5; i++) {
if(!rxBuffer[i].isEmpty()) text.add(rxBuffer[i]);
}
ItemStackUtil.addTooltipToStack(stack, text.toArray(new String[0]));
stack.setStackDisplayName("Message");
worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, stack));
}
@ -184,6 +193,30 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 16 * 16;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
for(int i = 0; i < 5; i++) {
txBuffer[i] = nbt.getString("tx" + i);
rxBuffer[i] = nbt.getString("rx" + i);
}
this.txChannel = nbt.getString("txChan");
this.rxChannel = nbt.getString("rxChan");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
for(int i = 0; i < 5; i++) {
nbt.setString("tx" + i, txBuffer[i]);
nbt.setString("rx" + i, rxBuffer[i]);
}
nbt.setString("txChan", txChannel);
nbt.setString("rxChan", rxChannel);
}
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
@Override

View File

@ -4255,6 +4255,10 @@ tile.pribris.name=RBMK-Schutt
tile.pribris_burning.name=Flammender RBMK-Schutt
tile.pribris_digamma.name=Geschwärzter RBMK-Schutt
tile.pribris_radiating.name=Glühender RBMK-Schutt
tile.pump_electric.name=Elektrische Grundwasserpumpe
tile.pump_electric.desc=Nutzt Strom um Grundwasser hochzupumpen$Erzeugt bis zu 10.000mB/t$Muss unter Y:70 platziert werden
tile.pump_steam.name=Dampfbetriebene Grundwasserpumpe
tile.pump_steam.desc=Nutzt Dampf um Grundwasser hochzupumpen$Erzeugt bis zu 10.000mB/t$Muss unter Y:70 platziert werden
tile.pwr_block.name=PWR
tile.pwr_casing.name=PWR Druckbehälter
tile.pwr_casing.desc=Muss alle internen Teile des PWRs abdecken$Platzierung: Hülle

View File

@ -5235,6 +5235,10 @@ tile.pribris.name=RBMK Debris
tile.pribris_burning.name=Flaming RBMK Debris
tile.pribris_digamma.name=Blackened RBMK Debris
tile.pribris_radiating.name=Smoldering RBMK Debris
tile.pump_electric.name=Electric Groundwater Pump
tile.pump_electric.desc=Uses electricity to pump up groundwater$Generates up to 10,000mB/t$Needs to be placed below Y:70
tile.pump_steam.name=Steam-Powered Groundwater Pump
tile.pump_steam.desc=Uses steam to pump up groundwater$Generates up to 100mB/t$Needs to be placed below Y:70
tile.pwr_block.name=PWR
tile.pwr_casing.name=PWR Pressure Vessel
tile.pwr_casing.desc=Needs to cover all internal parts for the reactor to form$Placement: Casing

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB