Java Code Examples for net.minecraftforge.fml.relauncher.Side#CLIENT

The following examples show how to use net.minecraftforge.fml.relauncher.Side#CLIENT . These examples are extracted from open source projects. 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 Project: Sakura_mod   File: BlockSakuraLeave.java    License: MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
	Blocks.LEAVES.randomDisplayTick(stateIn, worldIn, pos, rand);
    if (rand.nextInt(40) == 0) {
        int j = rand.nextInt(2) * 2 - 1;
        int k = rand.nextInt(2) * 2 - 1;

        double d0 = pos.getX() + 0.5D + 0.25D * j;
        double d1 = pos.getY() - 0.15D;
        double d2 = pos.getZ() + 0.5D + 0.25D * k;
        double d3 = rand.nextFloat() * j * 0.1D;
        double d4 = (rand.nextFloat() * 0.055D) + 0.015D;
        double d5 = rand.nextFloat() * k * 0.1D;

        SakuraMain.proxy.spawnParticle(SakuraParticleType.LEAVESSAKURA, d0, d1, d2, d3, -d4, d5);
    }
}
 
Example 2
Source Project: TFC2   File: TileAnvil.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public static PropertyItem.PItem getAnvilItem(ItemStack stack, World world, EntityLivingBase entity, float x, float z) {
	if(stack == null)
		return null;

	IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, entity);
	if(model == null || model.isBuiltInRenderer()) {
		// missing model so people don't go paranoid when their chests go missing
		model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getMissingModel();
	}

	PropertyItem.PItem item = new PropertyItem.PItem(model, x,0,z, 0.5f, (float) (Math.PI/2));
	if(stack.getItem() instanceof ItemBlock) {
		item.y = -0.3125f;
		item.s = 0.375f;
		item.r = 0;
	}
	return item;
}
 
Example 3
@Override
@SideOnly(Side.CLIENT)
public void onButtonClick(GuiIC2 gui, GuiButton button) {
	if (button.id == 4) {
		this.block.getNetwork().initiateClientTileEntityEvent(this.block, 4);
	}
	if (button.id == 3) {
		this.block.getNetwork().initiateClientTileEntityEvent(this.block, 3);
	}
	if (button.id == 2) {
		this.block.getNetwork().initiateClientTileEntityEvent(this.block, 2);
	}
	if (button.id == 1) {
		this.block.getNetwork().initiateClientTileEntityEvent(this.block, 1);
	}
}
 
Example 4
@Override
@SideOnly(Side.CLIENT)
public void onToolTipCollecting(GuiIC2 gui, int mouseX, int mouseY, List<String> tooltips) {
	if (this.isMouseOver(mouseX, mouseY)) {
		if (mouseX < 25) {
			tooltips.add(I18n.format(GTLang.BUTTON_BUFFER_ENERGY));
		}
		if (this.tile.hasRedstone) {
			if (GTHelperMath.within(mouseX, 25, 42)) {
				tooltips.add(I18n.format(GTLang.BUTTON_BUFFER_REDSTONE));
			}
			if (GTHelperMath.within(mouseX, 43, 60)) {
				tooltips.add(I18n.format(GTLang.BUTTON_BUFFER_INVREDSTONE));
			}
		}
		if (this.tile.hasInvertFilter && GTHelperMath.within(mouseX, 61, 78)) {
			tooltips.add(I18n.format(GTLang.BUTTON_BUFFER_INVFILTER));
		}
		if (this.tile.hasNbtFilter && GTHelperMath.within(mouseX, 79, 96)) {
			tooltips.add(I18n.format(GTLang.BUTTON_BUFFER_IGNORENBT));
		}
	}
}
 
Example 5
Source Project: YouTubeModdingTutorial   File: ModBlocks.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public static void initModels() {
    blockFastFurnace.initModel();
    blockGenerator.initModel();
    blockFancyOre.initModel();
    blockPuzzle.initModel();
    blockFload.initModel();
    blockTank.initModel();
    blockFloader.initModel();
    blockSuperchest.initModel();
    blockSuperchestPart.initModel();
}
 
Example 6
@Override
public IMessage onMessage(final MessagePlayerCivilizationSetInCiv message, MessageContext ctx) {
	if (ctx.side != Side.CLIENT) {
		return null;
	}

	Minecraft.getMinecraft().addScheduledTask(new Runnable() {
		@Override
		public void run() {
			new Worker().work(message);
		}
	});

	return null;
}
 
Example 7
@Override
@SideOnly(Side.CLIENT)
public void onToolTipCollecting(GuiIC2 gui, int mouseX, int mouseY, List<String> tooltips) {
	super.onToolTipCollecting(gui, mouseX, mouseY, tooltips);
	if (GTHelperMath.within(mouseX, 34, 52) && GTHelperMath.within(mouseY, 20, 40)) {
		tooltips.add(I18n.format("Current Filter: " + this.filterTile.getCurrentFilter() + " ("
				+ this.filterTile.getCurrentIndex() + "/" + (GTTileTypeFilter.getFilterListSize() - 1) + ")"));
	}
}
 
