oop forgot to push this

This commit is contained in:
Boblet 2023-12-19 08:02:11 +01:00
parent c6d43a6215
commit 65412f0c89
4 changed files with 70 additions and 1 deletions

View File

@ -43,6 +43,8 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
public int reputation;
public boolean isOnLadder = false;
public HbmPlayerProps(EntityPlayer player) {
this.player = player;
}
@ -153,13 +155,14 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
public void saveNBTData(NBTTagCompound nbt) {
NBTTagCompound props = new NBTTagCompound();
props.setBoolean("hasReceivedBook", hasReceivedBook);
props.setFloat("shield", shield);
props.setFloat("maxShield", maxShield);
props.setBoolean("enableBackpack", enableBackpack);
props.setBoolean("enableHUD", enableHUD);
props.setInteger("reputation", reputation);
props.setBoolean("isOnLadder", isOnLadder);
nbt.setTag("HbmPlayerProps", props);
}
@ -176,6 +179,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
this.enableBackpack = props.getBoolean("enableBackpack");
this.enableHUD = props.getBoolean("enableHUD");
this.reputation = props.getInteger("reputation");
this.isOnLadder = props.getBoolean("isOnLadder");
}
}
}

View File

@ -102,6 +102,51 @@ public class EntityEffectHandler {
handleDashing(entity);
handlePlinking(entity);
if(entity instanceof EntityPlayer) handleFauxLadder((EntityPlayer) entity);
}
private static void handleFauxLadder(EntityPlayer player) {
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(props.isOnLadder) {
float f5 = 0.15F;
if(player.motionX < (double) (-f5)) {
player.motionX = (double) (-f5);
}
if(player.motionX > (double) f5) {
player.motionX = (double) f5;
}
if(player.motionZ < (double) (-f5)) {
player.motionZ = (double) (-f5);
}
if(player.motionZ > (double) f5) {
player.motionZ = (double) f5;
}
player.fallDistance = 0.0F;
if(player.motionY < -0.15D) {
player.motionY = -0.15D;
}
if(player.isSneaking() && player.motionY < 0.0D) {
player.motionY = 0.0D;
}
if(player.isCollidedHorizontally) {
player.motionY = 0.2D;
}
props.isOnLadder = false;
if(!player.worldObj.isRemote) ArmorUtil.resetFlightTime(player);
}
}
private static void handleContamination(EntityLivingBase entity) {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerCrystallizer;
import com.hbm.inventory.fluid.Fluids;
@ -111,6 +112,15 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
}
}
}
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 6.875, zCoord + 1).offset(dir.offsetX * 0.75 + rot.offsetX * 1.25, 0, dir.offsetZ * 0.75 + rot.offsetZ * 1.25));
for(EntityPlayer player : players) {
HbmPlayerProps props = HbmPlayerProps.getData(player);
props.isOnLadder = true;
}
}
private void updateConnections() {

View File

@ -4,6 +4,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
@ -168,6 +169,15 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
this.tank.writeToNBT(data, "t");
this.networkPack(data, 150);
}
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2.875, zCoord + 1).offset(dir.offsetX * 0.5 - rot.offsetX * 2.25, 0, dir.offsetZ * 0.5 - rot.offsetZ * 2.25));
for(EntityPlayer player : players) {
HbmPlayerProps props = HbmPlayerProps.getData(player);
props.isOnLadder = true;
}
}
/** called when the tank breaks due to hazardous materials or external force, can be used to quickly void part of the tank or spawn a mushroom cloud */