net.minecraftforge.fml.relauncher.Side Java Examples
The following examples show how to use
net.minecraftforge.fml.relauncher.Side.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContainerSeedStorageBase.java From AgriCraft with MIT License | 6 votes |
/** * Tries to move an item stack form the correct tile entity to the player's inventory */ public void moveStackFromTileEntityToPlayer(int slotId, ItemStack stack) { ISeedStorageControllable controllable = this.getControllable(stack).orElse(null); if (controllable == null) { return; } ItemStack stackToMove = controllable.getStackForSlotId(slotId); if (stack.isEmpty()) { return; } if (stackToMove.isEmpty()) { return; } stackToMove.setCount(stack.getCount() > stackToMove.getCount() ? stackToMove.getCount() : stack.getCount()); stackToMove.setTagCompound(controllable.getStackForSlotId(slotId).getTagCompound()); if (this.mergeItemStack(stackToMove, 0, PLAYER_INVENTORY_SIZE, false)) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { //this method is only called form the gui client side, so we need to manually tell the server to execute it there new MessageContainerSeedStorage(stack, slotId).sendToServer(); } else { //on the server decrease the size of the stack, where it is synced to the client controllable.decreaseStackSizeInSlot(slotId, stack.getCount() - stackToMove.getCount()); } } }
Example #2
Source File: ENBlocks.java From ExNihiloAdscensio with MIT License | 6 votes |
@SideOnly(Side.CLIENT) public static void initModels() { dust.initModel(); netherrackCrushed.initModel(); endstoneCrushed.initModel(); barrelWood.initModel(); barrelStone.initModel(); sieve.initModel(); crucible.initModel(); infestedLeaves.initModel(); fluidWitchwater.initModel(); }
Example #3
Source File: NetworkHandler.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) private static void initClient() { registerClientExecutor(PacketUIOpen.class, (packet, handler) -> { UIFactory<?> uiFactory = UIFactory.FACTORY_REGISTRY.getObjectById(packet.uiFactoryId); if (uiFactory == null) { GTLog.logger.warn("Couldn't find UI Factory with id '{}'", packet.uiFactoryId); } else { uiFactory.initClientUI(packet.serializedHolder, packet.windowId, packet.initialWidgetUpdates); } }); registerClientExecutor(PacketUIWidgetUpdate.class, (packet, handler) -> { GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen; if(currentScreen instanceof ModularUIGui) { ((ModularUIGui) currentScreen).handleWidgetUpdate(packet); } }); registerClientExecutor(PacketBlockParticle.class, (packet, handler) -> { World world = Minecraft.getMinecraft().world; IBlockState blockState = world.getBlockState(packet.blockPos); ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer; ((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, packet.blockPos, particleManager, packet.entityPos, packet.particlesAmount); }); }
Example #4
Source File: TileRailgun.java From AdvancedRocketry with MIT License | 6 votes |
@Override public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt) { if(side.isClient()) { if(id == 3) { EnumFacing dir = RotatableBlock.getFront(world.getBlockState(pos)); LibVulpes.proxy.playSound(world, pos, AudioRegistry.railgunFire, SoundCategory.BLOCKS, Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.BLOCKS), 0.975f + world.rand.nextFloat()*0.05f); recoil = world.getTotalWorldTime(); } } else if(id == 4) { minStackTransferSize = nbt.getInteger("minTransferSize"); } else if(id == 5) { state = RedstoneState.values()[nbt.getByte("state")]; } else super.useNetworkData(player, side, id, nbt); }
Example #5
Source File: ItemFairyBell.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public static void onScroll(MouseEvent event) { EntityPlayer player = Minecraft.getMinecraft().player; if (player == null) return; if (Keyboard.isCreated() && event.getDwheel() != 0) { for (EnumHand hand : EnumHand.values()) { ItemStack stack = player.getHeldItem(hand); if (stack.getItem() != ModItems.FAIRY_BELL) continue; IMiscCapability cap = MiscCapabilityProvider.getCap(Minecraft.getMinecraft().player); if (cap == null) continue; cap.setSelectedFairy(null); PacketHandler.NETWORK.sendToServer(new PacketUpdateMiscCapToServer(cap.serializeNBT())); } } }
Example #6
Source File: BlockElectricMushroom.java From AdvancedRocketry with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World world, BlockPos pos, Random rand) { super.randomDisplayTick(stateIn, world, pos, rand); if(world.getTotalWorldTime() % 100 == 0 && world.getBiome(pos) == AdvancedRocketryBiomes.stormLandsBiome) { FxSystemElectricArc.spawnArc(world, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, .3, 7); world.playSound(Minecraft.getMinecraft().player, pos, AudioRegistry.electricShockSmall, SoundCategory.BLOCKS, .7f, 0.975f + world.rand.nextFloat()*0.05f); } }
Example #7
Source File: GenericItem.java From mobycraft with Apache License 2.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (!this.getUnlocalizedName().equals("container_wand")) { return; } tooltip.add(EnumChatFormatting.DARK_RED + "Right click on a container's \"Name:\" sign to remove the container."); }
Example #8
Source File: HudHandler.java From Cyberware with MIT License | 5 votes |
@SideOnly(Side.CLIENT) @SubscribeEvent public void addHudElements(CyberwareHudEvent event) { if (event.isHudjackAvailable()) { event.addElement(pd); event.addElement(mpd); event.addElement(nd); } }
Example #9
Source File: BlockCrystal.java From AdvancedRocketry with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess world, BlockPos pos, EnumFacing side) { EnumFacing dir = side;//side.getOpposite(); IBlockState blockState2 = world.getBlockState(pos.offset(dir)); return blockState.equals(blockState2) ? false : super.shouldSideBeRendered(blockState, world, pos, side); }
Example #10
Source File: ItemGeneric.java From OpenModsLib with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) { if (isInCreativeTab(tab)) { for (Entry<Integer, IMetaItem> entry : metaitems.entrySet()) entry.getValue().addToCreativeList(this, entry.getKey(), subItems); } }
Example #11
Source File: PacketNemezReversal.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void handle(@Nonnull MessageContext ctx) { ClientRunnable.run(new ClientRunnable() { @Override @SideOnly(Side.CLIENT) public void runIfClient() { NemezTracker tracker = NemezEventHandler.getCurrent(); tracker.absorb(nemez.getTagList("root", Constants.NBT.TAG_COMPOUND)); } }); }
Example #12
Source File: MetaTileEntity.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
/** * Renders this meta tile entity * Note that you shouldn't refer to world-related information in this method, because it * will be called on ItemStacks too * * @param renderState render state (either chunk batched or item) * @param pipeline default set of pipeline transformations */ @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { TextureAtlasSprite atlasSprite = TextureUtils.getMissingSprite(); IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); for (EnumFacing face : EnumFacing.VALUES) { Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite); } }
Example #13
Source File: EntityElevatorCapsule.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt) { if(id == PACKET_WRITE_DST_INFO && world.isRemote) { if(nbt.hasKey("dimid")) { dstTilePos = new DimensionBlockPosition(nbt.getInteger("dimid"), new HashedBlockPosition(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z"))); } else dstTilePos = null; } else if(id == PACKET_WRITE_SRC_INFO && world.isRemote) { if(nbt.hasKey("dimid")) { srcTilePos = new DimensionBlockPosition(nbt.getInteger("dimid"), new HashedBlockPosition(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z"))); } else srcTilePos = null; } else if(id == PACKET_RECIEVE_NBT) { PacketHandler.sendToPlayersTrackingEntity(new PacketEntity(this, PACKET_WRITE_DST_INFO), this); } else if(id == PACKET_LAUNCH_EVENT && world.isRemote) { List<EntityPlayer> list = world.getEntitiesWithinAABB(EntityPlayer.class, getEntityBoundingBox()); for(Entity ent : list) { if(this.getRidingEntity() == null) ent.startRiding(this); } MinecraftForge.EVENT_BUS.post(new RocketEvent.RocketLaunchEvent(this)); } else if(id == PACKET_DEORBIT && world.isRemote) { MinecraftForge.EVENT_BUS.post(new RocketEvent.RocketDeOrbitingEvent(this)); } }
Example #14
Source File: InventoryBPortableBarrel.java From BetterChests with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public Gui getGui(EntityPlayer player, short id) { switch (id) { case 1: return new GuiUpgrades(new ContainerUpgrades(this, player)); default: return new GuiBarrel(new ContainerBarrel(this, player)); } }
Example #15
Source File: ForgeHax.java From ForgeHax with MIT License | 5 votes |
@Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { if (event.getSide() == Side.CLIENT) { // ---- initialize mods ----// getModManager().loadAll(); } }
Example #16
Source File: ItemTofuForceCore.java From TofuCraftReload with MIT License | 5 votes |
public ItemTofuForceCore() { super(); this.setMaxStackSize(1); this.setMaxDamage(360); this.setUnlocalizedName(TofuMain.MODID + "." + "tofuforce_core"); this.addPropertyOverride(new ResourceLocation("broken"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { return isUsable(stack) ? 0.0F : 1.0F; } }); }
Example #17
Source File: MaterialMetaItem.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) protected int getColorForItemStack(ItemStack stack, int tintIndex) { if (tintIndex == 0 && stack.getMetadata() < metaItemOffset) { Material material = Material.MATERIAL_REGISTRY.getObjectById(stack.getMetadata() % 1000); if (material == null) return 0xFFFFFF; return material.materialRGB; } return super.getColorForItemStack(stack, tintIndex); }
Example #18
Source File: TileEntityRegistry.java From Sakura_mod with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public static void render() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCampfire.class, new RenderTileEntityCampfire()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStoneMortar.class, new RenderTileEntityStoneMortar()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCampfirePot.class, new RenderTileEntityCampfirePot()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMapleCauldron.class, new RenderTileEntityMapleCauldron()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShoji.class, new ShojiRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOben.class, new RenderTileEntityOben()); getItem(BlockLoader.STONEMORTAR).setTileEntityItemStackRenderer(new TileEntityRenderHelper()); }
Example #19
Source File: BlockFirepit.java From TFC2 with GNU General Public License v3.0 | 5 votes |
/******************************************************************************* * 2. Rendering *******************************************************************************/ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { TileFirepit te = (TileFirepit)world.getTileEntity(pos); if(te.getField(TileFirepit.FIELD_FUEL_TIMER) > 0) { double x = rand.nextDouble() * 0.7; double z = rand.nextDouble() * 0.7; world.spawnParticle(EnumParticleTypes.FLAME, pos.getX()+0.15+x, pos.getY()+0.4, pos.getZ()+0.15+z, 0, 0.0, 0); world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX()+0.15+x, pos.getY()+0.4, pos.getZ()+0.15+z, 0, 0.02, 0); } }
Example #20
Source File: EntityLivingHandler.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void handleFOV(FOVUpdateEvent event) { EntityPlayer player = event.getEntity(); // Calculate FOV based on the variable draw speed of the bow depending on player armor. //Removed on port /*if (player.isUsingItem() && player.getItemInUse().getItem() instanceof ItemCustomBow) { float fov = 1.0F; int duration = player.getItemInUseDuration(); float speed = ItemCustomBow.getUseSpeed(player); float force = duration / speed; if (force > 1.0F) { force = 1.0F; } else { force *= force; } fov *= 1.0F - force * 0.15F; event.newfov = fov; }*/ }
Example #21
Source File: Widget.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) protected static List<String> getItemToolTip(ItemStack itemStack) { Minecraft mc = Minecraft.getMinecraft(); ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; List<String> tooltip = itemStack.getTooltip(mc.player, flag); for (int i = 0; i < tooltip.size(); ++i) { if (i == 0) { tooltip.set(i, itemStack.getItem().getForgeRarity(itemStack).getColor() + tooltip.get(i)); } else { tooltip.set(i, TextFormatting.GRAY + tooltip.get(i)); } } return tooltip; }
Example #22
Source File: BlockCarpet.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockState state, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { if (side == EnumFacing.UP) { return true; } else { return blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? true : super.shouldSideBeRendered(state, blockAccess, pos, side); } }
Example #23
Source File: DrinksLoader.java From Sakura_mod with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public static void registerRender() { ItemRegister.registerRender(tea); ItemRegister.registerRender(alcoholic); ItemRegister.registerRender(cocktail); ItemRegister.registerRender(bottle_alcoholic); }
Example #24
Source File: ItemBuggysMeat.java From Sakura_mod with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (flagIn.isAdvanced()) { tooltip.add("Meat that bagu_chan seems to like UwU"); tooltip.add("But Syameimaru doesn't OmO"); } }
Example #25
Source File: EntityDireSlime.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override @SideOnly(Side.CLIENT) public int getBrightnessForRender() { int i = MathHelper.floor(this.posX); int j = MathHelper.floor(this.posZ); if (!world.isAirBlock(new BlockPos(i, 0, j))) { double d0 = (getEntityBoundingBox().maxY - getEntityBoundingBox().minY) * 0.66D; int k = MathHelper.floor(this.posY - getYOffset()+ d0); return world.getCombinedLight(new BlockPos( i, k, j), 0); } else { return 0; } }
Example #26
Source File: GTBlockBaseOre.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) @Override public TextureAtlasSprite getLayerTexture(IBlockState state, EnumFacing facing, int layer) { if (layer == 0) { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(this.background.getBackground()); } return this.getTopLayer(); }
Example #27
Source File: ItemSpaceArmor.java From AdvancedRocketry with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { if(armorSlot == EntityEquipmentSlot.CHEST) { for(ItemStack stack : getComponents(itemStack)) { if(stack.getItem() instanceof IJetPack) return new RenderJetPack(_default); } } return super.getArmorModel(entityLiving, itemStack, armorSlot, _default); }
Example #28
Source File: ModuleEffectBurn.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Vec3d position = spell.getTarget(world); if (position == null) return; Color color = instance.getPrimaryColor(); if (RandUtil.nextBoolean()) color = instance.getSecondaryColor(); LibParticles.EFFECT_BURN(world, position, color); }
Example #29
Source File: JsonPlant.java From AgriCraft with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public List<BakedQuad> getPlantQuads(IExtendedBlockState state, int growthStage, EnumFacing direction, Function<ResourceLocation, TextureAtlasSprite> textureToIcon) { //The quads returned from this method are added to the tessellator, // however the plant renderer directly adds them to the tessellator, so an empty list is returned if (textureToIcon instanceof ITessellator) { PlantRenderer.renderPlant((ITessellator) textureToIcon, this, growthStage); } return Collections.emptyList(); }
Example #30
Source File: PacketInvalidLocationNotify.java From AdvancedRocketry with MIT License | 5 votes |
@Override @SideOnly(Side.CLIENT) public void executeClient(EntityPlayer thePlayer) { FxErrorBlock fx3 = new FxErrorBlock(thePlayer.world, toPos.x, toPos.y, toPos.z ); Minecraft.getMinecraft().effectRenderer.addEffect(fx3); }