mk5, some fluid stuff

This commit is contained in:
Bob 2022-11-20 20:38:46 +01:00
parent bb2a2b9607
commit afaedaca95
15 changed files with 644 additions and 46 deletions

View File

@ -1,20 +1,28 @@
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.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.trait.FT_Flammable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityHeaterOilburner;
import com.hbm.util.I18nUtil;
import api.hbm.block.IToolable;
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 HeaterOilburner extends BlockDummyable implements ITooltipProvider {
public class HeaterOilburner extends BlockDummyable implements ILookOverlay, ITooltipProvider, IToolable {
public HeaterOilburner() {
super(Material.iron);
@ -68,4 +76,53 @@ public class HeaterOilburner extends BlockDummyable implements ITooltipProvider
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]);
if(!(te instanceof TileEntityHeaterOilburner))
return;
TileEntityHeaterOilburner heater = (TileEntityHeaterOilburner) te;
List<String> text = new ArrayList();
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + heater.setting + " mB/t");
FluidType type = heater.tank.getTankType();
if(type.hasTrait(FT_Flammable.class)) {
int heat = (int)(type.getTrait(FT_Flammable.class).getHeatEnergy() * heater.setting / 1000);
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + String.format("%,d", heat) + " TU/t");
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
@Override
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.SCREWDRIVER)
return false;
if(world.isRemote) return true;
int[] pos = this.findCore(world, x, y, z);
if(pos == null) return false;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(te instanceof TileEntityHeaterOilburner)) return false;
TileEntityHeaterOilburner tile = (TileEntityHeaterOilburner) te;
tile.toggleSetting();
tile.markDirty();
return true;
}
}

View File

@ -5,7 +5,6 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.util.ContaminationUtil;
@ -44,7 +43,7 @@ public class RBMKDebrisRadiating extends RBMKDebrisBurning {
data.setString("type", "rbmkflame");
data.setInteger("maxAge", 300);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + rand.nextDouble(), y + 1.75, z + rand.nextDouble()), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
MainRegistry.proxy.effectNT(data);
//MainRegistry.proxy.effectNT(data);
world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F);
}

View File

