use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EventsCommon method onBlockBreak.
@SubscribeEvent
public void onBlockBreak(BlockEvent.BreakEvent event) {
if (!event.getWorld().isRemote) {
PhysicsWrapperEntity physObj = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(event.getWorld(), event.getPos());
if (physObj != null) {
if (ValkyrienWarfareMod.runAirshipPermissions && !(physObj.wrapping.creator.equals(event.getPlayer().entityUniqueID.toString()) || physObj.wrapping.allowedUsers.contains(event.getPlayer().entityUniqueID.toString()))) {
event.getPlayer().addChatMessage(new TextComponentString("You need to be added to the airship to do that!" + (physObj.wrapping.creator == null || physObj.wrapping.creator.trim().isEmpty() ? " Try using \"/airshipSettings claim\"!" : "")));
event.setCanceled(true);
return;
}
if (physObj.wrapping.shipType == ShipType.Oribtal) {
//Do not let it break
}
}
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CustomNetHandlerPlayServer method processUpdateSign.
@Override
public void processUpdateSign(CPacketUpdateSign packetIn) {
BlockPos packetPos = packetIn.getPosition();
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(playerEntity.worldObj, packetPos);
if (playerEntity.interactionManager.getBlockReachDistance() != dummyBlockReachDist) {
lastGoodBlockReachDist = playerEntity.interactionManager.getBlockReachDistance();
}
if (wrapper != null) {
playerEntity.interactionManager.setBlockReachDistance(dummyBlockReachDist);
ticksSinceLastTry = 0;
}
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (wrapper != null && wrapper.wrapping.coordTransform != null) {
float playerYaw = playerEntity.rotationYaw;
float playerPitch = playerEntity.rotationPitch;
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.wToLTransform, wrapper.wrapping.coordTransform.wToLRotation, playerEntity);
super.processUpdateSign(packetIn);
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.lToWTransform, wrapper.wrapping.coordTransform.lToWRotation, playerEntity);
playerEntity.rotationYaw = playerYaw;
playerEntity.rotationPitch = playerPitch;
} else {
super.processUpdateSign(packetIn);
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CustomNetHandlerPlayServer method processRightClickBlock.
@Override
public void processRightClickBlock(CPacketPlayerTryUseItemOnBlock packetIn) {
BlockPos packetPos = packetIn.getPos();
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(playerEntity.worldObj, packetPos);
if (playerEntity.interactionManager.getBlockReachDistance() != dummyBlockReachDist) {
lastGoodBlockReachDist = playerEntity.interactionManager.getBlockReachDistance();
}
if (wrapper != null) {
playerEntity.interactionManager.setBlockReachDistance(dummyBlockReachDist);
ticksSinceLastTry = 0;
}
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (wrapper != null && wrapper.wrapping.coordTransform != null) {
float playerYaw = playerEntity.rotationYaw;
float playerPitch = playerEntity.rotationPitch;
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.wToLTransform, wrapper.wrapping.coordTransform.wToLRotation, playerEntity);
if (playerEntity.getHeldItem(packetIn.getHand()) != null && playerEntity.getHeldItem(packetIn.getHand()).getItem() instanceof ItemBucket) {
playerEntity.interactionManager.setBlockReachDistance(lastGoodBlockReachDist);
}
try {
super.processRightClickBlock(packetIn);
} catch (Exception e) {
}
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.lToWTransform, wrapper.wrapping.coordTransform.lToWRotation, playerEntity);
playerEntity.rotationYaw = playerYaw;
playerEntity.rotationPitch = playerPitch;
} else {
super.processRightClickBlock(packetIn);
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ValkyrienWarfareWorldEventListener method sendBlockBreakProgress.
@Override
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {
if (!worldObj.isRemote) {
for (EntityPlayer entityplayermp : worldObj.playerEntities) {
if (entityplayermp != null && entityplayermp.getEntityId() != breakerId) {
Vector posVector = new Vector(pos.getX(), pos.getY(), pos.getZ());
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldObj, pos);
if (wrapper != null) {
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.lToWTransform, posVector);
}
double d0 = posVector.X - entityplayermp.posX;
double d1 = posVector.Y - entityplayermp.posY;
double d2 = posVector.Z - entityplayermp.posZ;
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
((EntityPlayerMP) entityplayermp).connection.sendPacket(new SPacketBlockBreakAnim(breakerId, pos, progress));
}
}
}
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BalloonBurnerTileEntity method getBlockForcePosition.
public Vector getBlockForcePosition(World world, BlockPos pos, IBlockState state, Entity shipEntity, double secondsToApply) {
if (balloon == null) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) shipEntity;
balloon = wrapper.wrapping.balloonManager.getProcessorAbovePos(pos);
}
if (balloon != null) {
return balloon.currentBalloonCenter;
}
return null;
}
Aggregations