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

The following examples show how to use net.minecraftforge.fml.relauncher.Side#CLIENT . 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: BlockSakuraLeave.java    From Sakura_mod with 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 File: GTGuiCompBuffer.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 3
Source File: GTGuiCompAESU.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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
Source File: TileAnvil.java    From TFC2 with 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 5
Source File: GTGuiCompTypeFilter.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 6
Source File: ModBlocks.java    From YouTubeModdingTutorial with 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 7
Source File: CyberwareAPI.java    From Cyberware with 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 8
Source File: ModuleEffectFrost.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 9
Source File: MessagePlayerCivilizationSetInCiv.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
@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 10
Source File: GTBlockBaseOre.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getParticleTexture(IBlockState state) {
	return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(this.background.getBackground());
}
 
Example 11
Source File: RecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@ZenGetter("localizedName")
public String getLocalizedName() {
    return I18n.format("recipemap." + unlocalizedName + ".name");
}
 
Example 12
Source File: Widget.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * 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 13
Source File: WorldProviderTorikki.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public double getVoidFogYFactor() {
	return 1.0;
}
 
Example 14
Source File: AdvancedRocketry.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void registerModels(ModelRegistryEvent event) {
	proxy.preInitItems();
	proxy.preInitBlocks();
}
 
Example 15
Source File: ItemResource.java    From ExNihiloAdscensio with 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 16
Source File: GTGuiCompTypeFilter.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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 17
Source File: PipeChassisMkI.java    From Logistics-Pipes-2 with 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 18
Source File: BlockAncientDevice.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public Block.EnumOffsetType getOffsetType()
{
	return Block.EnumOffsetType.NONE;
}
 
Example 19
Source File: BlockBambooLantern.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
    return BlockRenderLayer.CUTOUT_MIPPED;
}
 
Example 20
Source File: BlockTofuPortal.java    From TofuCraftReload with 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;

}