@Override public EnumActionResult onItemUse(EntityPlayer playerIn, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return ServerHelper.isClientWorld(world) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; }
@Override public void onLoad() { if (ServerHelper.isServerWorld(world)) { fakePlayer = new FakePlayerCore((WorldServer) world); } }
public void sendTilePacket(Side side) { if (world == null) { return; } if (side == Side.CLIENT && ServerHelper.isServerWorld(world)) { PacketHandler.sendToAllAround(getTilePacket(), this); } else if (side == Side.SERVER && ServerHelper.isClientWorld(world)) { PacketHandler.sendToServer(getTilePacket()); } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return ServerHelper.isClientWorld(world) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; }
@Override protected void preAugmentInstall() { super.preAugmentInstall(); if (world != null && ServerHelper.isServerWorld(world)) { flagNoWater = augmentNoWater; flagSedimentary = augmentSedimentary; } augmentNoWater = false; augmentSedimentary = false; }
public int getInternalLight() { if (ServerHelper.isClientWorld(world)) { return lightValue; } switch (mode) { case 0: return isPowered ? 15 : 0; case 1: return isPowered ? 0 : 15; case 2: return powerLevel; case 3: return 15 - powerLevel; case 5: return 15; } return 0; }
@SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase != TickEvent.Phase.END) { return; } synchronized (MULTI_BLOCKS_TO_CALCULATE) { if (!MULTI_BLOCKS_TO_CALCULATE.isEmpty()) { Iterator<WeakReference<ISingleTick>> iterator = MULTI_BLOCKS_TO_CALCULATE.iterator(); while (iterator.hasNext()) { ISingleTick multiBlock = iterator.next().get(); if (multiBlock == null) { iterator.remove(); } else if (multiBlock.world() != null) { if (ServerHelper.isServerWorld(multiBlock.world())) { getTickHandler(multiBlock.world()).tickingBlocks.add(multiBlock); } iterator.remove(); } } } } }
@Override public boolean setAccess(AccessMode access) { this.access = access; if (ServerHelper.isClientWorld(world)) { sendAccessPacket(); } return true; }
@Override public boolean openConfigGui(World world, BlockPos pos, EnumFacing side, EntityPlayer player) { TileNameable tile = (TileNameable) world.getTileEntity(pos); if (tile == null || tile.isInvalid()) { return false; } if (configGui && ServerHelper.isServerWorld(world)) { return tile.openConfigGui(player); } return configGui; }
@Override public final void setPowered(boolean isPowered) { wasPowered = this.isPowered; this.isPowered = isPowered; if (ServerHelper.isClientWorld(world)) { callBlockUpdate(); } }
@Override public void invalidate() { if (ServerHelper.isServerWorld(world)) { for (DuctUnit unit : getDuctUnits()) { unit.invalidate(); } } super.invalidate(); }
@Nullable protected Entity findEntityOnPath(Vec3d start, Vec3d end) { return ServerHelper.isClientWorld(world) ? null : super.findEntityOnPath(start, end); }
@Override public void onChunkUnload() { if (ServerHelper.isServerWorld(world)) { for (DuctUnit unit : getDuctUnits()) { unit.onChunkUnload(); } } super.onChunkUnload(); }
public boolean isLit() { return ServerHelper.isClientWorld(world()) || grid == null ? lit : grid.lit; }
public static void addMultiBlockToCalculate(ISingleTick multiBlock) { if (multiBlock.world() != null) { if (ServerHelper.isServerWorld(multiBlock.world())) { getTickHandler(multiBlock.world()).tickingBlocks.add(multiBlock); } } else { addMultiBlockToNextTickBatch(multiBlock); } }
public static WorldGridList getTickHandler(World world) { if (ServerHelper.isClientWorld(world)) { throw new IllegalStateException("World Grid called Client-side"); } synchronized (HANDLERS) { WorldGridList worldGridList = HANDLERS.get(world); if (worldGridList != null) { return worldGridList; } worldGridList = new WorldGridList(world); HANDLERS.put(world, worldGridList); return worldGridList; } }
/** * This function circumvents a miserable failing. */ public static void sendItemUsePacket(World world, BlockPos pos, EnumFacing hitSide, EnumHand hand, float hitX, float hitY, float hitZ) { if (isServerWorld(world)) { return; } NetHandlerPlayClient netClientHandler = (NetHandlerPlayClient) FMLClientHandler.instance().getClientPlayHandler(); netClientHandler.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, hitSide, hand, hitX, hitY, hitZ)); }
@Override public void onLoad() { if (ServerHelper.isClientWorld(world) && !hasClientUpdate()) { world.tickableTileEntities.remove(this); } validate(); }
public void onPlacedBy(EntityLivingBase living, ItemStack stack) { for (DuctUnit ductUnit : getDuctUnits()) { ductUnit.onPlaced(living, stack); } if (ServerHelper.isServerWorld(world)) { for (DuctUnit ductUnit : getDuctUnits()) { TickHandler.addMultiBlockToCalculate(ductUnit); } } }
@Override public void onLivingUpdate() { if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } if (ServerHelper.isClientWorld(world)) { // if (this.rand.nextInt(SOUND_AMBIENT_FREQUENCY) == 0) { // this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, soundAmbient, this.rand.nextFloat() * 0.2F + 0.1F, // this.rand.nextFloat() * 0.3F + 0.4F); // } for (int i = 0; i < 2; i++) { this.world.spawnParticle(ambientParticle, this.posX + (this.rand.nextDouble() - 0.5D) * this.width, this.posY + this.rand.nextDouble() * this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * this.width, 0.0D, 0.0D, 0.0D); } } super.onLivingUpdate(); }