@ -114,6 +114,7 @@ public class EntityMappings {
addEntity(EntityMissileTaint.class, "entity_missile_taint", 1000);
addEntity(EntityGrenadeGascan.class, "entity_grenade_gascan", 1000);
addEntity(EntityNukeExplosionMK4.class, "entity_nuke_mk4", 1000);
addEntity(EntityNukeExplosionMK5.class, "entity_nuke_mk5", 1000);
addEntity(EntityCloudFleijaRainbow.class, "entity_cloud_rainbow", 1000);
addEntity(EntityExplosiveBeam.class, "entity_beam_bomb", 1000);
addEntity(EntityAAShell.class, "entity_aa_shell", 1000);

View File

@ -21,12 +21,14 @@ public class EntityNukeTorex extends Entity {
public double torusWidth = 3;
public double rollerSize = 1;
public double heat = 1;
public double lastSpawnY = - 1;
public ArrayList<Cloudlet> cloudlets = new ArrayList();
//public static int cloudletLife = 200;
public EntityNukeTorex(World world) {
super(world);
this.ignoreFrustumCheck = true;
this.setSize(1F, 50F);
}
@Override
@ -36,26 +38,39 @@ public class EntityNukeTorex extends Entity {
@Override
public void onUpdate() {
//this.ticksExisted++;
double s = this.getScale();
int maxAge = this.getMaxAge();
if(worldObj.isRemote) {
if(lastSpawnY == -1) {
lastSpawnY = posY - 3;
}
int spawnTarget = worldObj.getHeightValue((int) Math.floor(posX), (int) Math.floor(posZ)) - 3;
double moveSpeed = 0.5D;
if(Math.abs(spawnTarget - lastSpawnY) < moveSpeed) {
lastSpawnY = spawnTarget;
} else {
lastSpawnY += moveSpeed * Math.signum(spawnTarget - lastSpawnY);
}
double range = (torusWidth - rollerSize) * 0.25;
double simSpeed = getSimulationSpeed();
int toSpawn = (int) Math.ceil(10 * simSpeed * simSpeed);
int lifetime = Math.min((ticksExisted * ticksExisted) + 200, maxAge - ticksExisted + 200);
for(int i = 0; i < toSpawn; i++) {
double y = posY + rand.nextGaussian() - 3; //this.ticksExisted < 60 ? this.posY + this.coreHeight : posY + rand.nextGaussian() - 3;
Cloudlet cloud = new Cloudlet(posX + rand.nextGaussian() * range, y, posZ + rand.nextGaussian() * range, (float)(rand.nextDouble() * 2D * Math.PI), 0, lifetime);
double x = posX + rand.nextGaussian() * range;
double z = posZ + rand.nextGaussian() * range;
Cloudlet cloud = new Cloudlet(x, lastSpawnY, z, (float)(rand.nextDouble() * 2D * Math.PI), 0, lifetime);
cloud.setScale(1F + this.ticksExisted * 0.005F * (float) s, 5F * (float) s);
cloudlets.add(cloud);
}
if(ticksExisted < 100) {
if(ticksExisted < 50) {
int cloudCount = ticksExisted * 5;
int shockLife = 200 - ticksExisted * 9 / 10;
@ -345,6 +360,6 @@ public class EntityNukeTorex extends Entity {
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance) {
return distance < 25000;
return true;
}
}

View File

@ -0,0 +1,222 @@
package com.hbm.entity.logic;
import java.util.List;
import org.apache.logging.log4j.Level;
import com.hbm.config.BombConfig;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.effect.EntityFalloutRain;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.explosion.ExplosionNukeRay;
import com.hbm.explosion.ExplosionNukeRayBatched;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.ContaminationUtil.ContaminationType;
import com.hbm.util.ContaminationUtil.HazardType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityNukeExplosionMK5 extends Entity {
//Strength of the blast
public int strength;
//How many rays should be created
public int count;
//How many rays are calculated per tick
public int speed;
public int length;
public boolean mute = false;
public boolean fallout = true;
private int falloutAdd = 0;
ExplosionNukeRayBatched explosion;
public EntityNukeExplosionMK5(World p_i1582_1_) {
super(p_i1582_1_);
}
public EntityNukeExplosionMK5(World world, int strength, int count, int speed, int length) {
super(world);
this.strength = strength;
this.count = count;
this.speed = speed;
this.length = length;
}
@Override
public void onUpdate() {
if(strength == 0) {
this.setDead();
return;
}
for(Object player : this.worldObj.playerEntities)
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
if(!worldObj.isRemote && fallout && explosion != null && this.ticksExisted < 10) {
radiate(500_000, this.length * 2);
/*float radMax = Math.min((float) (length / 2F * Math.pow(length, 1.5) / 35F), 15000);
float rad = radMax / 4F;
ChunkRadiationManager.proxy.incrementRad(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rad);*/
}
if(!mute) {
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
if(rand.nextInt(5) == 0)
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
}
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.length * 2);
if(explosion == null) {
explosion = new ExplosionNukeRayBatched(worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, this.strength, this.count, this.speed, this.length);
}
if(!explosion.isAusf3Complete) {
explosion.collectTip(speed * 10);
} else if(explosion.perChunk.size() > 0) {
long start = System.currentTimeMillis();
while(explosion.perChunk.size() > 0 && System.currentTimeMillis() < start + 50) explosion.processChunk(BombConfig.mk4);
} else if(fallout) {
EntityFalloutRain fallout = new EntityFalloutRain(this.worldObj);
fallout.posX = this.posX;
fallout.posY = this.posY;
fallout.posZ = this.posZ;
fallout.setScale((int)(this.length * 2.5 + falloutAdd) * BombConfig.falloutRange / 100);
this.worldObj.spawnEntityInWorld(fallout);
this.setDead();
} else {
this.setDead();
System.out.println("STOPPING");
}
}
private void radiate(float rads, double range) {
List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(range, range, range));
for(EntityLivingBase e : entities) {
Vec3 vec = Vec3.createVectorHelper(e.posX - posX, (e.posY + e.getEyeHeight()) - posY, e.posZ - posZ);
double len = vec.lengthVector();
vec = vec.normalize();
float res = 0;
for(int i = 1; i < len; i++) {
int ix = (int)Math.floor(posX + vec.xCoord * i);
int iy = (int)Math.floor(posY + vec.yCoord * i);
int iz = (int)Math.floor(posZ + vec.zCoord * i);
res += worldObj.getBlock(ix, iy, iz).getExplosionResistance(null);
}
if(res < 1)
res = 1;
float eRads = rads;
eRads /= (float)res;
eRads /= (float)(len * len);
ContaminationUtil.contaminate(e, HazardType.RADIATION, ContaminationType.CREATIVE, eRads);
}
}
@Override
protected void entityInit() { }
@Override
protected void readEntityFromNBT(NBTTagCompound nbt) {
this.ticksExisted = nbt.getInteger("ticksExisted");
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbt) {
nbt.setInteger("ticksExisted", this.ticksExisted);
}
public static EntityNukeExplosionMK5 statFac(World world, int r, double x, double y, double z) {
if(GeneralConfig.enableExtendedLogging && !world.isRemote)
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized explosion at " + x + " / " + y + " / " + z + " with strength " + r + "!");
if(r == 0)
r = 25;
r *= 2;
EntityNukeExplosionMK5 mk4 = new EntityNukeExplosionMK5(world);
mk4.strength = (int)(r);
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
mk4.setPosition(x, y, z);
mk4.length = mk4.strength / 2;
return mk4;
}
public static EntityNukeExplosionMK5 statFacExperimental(World world, int r, double x, double y, double z) {
if(GeneralConfig.enableExtendedLogging && !world.isRemote)
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized eX explosion at " + x + " / " + y + " / " + z + " with strength " + r + "!");
r *= 2;
EntityNukeExplosionMK5 mk4 = new EntityNukeExplosionMK5(world);
mk4.strength = (int)(r);
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
mk4.setPosition(x, y, z);
mk4.length = mk4.strength / 2;
return mk4;
}
public static EntityNukeExplosionMK5 statFacNoRad(World world, int r, double x, double y, double z) {
System.out.println("STARTING");
if(GeneralConfig.enableExtendedLogging && !world.isRemote)
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized nR explosion at " + x + " / " + y + " / " + z + " with strength " + r + "!");
r *= 2;
EntityNukeExplosionMK5 mk4 = new EntityNukeExplosionMK5(world);
mk4.strength = (int)(r);
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
mk4.setPosition(x, y, z);
mk4.length = mk4.strength / 2;
mk4.fallout = false;
return mk4;
}
public EntityNukeExplosionMK5 moreFallout(int fallout) {
falloutAdd = fallout;
return this;
}
public EntityNukeExplosionMK5 mute() {
this.mute = true;
return this;
}
}

View File

@ -0,0 +1,228 @@
package com.hbm.explosion;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import com.hbm.util.fauxpointtwelve.BlockPos;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
public class ExplosionNukeRayBatched {
public HashMap<ChunkCoordIntPair, List<FloatTriplet>> perChunk = new HashMap(); //for future: optimize blockmap further by using sub-chunks instead of chunks
public List<ChunkCoordIntPair> orderedChunks = new ArrayList();
private CoordComparator comparator = new CoordComparator();
int posX;
int posY;
int posZ;
World world;
int strength;
int length;
int gspNumMax;
int gspNum;
double gspX;
double gspY;
public boolean isAusf3Complete = false;
public ExplosionNukeRayBatched(World world, int x, int y, int z, int strength, int count, int speed, int length) {
this.world = world;
this.posX = x;
this.posY = y;
this.posZ = z;
this.strength = strength;
this.length = length;
// Total number of points
this.gspNumMax = (int)(2.5 * Math.PI * Math.pow(this.strength,2));
this.gspNum = 1;
// The beginning of the generalized spiral points
this.gspX = Math.PI;
this.gspY = 0.0;
}
private void generateGspUp(){
if (this.gspNum < this.gspNumMax) {
int k = this.gspNum + 1;
double hk = -1.0 + 2.0 * (k - 1.0) / (this.gspNumMax - 1.0);
this.gspX = Math.acos(hk);
double prev_lon = this.gspY;
double lon = prev_lon + 3.6 / Math.sqrt(this.gspNumMax) / Math.sqrt(1.0 - hk * hk);
this.gspY = lon % (Math.PI * 2);
} else {
this.gspX = 0.0;
this.gspY = 0.0;
}
this.gspNum++;
}
// Get Cartesian coordinates for spherical coordinates
private Vec3 getSpherical2cartesian(){
double dx = Math.sin(this.gspX) * Math.cos(this.gspY);
double dz = Math.sin(this.gspX) * Math.sin(this.gspY);
double dy = Math.cos(this.gspX);
return Vec3.createVectorHelper(dx, dy, dz);
}
//currently used by mk4
public void collectTip(int count) {
int amountProcessed = 0;
while (this.gspNumMax >= this.gspNum){
// Get Cartesian coordinates for spherical coordinates
Vec3 vec = this.getSpherical2cartesian();
int length = (int)Math.ceil(strength);
float res = strength;
FloatTriplet lastPos = null;
HashSet<ChunkCoordIntPair> chunkCoords = new HashSet();
for(int i = 0; i < length; i ++) {
if(i > this.length)
break;
float x0 = (float) (posX + (vec.xCoord * i));
float y0 = (float) (posY + (vec.yCoord * i));
float z0 = (float) (posZ + (vec.zCoord * i));
double fac = 100 - ((double) i) / ((double) length) * 100;
fac *= 0.07D;
if(!world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid())
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 7.5D - fac);
else
res -= Math.pow(Blocks.air.getExplosionResistance(null), 7.5D - fac);
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
lastPos = new FloatTriplet(x0, y0, z0);
//all-air chunks don't need to be buffered at all
ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(((int) x0) >> 4, ((int) z0) >> 4);
chunkCoords.add(chunkPos);
}
if(res <= 0 || i + 1 >= this.length) {
break;
}
}
for(ChunkCoordIntPair pos : chunkCoords) {
List<FloatTriplet> triplets = perChunk.get(pos);
if(triplets == null) {
triplets = new ArrayList();
perChunk.put(pos, triplets); //we re-use the same pos instead of using individualized per-chunk ones to save on RAM
}
triplets.add(lastPos);
}
// Raise one generalized spiral points
this.generateGspUp();
amountProcessed++;
if(amountProcessed >= count) {
return;
}
}
orderedChunks.addAll(perChunk.keySet());
orderedChunks.sort(comparator);
isAusf3Complete = true;
}
public class CoordComparator implements Comparator<ChunkCoordIntPair> {
@Override
public int compare(ChunkCoordIntPair o1, ChunkCoordIntPair o2) {
int chunkX = ExplosionNukeRayBatched.this.posX >> 4;
int chunkZ = ExplosionNukeRayBatched.this.posZ >> 4;
int diff1 = Math.abs((chunkX - o1.chunkXPos)) + Math.abs((chunkZ - o1.chunkZPos));
int diff2 = Math.abs((chunkX - o2.chunkXPos)) + Math.abs((chunkZ - o2.chunkZPos));
return diff1 > diff2 ? 1 : diff1 < diff2 ? -1 : 0;
}
}
public void processChunk(int count) {
if(this.perChunk.isEmpty()) return;
ChunkCoordIntPair coord = orderedChunks.get(0);
List<FloatTriplet> list = perChunk.get(coord);
HashSet<BlockPos> toRem = new HashSet();
//List<BlockPos> toRem = new ArrayList();
int chunkX = coord.chunkXPos;
int chunkZ = coord.chunkZPos;
int enter = (int) (Math.min(
Math.abs(posX - (chunkX << 4)),
Math.abs(posZ - (chunkZ << 4)))) - 16; //jump ahead to cut back on NOPs
for(FloatTriplet triplet : list) {
float x = triplet.xCoord;
float y = triplet.yCoord;
float z = triplet.zCoord;
Vec3 vec = Vec3.createVectorHelper(x - this.posX, y - this.posY, z - this.posZ);
double pX = vec.xCoord / vec.lengthVector();
double pY = vec.yCoord / vec.lengthVector();
double pZ = vec.zCoord / vec.lengthVector();
boolean inChunk = false;
for(int i = enter; i < vec.lengthVector(); i++) {
int x0 = (int)(posX + pX * i);
int y0 = (int)(posY + pY * i);
int z0 = (int)(posZ + pZ * i);
if(x0 >> 4 != chunkX || z0 >> 4 != chunkZ) {
if(inChunk) {
break;
} else {
continue;
}
}
inChunk = true;
if(!world.isAirBlock(x0, y0, z0)) {
toRem.add(new BlockPos(x0, y0, z0));
}
}
}
for(BlockPos pos : toRem) {
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), Blocks.air);
}
perChunk.remove(coord);
orderedChunks.remove(0);
}
public class FloatTriplet {
public float xCoord;
public float yCoord;
public float zCoord;
public FloatTriplet(float x, float y, float z) {
xCoord = x;
yCoord = y;
zCoord = z;
}
}
}