Example 8
Source Project: Cyberware   File: CyberwareAPI.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public static int getHUDColorHex()
{
	EntityPlayer p = Minecraft.getMinecraft().thePlayer;
	if (CyberwareAPI.hasCapability(p))
	{
		return CyberwareAPI.getCapability(p).getHudColorHex();
	}
	return 0;
}
 
Example 9
@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;

	ParticleBuilder glitter = new ParticleBuilder(1);
	glitter.setAlphaFunction(new InterpFloatInOut(0.0f, 0.1f));
	glitter.setRender(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SPARKLE_BLURRED));
	glitter.enableMotionCalculation();
	glitter.setScaleFunction(new InterpScale(1, 0));
	glitter.setAcceleration(new Vec3d(0, -0.02, 0));
	glitter.setCollision(true);
	glitter.setCanBounce(true);
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(5, 15), 0, (aFloat, particleBuilder) -> {
		double radius = 2;
		double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
		double r = radius * RandUtil.nextFloat();
		double x = r * MathHelper.cos((float) theta);
		double z = r * MathHelper.sin((float) theta);
		glitter.setScale(RandUtil.nextFloat());
		glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-2, 2), z));
		glitter.setLifetime(RandUtil.nextInt(50, 100));
		Vec3d direction = position.add(glitter.getPositionOffset()).subtract(position).normalize().scale(1 / 5);
		glitter.addMotion(direction.scale(RandUtil.nextDouble(0.5, 1)));
	});

}
 
Example 10
Source Project: Sakura_mod   File: BlockBambooLantern.java    License: MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
    return BlockRenderLayer.CUTOUT_MIPPED;
}
 
Example 11
Source Project: ExNihiloAdscensio   File: ItemResource.java    License: MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list) {
	for (int i = 1; i < names.size(); i++)
		list.add(new ItemStack(this, 1, i));
}
 
Example 12
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getParticleTexture(IBlockState state) {
	return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(this.background.getBackground());
}
 
Example 13
@SideOnly(Side.CLIENT)
@ZenGetter("localizedName")
public String getLocalizedName() {
    return I18n.format("recipemap." + unlocalizedName + ".name");
}
 
Example 14
/**
 * Called when mouse is pressed and hold down in GUI
 */
@SideOnly(Side.CLIENT)
public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged) {
    return false;
}
 
Example 15
@SideOnly(Side.CLIENT)
@Override
public double getVoidFogYFactor() {
	return 1.0;
}
 
Example 16
Source Project: AdvancedRocketry   File: AdvancedRocketry.java    License: MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void registerModels(ModelRegistryEvent event) {
	proxy.preInitItems();
	proxy.preInitBlocks();
}
 
Example 17
@Override
@SideOnly(Side.CLIENT)
public void onGuiInit(GuiIC2 gui) {
	super.onGuiInit(gui);
	gui.registerButton(new GTGuiButton(5, bX(gui, 34), bY(gui, 20), 18, 20));
}
 
Example 18
Source Project: Logistics-Pipes-2   File: PipeChassisMkI.java    License: MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
	
}
 
Example 19
@Override
@SideOnly(Side.CLIENT)
public Block.EnumOffsetType getOffsetType()
{
	return Block.EnumOffsetType.NONE;
}
 
Example 20
Source Project: TofuCraftReload   File: BlockTofuPortal.java    License: MIT License 2 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {

    pos = pos.offset(side);

    EnumFacing.Axis enumfacing$axis = null;

    if (blockState.getBlock() == this) {

        enumfacing$axis = blockState.getValue(AXIS);

        if (enumfacing$axis == null) {

            return false;

        }

        if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST) {

            return false;

        }

        if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH) {

            return false;

        }

    }

    boolean flag = blockAccess.getBlockState(pos.west()).getBlock() == this &&

            blockAccess.getBlockState(pos.west(2)).getBlock() != this;

    boolean flag1 = blockAccess.getBlockState(pos.east()).getBlock() == this &&

            blockAccess.getBlockState(pos.east(2)).getBlock() != this;

    boolean flag2 = blockAccess.getBlockState(pos.north()).getBlock() == this &&

            blockAccess.getBlockState(pos.north(2)).getBlock() != this;

    boolean flag3 = blockAccess.getBlockState(pos.south()).getBlock() == this &&

            blockAccess.getBlockState(pos.south(2)).getBlock() != this;

    boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X;

    boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z;


    return flag4 && side == EnumFacing.WEST || flag4 && side == EnumFacing.EAST ||

            flag5 && side == EnumFacing.NORTH || flag5 && side == EnumFacing.SOUTH;

}