Fixes o'plenty, nearing completion

This commit is contained in:
Vaern 2023-05-16 19:58:15 -07:00
parent 5f27a78bcb
commit d871e46b9f
4 changed files with 29 additions and 12 deletions

View File

@ -16,6 +16,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -179,7 +180,7 @@ public class PistonInserter extends BlockContainerBase {
@SideOnly(Side.CLIENT) public double renderExtend; @SideOnly(Side.CLIENT) public double renderExtend;
@SideOnly(Side.CLIENT) public double lastExtend; @SideOnly(Side.CLIENT) public double lastExtend;
@SideOnly(Side.CLIENT) private int syncExtend; //what are these for? @SideOnly(Side.CLIENT) private int syncExtend; //what are these for?
@SideOnly(Side.CLIENT) private int turnProgress; //idk man, i can't find the convo bob had about them @SideOnly(Side.CLIENT) private int turnProgress;
public TileEntityPistonInserter() { } public TileEntityPistonInserter() { }
@ -271,7 +272,7 @@ public class PistonInserter extends BlockContainerBase {
this.extend = nbt.getInteger("extend"); this.extend = nbt.getInteger("extend");
this.isRetracting = nbt.getBoolean("retract"); this.isRetracting = nbt.getBoolean("retract");
this.lastState = nbt.getBoolean("state"); this.lastState = nbt.getBoolean("state");
if(nbt.hasKey("stack")) { //TODO double check that these work if(nbt.hasKey("stack")) {
NBTTagCompound stack = nbt.getCompoundTag("stack"); NBTTagCompound stack = nbt.getCompoundTag("stack");
this.slot = ItemStack.loadItemStackFromNBT(stack); this.slot = ItemStack.loadItemStackFromNBT(stack);
} else { } else {
@ -279,7 +280,19 @@ public class PistonInserter extends BlockContainerBase {
} }
} }
//TODO: render AABB that extends out in direction of piston so it will render @SideOnly(Side.CLIENT)
private AxisAlignedBB aabb;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(aabb != null)
return aabb;
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).addCoord(dir.offsetX, dir.offsetY, dir.offsetZ);
return aabb;
}
/* BS inventory stuff */ /* BS inventory stuff */

View File

@ -201,13 +201,15 @@ public abstract class BlockGraphiteDrilledBase extends BlockFlammable implements
newTag.setInteger("z", te.zCoord + dir.offsetZ); newTag.setInteger("z", te.zCoord + dir.offsetZ);
} }
world.setBlock(ix, iy, iz, oldBlock, (oldMeta & ~0b100) | (newMeta & 0b100), 2); world.setBlock(ix, iy, iz, oldBlock, (oldMeta & ~0b100) | (newMeta & 0b100), 0);
if(oldBlock instanceof BlockGraphiteDrilledTE && !oldTag.hasNoTags()) { //safety first if(oldBlock instanceof BlockGraphiteDrilledTE && !oldTag.hasNoTags()) { //safety first
TileEntity te = world.getTileEntity(ix, iy, iz); TileEntity te = world.getTileEntity(ix, iy, iz);
te.readFromNBT(oldTag); te.readFromNBT(oldTag);
} }
world.markAndNotifyBlock(ix, iy, iz, world.getChunkFromBlockCoords(ix, iz), newBlock, oldBlock, 3); //in case setBlock returns false due to = meta / block
oldMeta = newMeta; oldMeta = newMeta;
oldBlock = newBlock; oldBlock = newBlock;
oldTag = newTag; oldTag = newTag;

View File

@ -24,8 +24,12 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BlockGraphiteFuel extends BlockGraphiteDrilledTE implements IToolable, IBlowable { public class BlockGraphiteFuel extends BlockGraphiteDrilledTE implements IToolable, IBlowable {
@Override @Override
public TileEntity createNewTileEntity(World world, int mets) { public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityPileFuel(); TileEntityPileFuel pile = new TileEntityPileFuel();
if((meta & 8) != 0)
pile.progress = pile.maxProgress - 1000; // pu239 rods cringe :(
return pile;
} }
@Override @Override
@ -41,7 +45,7 @@ public class BlockGraphiteFuel extends BlockGraphiteDrilledTE implements IToolab
} }
@Override @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int side) { //serverside? maybe public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
TileEntityPileFuel pile = (TileEntityPileFuel)world.getTileEntity(x, y, z); TileEntityPileFuel pile = (TileEntityPileFuel)world.getTileEntity(x, y, z);
return MathHelper.clamp_int((pile.progress * 16) / pile.maxProgress, 0, 15); //potentially wip return MathHelper.clamp_int((pile.progress * 16) / pile.maxProgress, 0, 15); //potentially wip
} }

View File

@ -18,7 +18,7 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
public int neutrons; public int neutrons;
public int lastNeutrons; public int lastNeutrons;
public int progress; public int progress;
public static final int maxProgress = GeneralConfig.enable528 ? 75000 : 50000; public static final int maxProgress = GeneralConfig.enable528 ? 75000 : 50000; //might double to reduce compact setup's effectiveness
@Override @Override
public void updateEntity() { public void updateEntity() {
@ -79,10 +79,8 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
private void checkRedstone(int lastProgress) { private void checkRedstone(int lastProgress) {
int lastLevel = MathHelper.clamp_int((lastProgress * 16) / maxProgress, 0, 15); int lastLevel = MathHelper.clamp_int((lastProgress * 16) / maxProgress, 0, 15);
int newLevel = MathHelper.clamp_int((progress * 16) / maxProgress, 0, 15); int newLevel = MathHelper.clamp_int((progress * 16) / maxProgress, 0, 15);
if(lastLevel != newLevel) //TODO TEST if(lastLevel != newLevel)
System.out.println(lastLevel + ", " + newLevel + "; " + lastProgress + ", " + progress); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, this.getBlockType());
if(lastLevel != newLevel) //the block update doesn't seem to update the comparators... need to troubleshoot and fix
worldObj.scheduleBlockUpdate(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1); //TODO test
} }
private void transmute() { private void transmute() {