View File

@ -33,10 +33,10 @@ public class GUIOilburner extends GuiInfoContainer {
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
this.drawCustomInfoStat(x, y, guiLeft + 116, guiTop + 17, 16, 52, x, y, new String[] { String.format("%,d", Math.min(diFurnace.heatEnergy, diFurnace.maxHeatEnergy)) + " / " + String.format("%,d", diFurnace.maxHeatEnergy) + "TU" });
this.drawCustomInfoStat(x, y, guiLeft + 116, guiTop + 17, 16, 52, x, y, new String[] { String.format("%,d", Math.min(diFurnace.heatEnergy, diFurnace.maxHeatEnergy)) + " / " + String.format("%,d", diFurnace.maxHeatEnergy) + " TU" });
if(diFurnace.tank.getTankType().hasTrait(FT_Flammable.class)) {
this.drawCustomInfoStat(x, y, guiLeft + 79, guiTop + 34, 18, 18, x, y, new String[] { "10mB/t", (int)(diFurnace.tank.getTankType().getTrait(FT_Flammable.class).getHeatEnergy() / 1000) * 10 + "TU/t" });
this.drawCustomInfoStat(x, y, guiLeft + 79, guiTop + 34, 18, 18, x, y, new String[] { diFurnace.setting + " mB/t", String.format("%,d", (int)(diFurnace.tank.getTankType().getTrait(FT_Flammable.class).getHeatEnergy() / 1000) * diFurnace.setting) + " TU/t" });
}
diFurnace.tank.renderTankInfo(this, x, y, guiLeft + 44, guiTop + 17, 16, 52);

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.effect.EntityNukeTorex;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.entity.logic.EntityTomBlast;
import com.hbm.entity.mob.siege.EntitySiegeTunneler;
import com.hbm.items.ModItems;
@ -14,15 +16,20 @@ import com.hbm.lib.Library;
import com.hbm.saveddata.TomSaveData;
import com.hbm.world.feature.OilSpot;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityTracker;
import net.minecraft.entity.EntityTrackerEntry;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IntHashMap;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.StructureBoundingBox;
@ -70,9 +77,18 @@ public class ItemWandD extends Item {
EntityNukeTorex torex = new EntityNukeTorex(world);
torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0);
//torex.getDataWatcher().updateObject(10, 2F);
torex.getDataWatcher().updateObject(10, 1.5F);
world.spawnEntityInWorld(torex);
EntityTracker entitytracker = ((WorldServer)world).getEntityTracker();
//ReflectionHelper.setPrivateValue(EntityTracker.class, entitytracker, 1000, "entityViewDistance");
IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c");
EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(torex.getEntityId());
entry.blocksDistanceThreshold = 1000;
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 150, pos.blockX, pos.blockY + 1, pos.blockZ));
/*EntitySiegeTunneler tunneler = new EntitySiegeTunneler(world);
tunneler.setPosition(pos.blockX, pos.blockY + 1, pos.blockZ);
tunneler.onSpawnWithEgg(null);

View File

@ -1,6 +1,5 @@
package com.hbm.tileentity.bomb;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.missile.EntityMissileCustom;
@ -22,8 +21,10 @@ import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEMissileMultipartPacket;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.item.IDesignatorItem;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
@ -40,7 +41,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityCompactLauncher extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IEnergyUser {
public class TileEntityCompactLauncher extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IEnergyUser, IFluidStandardReceiver {
private ItemStack slots[];
@ -182,7 +183,8 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I
solid += 250;
}
this.updateConnections();
if(worldObj.getTotalWorldTime() % 20 == 0)
this.updateConnections();
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, solid, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
@ -228,18 +230,29 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I
}
private void updateConnections() {
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord + 1, Library.POS_X);
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord - 1, Library.POS_X);
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord + 1, Library.NEG_X);
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord - 1, Library.NEG_X);
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 2, Library.POS_Z);
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 2, Library.POS_Z);
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z);
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z);
this.trySubscribe(worldObj, xCoord + 1, yCoord - 1, zCoord + 1, Library.NEG_Y);
this.trySubscribe(worldObj, xCoord + 1, yCoord - 1, zCoord - 1, Library.NEG_Y);
this.trySubscribe(worldObj, xCoord - 1, yCoord - 1, zCoord + 1, Library.NEG_Y);
this.trySubscribe(worldObj, xCoord - 1, yCoord - 1, zCoord - 1, Library.NEG_Y);
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X),
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord + 1, Library.NEG_X),
new DirPos(xCoord - 2, yCoord, zCoord - 1, Library.NEG_X),
new DirPos(xCoord + 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord - 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z),
new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z),
new DirPos(xCoord + 1, yCoord - 1, zCoord + 1, Library.NEG_Y),
new DirPos(xCoord + 1, yCoord - 1, zCoord - 1, Library.NEG_Y),
new DirPos(xCoord - 1, yCoord - 1, zCoord + 1, Library.NEG_Y),
new DirPos(xCoord - 1, yCoord - 1, zCoord - 1, Library.NEG_Y)
};
}
public boolean canLaunch() {
@ -589,4 +602,19 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I
public boolean canConnect(ForgeDirection dir) {
return dir != ForgeDirection.UP && dir != ForgeDirection.UNKNOWN;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UP && dir != ForgeDirection.UNKNOWN;
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public FluidTank[] getReceivingTanks() {
return tanks;
}
}

View File

@ -1,6 +1,5 @@
package com.hbm.tileentity.bomb;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.missile.EntityMissileCustom;
@ -24,6 +23,7 @@ import com.hbm.packet.TEMissileMultipartPacket;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.item.IDesignatorItem;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
@ -37,7 +37,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver {
private ItemStack slots[];
@ -231,6 +231,13 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
this.trySubscribe(worldObj, xCoord + i, yCoord, zCoord - 5, Library.NEG_Z);
this.trySubscribe(worldObj, xCoord + 5, yCoord, zCoord + i, Library.POS_X);
this.trySubscribe(worldObj, xCoord - 5, yCoord, zCoord + i, Library.NEG_X);
for(int j = 0; j < 2; j++) {
this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord + i, yCoord, zCoord + 5, Library.POS_Z);
this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord + i, yCoord, zCoord - 5, Library.NEG_Z);
this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord + 5, yCoord, zCoord + i, Library.POS_X);
this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord - 5, yCoord, zCoord + i, Library.NEG_X);
}
}
}
@ -568,4 +575,19 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
public boolean canConnect(ForgeDirection dir) {
return dir != ForgeDirection.UP && dir != ForgeDirection.DOWN && dir != ForgeDirection.UNKNOWN;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UP && dir != ForgeDirection.DOWN && dir != ForgeDirection.UNKNOWN;
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public FluidTank[] getReceivingTanks() {
return tanks;
}
}

View File

@ -26,6 +26,7 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
public boolean isOn = false;
public FluidTank tank;
public int setting = 1;
public int heatEnergy;
public static final int maxHeatEnergy = 100_000;
@ -55,7 +56,7 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
if(tank.getTankType().hasTrait(FT_Flammable.class)) {
FT_Flammable type = tank.getTankType().getTrait(FT_Flammable.class);
int burnRate = 10;
int burnRate = setting;
int toBurn = Math.min(burnRate, tank.getFill());
tank.setFill(tank.getFill() - toBurn);
@ -77,7 +78,8 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
NBTTagCompound data = new NBTTagCompound();
tank.writeToNBT(data, "tank");
data.setBoolean("isOn", isOn);
data.setInteger("heatEnergy", heatEnergy);
data.setInteger("h", heatEnergy);
data.setByte("s", (byte) this.setting);
this.networkPack(data, 25);
}
}
@ -86,7 +88,8 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
public void networkUnpack(NBTTagCompound nbt) {
tank.readFromNBT(nbt, "tank");
isOn = nbt.getBoolean("isOn");
heatEnergy = nbt.getInteger("heatEnergy");
heatEnergy = nbt.getInteger("h");
setting = nbt.getByte("s");
}
@Override
@ -104,6 +107,13 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
nbt.setBoolean("isOn", isOn);
nbt.setInteger("heatEnergy", heatEnergy);
}
public void toggleSetting() {
setting++;
if(setting > 10)
setting = 1;
}
@Override
public FluidTank[] getReceivingTanks() {

View File

@ -62,7 +62,7 @@ public class RBMKDials {
* @return >0
*/
public static double getPassiveCooling(World world) {
return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_PASSIVE_COOLING), 5.0D), 0.0D);
return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_PASSIVE_COOLING), 1.0D), 0.0D);
}
/**

View File

@ -79,7 +79,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
* @return
*/
public double passiveCooling() {
return RBMKDials.getPassiveCooling(worldObj); //default: 5.0D
return RBMKDials.getPassiveCooling(worldObj); //default: 1.0D
}
//necessary checks to figure out whether players are close enough to ensure that the reactor can be safely used

