i wonder if the sky people like me

This commit is contained in:
Bob 2023-11-04 23:31:20 +01:00
parent 40626b5cef
commit ca9d8e74e0
18 changed files with 218 additions and 61 deletions

View File

@ -25,6 +25,9 @@
* the industrial generator now has three additional ports on its underside, meaning it is now a lot easier to properly automate all necessary IO
* Neodymium is now a valid crucible material
* Particle accelerators will now evenly distribute items using IO if both inputs are equal, making the antischrabidium recipe a lot easier to automate
* Due to multiple complaints regarding the plastic bag's ability to contain radiation, plastic bags now *double* the radiation of the item they contain
* The post impact spawning restrictions have changed, meaning that spawning things with spawn eggs is no longer broken. Due to technical limitations, this means that post impact, no mobs will spawn as part of world gen, only via random spawns.
* All energy storage blocks now have a fixed transfer limit of 5% of their capacity per tick, reducing the impact of ping-ponging considerably
## Fixed
* Pipe and power networks now force the chunk to be saved on transfer, ensuring that rapid changes in the fluid/energy level aren't lost when the tile entity is unloaded

View File

@ -4,6 +4,7 @@ import java.util.Random;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.deco.TileEntityLanternBehemoth;
@ -48,7 +49,14 @@ public class BlockLanternBehemoth extends BlockDummyable implements IToolable, I
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.TORCH) return false;
return IRepairable.tryRepairMultiblock(world, x, y, z, this, player);
boolean didRepair = IRepairable.tryRepairMultiblock(world, x, y, z, this, player);
if(didRepair) {
HbmPlayerProps data = HbmPlayerProps.getData(player);
data.reputation++;
}
return didRepair;
}
@Override

View File

@ -1,15 +1,20 @@
package com.hbm.blocks.machine;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineWoodBurner;
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.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineWoodBurner extends BlockDummyable {
public class MachineWoodBurner extends BlockDummyable implements ITooltipProvider {
public MachineWoodBurner(Material mat) {
super(mat);
@ -36,4 +41,18 @@ public class MachineWoodBurner extends BlockDummyable {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX + rot.offsetX, y, z - dir.offsetZ + rot.offsetZ);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);
}
}

View File

@ -41,6 +41,8 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
public int lastDamage = 0;
public static final float shieldCap = 100;
public int reputation;
public HbmPlayerProps(EntityPlayer player) {
this.player = player;
}
@ -157,6 +159,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
props.setFloat("maxShield", maxShield);
props.setBoolean("enableBackpack", enableBackpack);
props.setBoolean("enableHUD", enableHUD);
props.setInteger("reputation", reputation);
nbt.setTag("HbmPlayerProps", props);
}
@ -172,6 +175,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
this.maxShield = props.getFloat("maxShield");
this.enableBackpack = props.getBoolean("enableBackpack");
this.enableHUD = props.getBoolean("enableHUD");
this.reputation = props.getInteger("reputation");
}
}
}

View File

