@Override public void onLoad() { if (ServerHelper.isServerWorld(world)) { fakePlayer = new FakePlayerCore((WorldServer) world); } }
@Override protected void preAugmentInstall() { super.preAugmentInstall(); if (world != null && ServerHelper.isServerWorld(world)) { flagNoWater = augmentNoWater; flagSedimentary = augmentSedimentary; } augmentNoWater = false; augmentSedimentary = false; }
@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 void invalidate() { if (ServerHelper.isServerWorld(world)) { for (DuctUnit unit : getDuctUnits()) { unit.invalidate(); } } super.invalidate(); }
@Override public void onChunkUnload() { if (ServerHelper.isServerWorld(world)) { for (DuctUnit unit : getDuctUnits()) { unit.onChunkUnload(); } } super.onChunkUnload(); }
public static void addMultiBlockToCalculate(ISingleTick multiBlock) { if (multiBlock.world() != null) { if (ServerHelper.isServerWorld(multiBlock.world())) { getTickHandler(multiBlock.world()).tickingBlocks.add(multiBlock); } } else { addMultiBlockToNextTickBatch(multiBlock); } }
/** * 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)); }
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 ItemStack decrStackSize(int slot, int amount) { ItemStack stack = super.decrStackSize(slot, amount); if (ServerHelper.isServerWorld(world) && slot == 1) { if (isActive && (inventory[slot].isEmpty() || !hasValidInput())) { processOff(); hasFluidHandler = false; } } return stack; }
@Override protected void postAugmentInstall() { if (augmentThrottle) { energyConfig.minPower = 0; } energyStorage.setCapacity(energyConfig.maxEnergy).setMaxTransfer(energyConfig.maxPower * 4); if (world != null && ServerHelper.isServerWorld(world) && renderCoil != getCoil()) { sendTilePacket(Side.CLIENT); } }
@Override public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = super.decrStackSize(slot, amount); if (ServerHelper.isServerWorld(world) && slot == 1) { if (isActive && (inventory[slot].isEmpty() || !hasValidInput())) { processOff(); containerItem = null; hasContainerItem = false; handler = null; hasEnergyHandler = false; hasRepairItem = false; } } return stack; }
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 ItemStack decrStackSize(int slot, int amount) { ItemStack stack = super.decrStackSize(slot, amount); if (ServerHelper.isServerWorld(world) && slot <= getMaxInputSlot()) { if (isActive && (inventory[slot].isEmpty() || !hasValidInput())) { processOff(); } } return stack; }
@Override public void onPlaced(EntityLivingBase living, ItemStack stack) { super.onPlaced(living, stack); if (ServerHelper.isServerWorld(world())) { lit = world().isBlockPowered(pos()); } }
@Override public boolean openGui(EntityPlayer player) { if (ServerHelper.isServerWorld(baseTile.world())) { player.openGui(ThermalDynamics.instance, GuiHandler.TILE_ATTACHMENT_ID + side, baseTile.getWorld(), baseTile.x(), baseTile.y(), baseTile.z()); } return true; }
private boolean growBlock(World world, BlockPos pos, IBlockState state) { if (state.getBlock() instanceof IGrowable) { IGrowable growable = (IGrowable) state.getBlock(); if (growable.canGrow(world, pos, state, world.isRemote)) { if (ServerHelper.isServerWorld(world)) { if (growable.canUseBonemeal(world, world.rand, pos, state)) { growable.grow(world, world.rand, pos, state); world.playEvent(2005, pos, 0); } } return true; } } return false; }
@Override public void setInventorySlotContents(int slot, ItemStack stack) { if (ServerHelper.isServerWorld(world) && slot <= getMaxInputSlot()) { if (isActive && !inventory[slot].isEmpty()) { if (stack.isEmpty() || !stack.isItemEqual(inventory[slot]) || !hasValidInput()) { processOff(); } } } super.setInventorySlotContents(slot, stack); }
@Override public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { ItemStack stack = player.getHeldItemMainhand(); if (!enableBreakFluid || player.capabilities.isCreativeMode || willHarvest && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0) { return world.setBlockState(pos, net.minecraft.init.Blocks.AIR.getDefaultState(), 3); } if (ServerHelper.isServerWorld(world)) { this.onBlockHarvested(world, pos, state, player); } return world.setBlockState(new BlockPos(pos), fluidBlocks[state.getValue(VARIANT).getMetadata()].getDefaultState().withProperty(BlockFluidCore.LEVEL, 1), 3); }
@Override public boolean openGui(EntityPlayer player) { if (canPlayerAccess(player)) { if (hasGui()) { player.openGui(getMod(), GuiHandler.TILE_ID, world, pos.getX(), pos.getY(), pos.getZ()); } return hasGui(); } if (ServerHelper.isServerWorld(world)) { player.sendMessage(new TextComponentTranslation("chat.cofh.secure.warning", getOwnerName())); } return hasGui(); }
@Override public boolean openConfigGui(EntityPlayer player) { if (canPlayerAccess(player)) { if (hasConfigGui()) { player.openGui(getMod(), GuiHandler.TILE_CONFIG_ID, world, pos.getX(), pos.getY(), pos.getZ()); } return hasConfigGui(); } if (ServerHelper.isServerWorld(world)) { player.sendMessage(new TextComponentTranslation("chat.cofh.secure.warning", getOwnerName())); } return hasConfigGui(); }