Gregtech++ [GT++] [GTplusplus]

Gregtech++ [GT++] [GTplusplus]

94.1k Downloads

Player safe is setting resistance/hardness for all GT meta tile entity blocks

richardhendricks opened this issue ยท 0 comments

commented

Issue Title

Player safe incorrectly applies hardness/unbreakable to all GT meta tile entity blocks. GT 1.7.04.483

Expected Behavior

Locking safe should only apply hardness/unbreakableness to safe blocks, not unrelated meta tile entities.

Current Behavior

When a safe is locked, hardness of all GT machines server-wide goes to -1 and blast resistance to infinity. This might take a few seconds to propagate, so once a safe is locked wait while looking at a GT machine.
Unlocking a safe sets the hardness to 2.0 and blast resistance to 2.0

Steps to Reproduce (for bugs)

Run single player game, spawn in any GT machine and player safe. Open safe GUI and lock it.
Look at GT machine, wait a minute, it will update in WAILA.

Relevant code in GregtechMetaSafeBlockBase::onPostTick:
`
if (this.bUnbreakable == true){
//Xasda.setmTileEntity((BaseMetaTileEntity) aBaseMetaTileEntity);
//Utils.LOG_ERROR("Safe is Indestructible.");
this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setResistance(Float.MAX_VALUE);
this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setBlockUnbreakable();
}
else {
//Xasda.setmTileEntity((BaseMetaTileEntity) aBaseMetaTileEntity);
//Utils.LOG_ERROR("Safe is not Indestructible.");
this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setResistance(1F);
this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setHardness(2);

			}

`
Since all GT machines are the same "block", all their hardness and resistance are set.

Instead of setting these, instead the safe will need to intercept the usual events and block them that way.

Misc Info

Check all that apply ([ ] -> [x] - use a lowercase x)

  •    Using GT:NH/GT:New Horizons?
  •    Single Player?
  •    Multi Player?