View File

@ -50,7 +50,7 @@ achievement.metalworks.desc=Bobmazon Level 1 (Hochofen)
achievement.metalworks=Metallurgie
achievement.nuclear.desc=Bobmazon Level 5 (Urankernbrennstoff)
achievement.nuclear=Atomwissenschaft
achievement.oil.desc=Bobmazon Level 4 (Elektrischer Boiler)
achievement.oil.desc=Bobmazon Level 4 (Elektrischer Ölwärmer)
achievement.oil=Petroleum
achievement.omega12.desc=Löse das Problem des Weiterlebens auf diesem elenden Planeten.
achievement.omega12=Omega-12 Teilchenbeschleuniger
@ -312,12 +312,12 @@ container.iGenerator=Industrieller Generator
container.keyForge=Schlossertisch
container.launchPad=Raketenabschussrampe
container.launchTable=Große Startrampe
container.machineBoiler=Dampfkessel
container.machineBoiler=Ölwärmer
container.machineCMB=CMB-Stahl Hochofen
container.machineCoal=Verbrennungsgenerator
container.machineCrucible=Schmelztiegel
container.machineDiesel=Dieselgenerator
container.machineElectricBoiler=Elektrischer Boiler
container.machineElectricBoiler=Elektrischer Ölwärmer
container.machineFEL=FEL
container.machineITER=Kernfusionsreaktor
container.machineLargeTurbine=Industrielle Dampfturbine
@ -3611,10 +3611,10 @@ tile.machine_battery.name=Energiespeicherblock
tile.machine_battery_potato.name=Kartoffelbatterieblock
tile.machine_boiler.name=Boiler
tile.machine_boiler.desc=Großer Boiler zum Verdampfen von Wasser oder$Erhitzen von Öl. Benötigt externe Hitzequelle.$Wärmestransferrate: ΔT*0.01 TU/t
tile.machine_boiler_electric_off.name=Elektrischer Boiler
tile.machine_boiler_electric_on.name=Elektrischer Boiler
tile.machine_boiler_off.name=Dampfkessel
tile.machine_boiler_on.name=Dampfkessel
tile.machine_boiler_electric_off.name=Elektrischer Ölwärmer
tile.machine_boiler_electric_on.name=Elektrischer Ölwärmer
tile.machine_boiler_off.name=Ölwärmer
tile.machine_boiler_on.name=Ölwärmer
tile.machine_catalytic_cracker.name=Katalytischer Cracking-Turm
tile.machine_centrifuge.name=Zentrifuge
tile.machine_chemfac.name=Chemiefabrik