@ -23,8 +23,9 @@ public class HazardTransformerRadiationContainer extends HazardTransformerBase {
boolean isCrate = Block.getBlockFromItem(stack.getItem()) instanceof BlockStorageCrate;
boolean isBox = stack.getItem() == ModItems.containment_box;
boolean isBag = stack.getItem() == ModItems.plastic_bag;
if(!isCrate && !isBox) return;
if(!isCrate && !isBox && !isBag) return;
if(!stack.hasTagCompound()) return;
float radiation = 0;
@ -54,6 +55,20 @@ public class HazardTransformerRadiationContainer extends HazardTransformerBase {
radiation = (float) BobMathUtil.squirt(radiation);
}
if(isBag) {
ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(stack, 1);
if(fromNBT == null) return;
for(ItemStack held : fromNBT) {
if(held != null) {
radiation += HazardSystem.getHazardLevelFromStack(held, HazardRegistry.RADIATION) * held.stackSize;
}
}
radiation *= 2F;
}
if(radiation > 0) {
entries.add(new HazardEntry(HazardRegistry.RADIATION, radiation));
}

View File

@ -49,7 +49,7 @@ public class GUIMachineWoodBurner extends GuiInfoContainer {
}
}
if(burner.liquidBurn) burner.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 70, guiTop + 28, 34, 52);
if(burner.liquidBurn) burner.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 18, 16, 52);
if(!burner.liquidBurn && guiLeft + 16 <= mouseX && guiLeft + 16 + 8 > mouseX && guiTop + 17 < mouseY && guiTop + 17 + 54 >= mouseY) {
func_146283_a(Arrays.asList(new String[] { (burner.burnTime / 20) + "s" }), mouseX, mouseY);
@ -110,6 +110,6 @@ public class GUIMachineWoodBurner extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 17, guiTop + 70 - b, 192, 52 - b, 4, b);
}
if(burner.liquidBurn) burner.tank.renderTank(guiLeft + 70, guiTop + 80, this.zLevel, 34, 52);
if(burner.liquidBurn) burner.tank.renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hbm.entity.effect.EntityNukeTorex;
import com.hbm.lib.Library;
import com.hbm.saveddata.TomSaveData;
import com.hbm.util.TrackerUtil;
import net.minecraft.entity.player.EntityPlayer;
@ -41,11 +42,11 @@ public class ItemWandD extends Item {
TimeAnalyzer.endCount();
TimeAnalyzer.dump();*/
/*TomSaveData data = TomSaveData.forWorld(world);
data.impact = false;
TomSaveData data = TomSaveData.forWorld(world);
data.impact = true;
data.fire = 0F;
data.dust = 0F;
data.markDirty();*/
data.markDirty();
/*EntityTomBlast tom = new EntityTomBlast(world);
tom.posX = pos.blockX;
@ -54,16 +55,17 @@ public class ItemWandD extends Item {
tom.destructionRange = 600;
world.spawnEntityInWorld(tom);*/
EntityNukeTorex torex = new EntityNukeTorex(world);
/*EntityNukeTorex torex = new EntityNukeTorex(world);
torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0);
torex.setScale(1.5F);
torex.setType(1);
world.spawnEntityInWorld(torex);
TrackerUtil.setTrackingRange(world, torex, 1000);*/
/*EntityTracker entitytracker = ((WorldServer) world).getEntityTracker();
IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c");
EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(torex.getEntityId());
entry.blocksDistanceThreshold = 1000;*/
TrackerUtil.setTrackingRange(world, torex, 1000);
//world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 150, pos.blockX, pos.blockY + 1, pos.blockZ));
//DungeonToolbox.generateBedrockOreWithChance(world, world.rand, pos.blockX, pos.blockZ, EnumBedrockOre.TITANIUM, new FluidStack(Fluids.SULFURIC_ACID, 500), 2, 1);

View File

@ -292,7 +292,8 @@ public class CraftingManager {
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_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_wood_burner, 1), new Object[] { "PPP", "CSC", "IFI" , 'P', STEEL.plate528(), 'C', ModItems.coil_copper, 'S', ModItems.hull_small_steel, 'I', IRON.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 });
addRecipeAuto(new ItemStack(ModBlocks.machine_turbine, 1), new Object[] { "SMS", "PTP", "SMS", 'S', STEEL.ingot(), 'T', ModItems.turbine_titanium, 'M', ModItems.coil_copper, 'P', ANY_PLASTIC.ingot() });

View File

@ -5,9 +5,7 @@ import com.hbm.blocks.BlockEnums.EnumStoneType;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockMotherOfAllOres;
import com.hbm.blocks.generic.BlockToolConversion;
import com.hbm.commands.CommandDebugChunkLoad;
import com.hbm.commands.CommandReloadRecipes;
import com.hbm.commands.CommandSatellites;
import com.hbm.commands.*;
import com.hbm.config.*;
import com.hbm.crafting.RodRecipes;
import com.hbm.creativetabs.*;
@ -924,6 +922,7 @@ public class MainRegistry {
event.registerServerCommand(new CommandReloadRecipes());
event.registerServerCommand(new CommandDebugChunkLoad());
event.registerServerCommand(new CommandSatellites());
event.registerServerCommand(new CommandRadiation());
}
@EventHandler

