@Override @SideOnly(Side.CLIENT) public void readSpawnData(ByteBuf additionalData) { playerCount = additionalData.readInt(); hardMode = additionalData.readBoolean(); source = BlockPos.fromLong(additionalData.readLong()); long msb = additionalData.readLong(); long lsb = additionalData.readLong(); bossInfoUUID = new UUID(msb, lsb); Minecraft.getMinecraft().getSoundHandler().playSound(new DopplegangerMusic(this)); }
protected void tickClient(ItemStack stack, EntityPlayer player) { if(!Botania.proxy.isTheClientPlayer(player)) return; NBTTagList blocks = ItemNBTHelper.getList(stack, TAG_BLOCK_POSITIONS, Constants.NBT.TAG_LONG, false); Botania.proxy.setWispFXDepthTest(false); for(int i = 0; i < blocks.tagCount(); i++) { BlockPos pos = BlockPos.fromLong(((NBTTagLong) blocks.get(i)).getLong()); float m = 0.02F; Botania.proxy.wispFX(pos.getX() + (float) Math.random(), pos.getY() + (float) Math.random(), pos.getZ() + (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5)); } int[] entities = ItemNBTHelper.getIntArray(stack, TAG_ENTITY_POSITIONS); for(int i : entities) { Entity e = player.world.getEntityByID(i); if(e != null && Math.random() < 0.6) { Botania.proxy.setWispFXDepthTest(Math.random() < 0.6); Botania.proxy.wispFX(e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.height, e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), -0.05F - 0.03F * (float) Math.random()); } } Botania.proxy.setWispFXDepthTest(true); }
@Override public void fromBytes(ByteBuf buf) { // Encoding the position as a long is more efficient blockPos = BlockPos.fromLong(buf.readLong()); }
@Override public void fromBytes(ByteBuf buffer) { int size = buffer.readInt(); coords = new ArrayList<BlockPos>(size); for (int i = 0; i < size; i++) { coords.add(BlockPos.fromLong(buffer.readLong())); } }
@Override public void open(EntityPlayer player, String data) { JsonParser parser = new JsonParser(); JsonObject root = parser.parse(data).getAsJsonObject(); BlockPos pos = BlockPos.fromLong(root.get(BLOCK_POS).getAsLong()); JsonElement quest = root.get(QUEST); UUID questId = quest.isJsonNull() ? null : UUID.fromString(root.getAsString()); int radius = root.get(RADIUS).getAsInt(); TrackerType type = TrackerType.values()[root.get(TYPE).getAsInt()]; TileEntityTracker.openInterface(player, pos, questId, radius, type); } },
@Override protected void readFromStream(ByteBuf data) { this.type = CommandType.values()[data.readInt()]; blockTarget = data.readBoolean(); if (blockTarget) { pos = BlockPos.fromLong(data.readLong()); } else { entityID = data.readInt(); } }
@Override public void readSpawnData(ByteBuf data) { setPositions(BlockPos.fromLong(data.readLong()), BlockPos.fromLong(data.readLong())); this.gateType = Gate.getGateByID(data.readInt()); this.edgePosition = data.readFloat(); this.edgeMax = data.readFloat(); this.gateStatus = data.readByte(); this.gateOrientation = EnumFacing.VALUES[data.readByte()]; this.health = data.readInt(); gateType.updateRenderBoundingBox(this); }
@Override public IMessage onMessage(PacketLegacyPowerStorage message, MessageContext ctx) { EntityPlayer player = Minecraft.getMinecraft().player; TileEntity te = player.world.getTileEntity(BlockPos.fromLong(message.pos)); if (te instanceof ILegacyPoweredTile) { ILegacyPoweredTile me = (ILegacyPoweredTile) te; me.setEnergyStored(message.storedEnergy); } return null; }
public void readFromNBT(NBTTagCompound tag) { position = BlockPos.fromLong(tag.getLong("pos")); delay = tag.getInteger("delay"); shouldUpkeep = tag.getBoolean("upkeep"); }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); if (tag.hasKey(CONTROLLER_POSITION_TAG)) { controllerPosition = BlockPos.fromLong(tag.getLong(CONTROLLER_POSITION_TAG)); } }
public void deserializeProgressData(NBTTagCompound tag) { currentPriority = tag.getInteger(CURRENT_PRIORITY_TAG); curTempPos = MathUtils.fromLong(tag.getLong("pos")); clearPos = BlockPos.fromLong(tag.getLong(CLEAR_POS_TAG)); hasClearedArea = tag.getBoolean(CLEARED_TAG); destination = BlockPos.fromLong(tag.getLong(DESTINATION_TAG)); } }
public static ITarget deserializeFromNBT(NBTTagCompound tag) { if (tag.hasKey("targetPos")) { return new BlockPosTarget(BlockPos.fromLong(tag.getLong("targetPos"))); } return NONE; }
@Override public IMessage onMessage(PacketOpenAuthGui message, MessageContext ctx) { IModObject mo = ModObjectRegistry.getModObject(ctx.getServerHandler().player.world.getBlockState(BlockPos.fromLong(message.pos)).getBlock()); if (mo != null) { mo.openGui(ctx.getServerHandler().player.world, BlockPos.fromLong(message.pos), ctx.getServerHandler().player, null, GUI_ID_TRAVEL_AUTH); } return null; }
@Override default IMessage networkExec(int id, GuiPacket message) { if (id == ID_DO_TELEPORT) { return doTeleport(BlockPos.fromLong(message.getLong(2)), message.getInt(0), message.getBoolean(1)); } return null; }
@Override public IMessage onMessage(PacketTravelEvent message, MessageContext ctx) { Entity toTp = ctx.getServerHandler().player; TravelSource source = NullHelper.notnullJ(TravelSource.values()[message.source], "Enum.values()"); EnumHand hand = NullHelper.notnullJ(EnumHand.values()[message.hand], "Enum.values()"); doServerTeleport(toTp, BlockPos.fromLong(message.pos), message.powerUse, message.conserveMotion, source, hand); return null; }
@Override public boolean isPositionInTransformerRange(long position, Position2D blockPos) { BlockPos pos = BlockPos.fromLong(position); int range = getRange(position); if (isCircular(position)) { double distance = Math.round(blockPos.getDistance(pos)); return range > 0.0F && distance <= range; } return MathHelper.abs(blockPos.getX() - pos.getX()) <= range && MathHelper.abs(blockPos.getZ() - pos.getZ()) <= range; }
public final void readFromNBT(NBTTagCompound tag) { type = CommandType.values()[tag.getInteger("type")]; blockTarget = tag.getBoolean("block"); pos = BlockPos.fromLong(tag.getLong("pos")); if (tag.hasKey("idmsb") && tag.hasKey("idlsb")) { entityUUID = new UUID(tag.getLong("idmsb"), tag.getLong("idlsb")); } entityID = tag.getInteger("entityid"); }