View File

@ -590,12 +590,12 @@ container.iGenerator=Industrial Generator
container.keyForge=Locksmith Table
container.launchPad=Missile Launch Pad
container.launchTable=Large Launch Pad
container.machineBoiler=Boiler
container.machineBoiler=Oil Heater
container.machineCMB=CMB Steel Furnace
container.machineCoal=Combustion Generator
container.machineCrucible=Crucible
container.machineDiesel=Diesel Generator
container.machineElectricBoiler=Electric Boiler
container.machineElectricBoiler=Electric Oil Heater
container.machineFEL=FEL
container.machineITER=Fusion Reactor
container.machineLargeTurbine=Industrial Steam Turbine
@ -4139,10 +4139,10 @@ tile.machine_battery.name=Energy Storage Block
tile.machine_battery_potato.name=Potato Battery Block
tile.machine_boiler.name=Boiler
tile.machine_boiler.desc=Large boiler that can boil water or heat up oil.$Requires external heat source.$Heat transfer rate: ΔT*0.01 TU/t
tile.machine_boiler_electric_off.name=Electric Boiler
tile.machine_boiler_electric_on.name=Electric Boiler
tile.machine_boiler_off.name=Boiler
tile.machine_boiler_on.name=Boiler
tile.machine_boiler_electric_off.name=Electric Oil Heater
tile.machine_boiler_electric_on.name=Electric Oil Heater
tile.machine_boiler_off.name=Oil Heater
tile.machine_boiler_on.name=Oil Heater
tile.machine_catalytic_cracker.name=Catalytic Cracking Tower
tile.machine_centrifuge.name=Centrifuge
tile.machine_chemfac.name=Chemical Factory