use of net.minecraft.util.text.TextComponentString in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EventsCommon method onPlayerTickEvent.
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerTickEvent(PlayerTickEvent event) {
if (!event.player.worldObj.isRemote && event.player != null) {
EntityPlayerMP p = (EntityPlayerMP) event.player;
try {
if (!(p.connection instanceof CustomNetHandlerPlayServer)) {
p.connection = new CustomNetHandlerPlayServer(p.connection);
} else {
CustomNetHandlerPlayServer customNetHandler = (CustomNetHandlerPlayServer) p.connection;
if (p.interactionManager.getBlockReachDistance() == CustomNetHandlerPlayServer.dummyBlockReachDist && customNetHandler.ticksSinceLastTry == 2) {
p.interactionManager.setBlockReachDistance(((CustomNetHandlerPlayServer) p.connection).lastGoodBlockReachDist);
}
customNetHandler.ticksSinceLastTry++;
}
} catch (Exception e) {
e.printStackTrace();
}
Double[] pos = lastPositions.get(p);
if (pos == null) {
pos = new Double[3];
lastPositions.put(p, pos);
}
try {
if (pos[0] != p.posX || pos[2] != p.posZ) {
// Player has moved
if (Math.abs(p.posX) > 27000000 || Math.abs(p.posZ) > 27000000) {
// Player is outside of world border, tp them back
p.attemptTeleport(pos[0], pos[1], pos[2]);
p.addChatMessage(new TextComponentString("You can't go beyond 27000000 blocks because airships are stored there!"));
}
}
} catch (NullPointerException e) {
ValkyrienWarfareMod.VWLogger.log(Level.WARNING, "Nullpointer EventsCommon.java:onPlayerTickEvent");
}
pos[0] = p.posX;
pos[1] = p.posY;
pos[2] = p.posZ;
}
}
use of net.minecraft.util.text.TextComponentString in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EventsCommon method onRightClick.
@SubscribeEvent
public void onRightClick(PlayerInteractEvent.RightClickBlock event) {
if (!event.getWorld().isRemote) {
PhysicsWrapperEntity physObj = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(event.getWorld(), event.getPos());
if (physObj != null) {
//Bucket fix, probably not that important
if (event.getEntityPlayer().getHeldItem(event.getHand()) != null && event.getEntityPlayer().getHeldItem(event.getHand()).getItem() instanceof ItemBucket) {
event.setResult(Result.ALLOW);
event.setCanceled(false);
}
if (ValkyrienWarfareMod.runAirshipPermissions && !(physObj.wrapping.creator.equals(event.getEntityPlayer().entityUniqueID.toString()) || physObj.wrapping.allowedUsers.contains(event.getEntityPlayer().entityUniqueID.toString()))) {
event.getEntityPlayer().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;
}
}
}
}
use of net.minecraft.util.text.TextComponentString 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 net.minecraft.util.text.TextComponentString in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class TileEntityCannon method setAngle.
/////////////////////////////////////// End of making shit go boom
/////////////////////////////////////// Angle 'n' ammo
public void setAngle(EntityPlayer playerIn, double angle) {
Angle += angle;
if (Angle > 15F) {
Angle = -15F;
}
if (Angle < -15F) {
Angle = 15F;
}
playerIn.addChatComponentMessage(new TextComponentString("Extra Y velocity = " + Float.toString(Angle / 100)));
}
use of net.minecraft.util.text.TextComponentString in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class TileEntityCannon method fireCannon.
public void fireCannon(World worldIn, EntityPlayer playerIn, BlockPos pos, IBlockState state, EnumFacing side) {
if (CannonReady) {
firecannon(worldIn, pos, side, state);
CannonReady = false;
CannonCooldown = 0;
} else {
playerIn.addChatComponentMessage(new TextComponentString("Cannon needs to be loaded!"));
}
}
Aggregations