fixed depleted fuel disappearing out of the ZIRNOX and spent fuel pool

This commit is contained in:
Bob 2021-12-01 21:43:05 +01:00
parent 18d4d091e5
commit 9ba3dbb792
3 changed files with 19 additions and 35 deletions

View File

@ -1,22 +1,17 @@
package com.hbm.handler;
import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ModEventHandler;
import com.hbm.saveddata.TomSaveData;
import com.hbm.world.WorldProviderNTM;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockVine;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.EnumSkyBlock;
@ -39,8 +34,6 @@ public class ImpactWorldHandler {
WorldServer serv = (WorldServer) world;
ChunkProviderServer provider = (ChunkProviderServer) serv.getChunkProvider();
Random rand = new Random();
List<Chunk> list = serv.theChunkProviderServer.loadedChunks;
int listSize = list.size();
@ -56,9 +49,10 @@ public class ImpactWorldHandler {
int X = coord.getCenterXPos() - 8 + x;
int Z = coord.getCenterZPosition() - 8 + z;
int Y = world.getHeightValue(X, Z) - world.rand.nextInt(Math.max(1, world.getHeightValue(X, Z)));
int Y2 = world.getHeightValue(X, Z) - world.rand.nextInt(2);
die(world, X, Y, Z);
if(TomSaveData.dust > 0) {
die(world, X, Y, Z);
}
if(TomSaveData.fire > 0 || ModEventHandler.fire > 0) {
burn(world, X, Y, Z);
}
@ -73,21 +67,16 @@ public class ImpactWorldHandler {
int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - ModEventHandler.dust)));
if(world.getBlock(x, y, z) == Blocks.grass) {
if(light < 4)
if(light < 4) {
if(world.getBlock(x, y, z) == Blocks.grass) {
world.setBlock(x, y, z, Blocks.dirt);
} else if(world.getBlock(x, y, z) instanceof BlockBush) {
if(light < 4)
} else if(world.getBlock(x, y, z) instanceof BlockBush) {
world.setBlock(x, y, z, Blocks.air);
} else if(world.getBlock(x, y, z) instanceof BlockLeaves) {
if(light < 4)
} else if(world.getBlock(x, y, z) instanceof BlockLeaves) {
world.setBlock(x, y, z, Blocks.air);
} else if(world.getBlock(x, y, z) instanceof BlockVine) {
if(light < 4)
} else if(world.getBlock(x, y, z) instanceof BlockVine) {
world.setBlock(x, y, z, Blocks.air);
}
}
}

View File

@ -286,7 +286,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
ItemZirnoxRod.setLifeTime(slots[id], ItemZirnoxRod.getLifeTime(slots[id]) + 1);
if(ItemZirnoxRod.getLifeTime(slots[id]) > ((ItemZirnoxRod) slots[id].getItem()).lifeTime) {
slots[id] = fuelMap.get(new ComparableStack(getStackInSlot(id)));
slots[id] = fuelMap.get(new ComparableStack(getStackInSlot(id)).copy());
break;
}
}

View File

@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityWasteDrum extends TileEntity implements ISidedInventory {
@ -196,18 +197,11 @@ public class TileEntityWasteDrum extends TileEntity implements ISidedInventory {
int water = 0;
if(worldObj.getBlock(xCoord + 1, yCoord, zCoord) == Blocks.water || worldObj.getBlock(xCoord + 1, yCoord, zCoord) == Blocks.flowing_water)
water++;
if(worldObj.getBlock(xCoord - 1, yCoord, zCoord) == Blocks.water || worldObj.getBlock(xCoord - 1, yCoord, zCoord) == Blocks.flowing_water)
water++;
if(worldObj.getBlock(xCoord, yCoord + 1, zCoord) == Blocks.water || worldObj.getBlock(xCoord, yCoord + 1, zCoord) == Blocks.flowing_water)
water++;
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == Blocks.water || worldObj.getBlock(xCoord, yCoord - 1, zCoord) == Blocks.flowing_water)
water++;
if(worldObj.getBlock(xCoord, yCoord, zCoord + 1) == Blocks.water || worldObj.getBlock(xCoord, yCoord, zCoord + 1) == Blocks.flowing_water)
water++;
if(worldObj.getBlock(xCoord, yCoord, zCoord - 1) == Blocks.water || worldObj.getBlock(xCoord, yCoord, zCoord - 1) == Blocks.flowing_water)
water++;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if(worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) == Blocks.water || worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) == Blocks.flowing_water) {
water++;
}
}
if(water > 0) {
@ -225,8 +219,9 @@ public class TileEntityWasteDrum extends TileEntity implements ISidedInventory {
} else if(worldObj.rand.nextInt(r) == 0) {
if(wasteMap.keySet().contains(new ComparableStack(getStackInSlot(i)))) {
slots[i] = wasteMap.get(new ComparableStack(getStackInSlot(i)));
ComparableStack comp = new ComparableStack(getStackInSlot(i));
if(wasteMap.keySet().contains(comp)) {
slots[i] = wasteMap.get(comp).copy();
}
}
}