View File

@ -35,6 +35,7 @@ import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
import net.minecraftforge.event.terraingen.BiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
import net.minecraftforge.event.world.WorldEvent;
@ -109,17 +110,32 @@ public class ModEventHandlerImpact {
if(event.world.provider.dimensionId == 0) {
if(event.entityLiving.height >= 0.85F || event.entityLiving.width >= 0.85F && !(event.entity instanceof EntityWaterMob) && !event.entityLiving.isChild()) {
event.setResult(Result.DENY);
event.entityLiving.setDead();
}
}
if(event.entityLiving instanceof EntityWaterMob) {
Random rand = new Random();
if(rand.nextInt(5) != 0) {
event.setResult(Result.DENY);
event.entityLiving.setDead();
}
}
}
}
}
@SubscribeEvent
public void onPopulate(Populate event) {
if(event.type == Populate.EventType.ANIMALS) {
TomSaveData data = TomSaveData.forWorld(event.world);
if(data.impact) {
event.setResult(Result.DENY);
}
}
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLoad(WorldEvent.Load event) {

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.missile.EntityBobmazon;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
@ -15,6 +16,7 @@ import com.hbm.tileentity.IRepairable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -39,6 +41,9 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR
if(comTimer == 100) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.hornFarDual", 10000F, 1F);
if(comTimer == 0) {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord - 10, yCoord - 10, zCoord - 10, xCoord + 11, yCoord + 11, zCoord + 11));
EntityPlayer first = players.isEmpty() ? null : players.get(0);
boolean bonus = first == null ? false : (HbmPlayerProps.getData(first).reputation >= 10);
EntityBobmazon shuttle = new EntityBobmazon(worldObj);
shuttle.posX = xCoord + 0.5 + worldObj.rand.nextGaussian() * 10;
shuttle.posY = 300;
@ -48,7 +53,7 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR
new ItemStack(ModItems.circuit_copper, 4 + worldObj.rand.nextInt(2)),
new ItemStack(ModItems.circuit_red_copper, 2 + worldObj.rand.nextInt(3)),
new ItemStack(ModItems.circuit_gold, 1 + worldObj.rand.nextInt(2)),
worldObj.rand.nextInt(3) == 0 ? new ItemStack(ModItems.gem_alexandrite) : new ItemStack(Items.diamond, 6 + worldObj.rand.nextInt(6)),
bonus ? new ItemStack(ModItems.gem_alexandrite) : new ItemStack(Items.diamond, 6 + worldObj.rand.nextInt(6)),
new ItemStack(Blocks.red_flower));
shuttle.payload = payload;
@ -64,6 +69,16 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR
INBTPacketReceiver.networkPack(this, data, 250);
}
}
@Override
public void invalidate() {
super.invalidate();
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord - 50, yCoord - 50, zCoord - 50, xCoord + 51, yCoord + 51, zCoord + 51));
for(EntityPlayer player : players) {
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(props.reputation > -10) props.reputation--;
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {

View File

@ -34,7 +34,7 @@ import li.cil.oc.api.network.SimpleComponent;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMachineRadar extends TileEntityTickingBase implements IEnergyUser, IGUIProvider, SimpleComponent {
public List<Entity> entList = new ArrayList();
public List<Entity> detectedEntities = new ArrayList();
public List<int[]> nearbyMissiles = new ArrayList();
int pingTimer = 0;
int lastPower;
@ -61,8 +61,7 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
@Override
public void updateEntity() {
if(this.yCoord < WeaponConfig.radarAltitude)
return;
if(this.yCoord < WeaponConfig.radarAltitude) return;
if(!worldObj.isRemote) {
@ -71,17 +70,13 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
nearbyMissiles.clear();
if(power > 0) {
allocateMissiles();
power -= 500;
if(power < 0)
power = 0;
if(power < 0) power = 0;
}
if(this.lastPower != getRedPower())
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
if(this.lastPower != getRedPower()) worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
sendMissileData();
lastPower = getRedPower();
@ -96,12 +91,8 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
}
}
} else {
prevRotation = rotation;
if(power > 0) {
rotation += 5F;
}
if(power > 0) rotation += 5F;
if(rotation >= 360) {
rotation -= 360F;
@ -123,7 +114,7 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
private void allocateMissiles() {
nearbyMissiles.clear();
entList.clear();
detectedEntities.clear();
jammed = false;
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord + 0.5 - WeaponConfig.radarRange, 0, zCoord + 0.5 - WeaponConfig.radarRange, xCoord + 0.5 + WeaponConfig.radarRange, 5000, zCoord + 0.5 + WeaponConfig.radarRange));
@ -136,27 +127,27 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
if(e instanceof EntityLivingBase && HbmLivingProps.getDigamma((EntityLivingBase) e) > 0.001) {
this.jammed = true;
nearbyMissiles.clear();
entList.clear();
detectedEntities.clear();
return;
}
if(e instanceof EntityPlayer && this.scanPlayers) {
nearbyMissiles.add(new int[] { (int)e.posX, (int)e.posZ, RadarTargetType.PLAYER.ordinal(), (int)e.posY });
entList.add(e);
detectedEntities.add(e);
}
if(e instanceof IRadarDetectable && this.scanMissiles) {
nearbyMissiles.add(new int[] { (int)e.posX, (int)e.posZ, ((IRadarDetectable)e).getTargetType().ordinal(), (int)e.posY });
if(!this.smartMode || e.motionY <= 0)
entList.add(e);
detectedEntities.add(e);
}
}
}
public int getRedPower() {
if(!entList.isEmpty()) {
if(!detectedEntities.isEmpty()) {
/// PROXIMITY ///
if(redMode) {
@ -165,9 +156,9 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
int power = 0;
for(int i = 0; i < entList.size(); i++) {
for(int i = 0; i < detectedEntities.size(); i++) {
Entity e = entList.get(i);
Entity e = detectedEntities.get(i);
double dist = Math.sqrt(Math.pow(e.posX - xCoord, 2) + Math.pow(e.posZ - zCoord, 2));
int p = 15 - (int)Math.floor(dist / maxRange * 15);
@ -315,8 +306,8 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
public Object[] getEntities(Context context, Arguments args) { //fuck fuck fuck
if(!jammed) {
List<Object> list = new ArrayList();
list.add(entList.size()); // small header of how many entities in the list
for (Entity e : entList) {
list.add(detectedEntities.size()); // small header of how many entities in the list
for (Entity e : detectedEntities) {
list.add(e.posX); // positions
list.add(e.posY);
list.add(e.posZ);

View File

@ -5,6 +5,7 @@ import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.container.ContainerMachineWoodBurner;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.fluid.trait.FT_Flammable;
@ -40,6 +41,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
public boolean isOn = false;
public FluidTank tank;
public int millis = 0;
public static ModuleBurnTime burnModule = new ModuleBurnTime().setLogTimeMod(4).setWoodTimeMod(2);
@ -106,19 +108,32 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
FT_Flammable trait = tank.getTankType().getTrait(FT_Flammable.class);
if(trait != null) {
this.power += trait.getHeatEnergy() / 2L;
tank.setFill(tank.getFill() - 1);
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
if(millis <= 900) {
this.tank.setFill(tank.getFill() - 1);
this.millis += 100;
}
int toBurn = Math.min(millis, 5);
if(toBurn > 0) {
this.power += trait.getHeatEnergy() * toBurn / 4_000L;
this.millis -= toBurn;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
}
}
}
}
if(this.power > this.maxPower) this.power = this.maxPower;
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setInteger("burnTime", burnTime);
data.setInteger("maxBurnTime", maxBurnTime);
data.setBoolean("isOn", isOn);
data.setBoolean("liquidBurn", liquidBurn);
tank.writeToNBT(data, "t");
this.networkPack(data, 25);
} else {
@ -146,6 +161,30 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
this.maxBurnTime = nbt.getInteger("maxBurnTime");
this.isOn = nbt.getBoolean("isOn");
this.liquidBurn = nbt.getBoolean("liquidBurn");
tank.readFromNBT(nbt, "t");
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.power = nbt.getLong("power");
this.burnTime = nbt.getInteger("burnTime");
this.maxBurnTime = nbt.getInteger("maxBurnTime");
this.isOn = nbt.getBoolean("isOn");
this.liquidBurn = nbt.getBoolean("liquidBurn");
tank.readFromNBT(nbt, "t");
this.millis = nbt.getInteger("millis");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setLong("power", power);
nbt.setInteger("burnTime", burnTime);
nbt.setInteger("maxBurnTime", maxBurnTime);
nbt.setBoolean("isOn", isOn);
nbt.setBoolean("liquidBurn", liquidBurn);
tank.writeToNBT(nbt, "t");
nbt.setInteger("millis", millis);
}
protected boolean processAsh(int level, EnumAshType type, int threshold) {
@ -222,6 +261,18 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
return maxPower;
}
@Override
public boolean canConnect(ForgeDirection dir) {
ForgeDirection rot = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
return dir == rot.getOpposite();
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
ForgeDirection rot = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
return dir == rot.getOpposite();
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {tank};

View File

@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.storage;
import api.hbm.energy.*;
import com.hbm.blocks.machine.MachineBattery;
import com.hbm.config.GeneralConfig;
import com.hbm.inventory.container.ContainerMachineBattery;
import com.hbm.inventory.gui.GUIMachineBattery;
import com.hbm.lib.Library;
@ -36,6 +37,8 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
public long[] log = new long[20];
public long delta = 0;
public long power = 0;
public long prevPowerState = 0;
public int pingPongTicks = 0;
//0: input only
//1: buffer
@ -180,8 +183,23 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
this.log[i - 1] = this.log[i];
}
if(GeneralConfig.enable528) {
long threshold = this.getMaxPower() / 3;
if(Math.abs(prevPower - power) > threshold && Math.abs(prevPower - prevPowerState) > threshold) {
this.pingPongTicks++;
if(this.pingPongTicks > 10) {
worldObj.func_147480_a(xCoord, yCoord, zCoord, false);
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 10F, false, false);
}
} else {
if(this.pingPongTicks > 0) this.pingPongTicks--;
}
}
this.log[19] = avg;
prevPowerState = power;
NBTTagCompound nbt = new NBTTagCompound();
nbt.setLong("power", avg);
nbt.setLong("delta", delta);
@ -237,7 +255,9 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
if(x instanceof PowerNet) PowerNet.trackingInstances.add((PowerNet) x);
});
this.power = PowerNet.fairTransfer(con, this.power);
long toSend = Math.min(this.power, this.getMaxTransfer());
long powerRemaining = this.power - toSend;
this.power = PowerNet.fairTransfer(con, toSend) + powerRemaining;
}
//resubscribe to buffered nets, if necessary
@ -246,7 +266,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
}
}
protected void transmitPower() {
@Deprecated protected void transmitPower() {
short mode = (short) this.getRelevantMode();
@ -298,7 +318,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
}
public long getMaxTransfer() {
return this.getMaxPower();
return this.getMaxPower() / 20;
}
@Override
@ -342,24 +362,29 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
*/
@Override
public long transferPower(long power) {
int mode = this.getRelevantMode();
if(mode == mode_output || mode == mode_none) {
return power;
long overshoot = 0;
// if power exceeds our transfer limit, truncate
if(power > getMaxTransfer()) {
overshoot += power - getMaxTransfer();
power = getMaxTransfer();
}
this.power += power;
// this check is in essence the same as the default implementation, but re-arranged to never overflow the int64 range
// if the remaining power exceeds the power cap, truncate again
long freespace = this.getMaxPower() - this.getPower();
if(freespace < power) {
overshoot += power - freespace;
power = freespace;
}
// what remains is sure to not exceed the transfer limit and the power cap (and therefore the int64 range)
this.setPower(this.getPower() + power);
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
if(this.power > this.getMaxPower()) {
long overshoot = this.power - this.getMaxPower();
this.power = this.getMaxPower();
return overshoot;
}
return 0;
return overshoot;
}
@Override
@ -371,7 +396,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
return 0;
}
return Math.max(getMaxPower() - getPower(), 0);
return Math.min(Math.max(getMaxPower() - getPower(), 0), this.getMaxTransfer());
}
@Override
@ -411,6 +436,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
public void writeNBT(NBTTagCompound nbt) {
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setLong("prevPowerState", prevPowerState);
data.setShort("redLow", redLow);
data.setShort("redHigh", redHigh);
data.setInteger("priority", this.priority.ordinal());
@ -421,6 +447,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
public void readNBT(NBTTagCompound nbt) {
NBTTagCompound data = nbt.getCompoundTag(NBT_PERSISTENT_KEY);
this.power = data.getLong("power");
this.prevPowerState = data.getLong("prevPowerState");
this.redLow = data.getShort("redLow");
this.redHigh = data.getShort("redHigh");
this.priority = ConnectionPriority.values()[data.getInteger("priority")];

View File

@ -35,7 +35,7 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery {
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
//////////////////////////////////////////////////////////////////////
this.transmitPower();
this.transmitPowerFairly();
//////////////////////////////////////////////////////////////////////
byte comp = this.getComparatorPower();
@ -142,8 +142,8 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery {
}
@Override
public long getTransferWeight() {
return Math.min(Math.max(this.getMaxPower() - getPower(), 0), maxTransfer);
public long getMaxTransfer() {
return maxTransfer;
}
public float getSpeed() {

View File

@ -360,6 +360,7 @@ container.machineSILEX=SILEX
container.machineSolidifier=Verfestiger
container.machineTurbine=Dampfturbine
container.machineTurbofan=Turbofan
container.machineWoodBurner=Brennholzgenerator
container.machine_schrabidium_transmutator=Schrabidium-Transmutationsgerät
container.massStorage=Speicher
container.microwave=Mikrowelle
@ -4167,6 +4168,8 @@ tile.machine_turbofan.name=Turbofan
tile.machine_uf6_tank.name=Uranhexafluorid-Tank
tile.machine_vacuum_distill.name=Vakuumraffinerie
tile.machine_waste_drum.name=Abklingbecken-Trommel
tile.machine_wood_burner.name=Brennholzgenerator
tile.machine_wood_burner.desc=Erzeugt 100HE/t aus Items$Sammelt Asche$Kann 1mB/s Flüssigkeiten mit 25%% Effizienz verbrennen
tile.machine_well.name=Ölbohrturm
tile.machine_zirnox.name=ZIRNOX Atomreaktor
tile.marker_structure.name=Multiblock-Strukturvorlage

View File

@ -718,6 +718,7 @@ container.machineSILEX=SILEX
container.machineSolidifier=Solidifier
container.machineTurbine=Steam Turbine
container.machineTurbofan=Turbofan
container.machineWoodBurner=Wood-Burner
container.machine_schrabidium_transmutator=Schrabidium Transmutation Device
container.massStorage=Storage
container.microwave=Microwave
@ -5146,6 +5147,8 @@ tile.machine_turbofan.name=Turbofan
tile.machine_uf6_tank.name=Uranium Hexafluoride Tank
tile.machine_vacuum_distill.name=Vacuum Refinery
tile.machine_waste_drum.name=Spent Fuel Pool Drum
tile.machine_wood_burner.name=Wood-Burning Generator
tile.machine_wood_burner.desc=Generates 100HE/t when burning items$Collects ashes$Can burn fluids at 25%% efficiency at 1mB/s
tile.machine_well.name=Oil Derrick
tile.machine_zirnox.name=ZIRNOX Nuclear Reactor
tile.marker_structure.name=Multiblock Structure Marker

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB