Search in sources :

Example 41 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ConvenientAdditions by Necr0.

the class ItemSapBottle method getSubItems.

@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
    subItems.add(new ItemStack(itemIn));
    subItems.add(new ItemStack(itemIn, 1, 2));
}
Also used : ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 42 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project OpenModularTurrets by OpenModularTurretsTeam.

the class DisposableItemTurretRenderer method renderTileEntityAt.

@SuppressWarnings("ConstantConditions")
@Override
@SideOnly(Side.CLIENT)
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int destroyStage) {
    DisposableItemTurretTileEntity turretHead = (DisposableItemTurretTileEntity) te;
    int rotation;
    ResourceLocation textures = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/dispose_item_turret.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    if (te == null) {
        GL11.glScalef(0.7F, -0.7F, -0.7F);
        GL11.glTranslatef((float) x + 0.0F, (float) y + 0.4F, (float) z + 0.5F);
        GL11.glRotatef(45.0F, 2.5F, -4.5F, -1.0F);
        model.renderAll();
        GL11.glPopMatrix();
        return;
    }
    if (turretHead.shouldConceal) {
        GL11.glPopMatrix();
        return;
    }
    if (te.getWorld() != null) {
        rotation = te.getBlockMetadata();
        GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.0F, -1F, -1F);
        model.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
        model.Base.rotateAngleX = turretHead.baseFitRotationX;
        model.Base.rotateAngleY = turretHead.baseFitRotationZ;
        model.Pole.rotateAngleX = turretHead.baseFitRotationX;
        model.Pole.rotateAngleY = turretHead.baseFitRotationZ;
        model.BoxUnder.rotateAngleX = turretHead.baseFitRotationX;
    }
    model.renderAll();
    if (turretHead.getBase() != null) {
        if (TurretHeadUtil.hasSolarPanelAddon(turretHead.getBase())) {
            ResourceLocation texturesSolar = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_solar_panel.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesSolar);
            solar.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            solar.renderAll();
        }
        if (TurretHeadUtil.hasDamageAmpAddon(turretHead.getBase())) {
            ResourceLocation texturesAmp = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_damage_amp.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesAmp);
            amp.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            amp.renderAll();
        }
        if (TurretHeadUtil.hasRedstoneReactor(turretHead.getBase())) {
            ResourceLocation texturesReac = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_redstone_reactor.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesReac);
            reac.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            reac.renderAll();
        }
    }
    GL11.glPopMatrix();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) DisposableItemTurretTileEntity(omtteam.openmodularturrets.tileentity.turrets.DisposableItemTurretTileEntity) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 43 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project OpenModularTurrets by OpenModularTurretsTeam.

the class ModTESRItems method init.

@SuppressWarnings("ConstantConditions")
@SideOnly(Side.CLIENT)
public static void init() {
    if (ConfigHandler.getDisposableTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.disposableItemTurret), 0, DisposableItemTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.disposableItemTurret), 0, new ModelResourceLocation(ModBlocks.disposableItemTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getPotatoCannonTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.potatoCannonTurret), 0, PotatoCannonTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.potatoCannonTurret), 0, new ModelResourceLocation(ModBlocks.potatoCannonTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getGunTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.machineGunTurret), 0, GunTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.machineGunTurret), 0, new ModelResourceLocation(ModBlocks.machineGunTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getIncendiaryTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.incendiaryTurret), 0, IncendiaryTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.incendiaryTurret), 0, new ModelResourceLocation(ModBlocks.incendiaryTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getRelativisticTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.relativisticTurret), 0, RelativisticTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.relativisticTurret), 0, new ModelResourceLocation(ModBlocks.relativisticTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getGrenadeTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.grenadeLauncherTurret), 0, GrenadeLauncherTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.grenadeLauncherTurret), 0, new ModelResourceLocation(ModBlocks.grenadeLauncherTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getRocketTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.rocketTurret), 0, RocketTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.rocketTurret), 0, new ModelResourceLocation(ModBlocks.rocketTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getTeleporterTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teleporterTurret), 0, TeleporterTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.teleporterTurret), 0, new ModelResourceLocation(ModBlocks.teleporterTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getLaserTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.laserTurret), 0, LaserTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.laserTurret), 0, new ModelResourceLocation(ModBlocks.laserTurret.getRegistryName(), "inventory"));
    }
    if (ConfigHandler.getRailgunTurretSettings().isEnabled()) {
        ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.railGunTurret), 0, RailGunTurretTileEntity.class);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.railGunTurret), 0, new ModelResourceLocation(ModBlocks.railGunTurret.getRegistryName(), "inventory"));
    }
    ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.leverBlock), 0, LeverTileEntity.class);
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.leverBlock), 0, new ModelResourceLocation(ModBlocks.leverBlock.getRegistryName(), "inventory"));
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 44 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretHead method onDataPacket.

@Override
@SideOnly(Side.CLIENT)
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
    NBTTagCompound var1 = pkt.getNbtCompound();
    readFromNBT(var1);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 45 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project minecolonies by Minecolonies.

the class Pathfinding method debugDrawNode.

@SideOnly(Side.CLIENT)
private static void debugDrawNode(@NotNull final Node n, final float r, final float g, final float b) {
    GlStateManager.pushMatrix();
    GlStateManager.translate((double) n.pos.getX() + 0.375, (double) n.pos.getY() + 0.375, (double) n.pos.getZ() + 0.375);
    final Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
    final double dx = n.pos.getX() - entity.posX;
    final double dy = n.pos.getY() - entity.posY;
    final double dz = n.pos.getZ() - entity.posZ;
    if (Math.sqrt(dx * dx + dy * dy + dz * dz) <= 5D) {
        renderDebugText(n);
    }
    GlStateManager.scale(0.25D, 0.25D, 0.25D);
    final Tessellator tessellator = Tessellator.getInstance();
    final VertexBuffer vertexBuffer = tessellator.getBuffer();
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    GlStateManager.color(r, g, b);
    //  X+
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    //  X-
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    //  Z-
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    //  Z+
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    //  Y+
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    //  Y-
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    tessellator.draw();
    if (n.parent != null) {
        final double pdx = n.parent.pos.getX() - n.pos.getX() + 0.125;
        final double pdy = n.parent.pos.getY() - n.pos.getY() + 0.125;
        final double pdz = n.parent.pos.getZ() - n.pos.getZ() + 0.125;
        vertexBuffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
        vertexBuffer.pos(0.5D, 0.5D, 0.5D).color(0.75F, 0.75F, 0.75F, 1.0F).endVertex();
        vertexBuffer.pos(pdx / 0.25, pdy / 0.25, pdz / 0.25).color(0.75F, 0.75F, 0.75F, 1.0F).endVertex();
        tessellator.draw();
    }
    GlStateManager.popMatrix();
}
Also used : Entity(net.minecraft.entity.Entity) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)271 ItemStack (net.minecraft.item.ItemStack)47 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)44 ResourceLocation (net.minecraft.util.ResourceLocation)35 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)34 IBlockState (net.minecraft.block.state.IBlockState)28 Block (net.minecraft.block.Block)26 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)26 TileEntity (net.minecraft.tileentity.TileEntity)17 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 BlockPos (net.minecraft.util.math.BlockPos)12 Vec3d (net.minecraft.util.math.Vec3d)11 Tessellator (net.minecraft.client.renderer.Tessellator)10 EnumFacing (net.minecraft.util.EnumFacing)9 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)9 World (net.minecraft.world.World)9 Minecraft (net.minecraft.client.Minecraft)8 IOException (java.io.IOException)7 TextureManager (net.minecraft.client.renderer.texture.TextureManager)7 Item (net.minecraft.item.Item)7