Search in sources :

Example 46 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class TextureArea method drawSubArea.

@SideOnly(Side.CLIENT)
public void drawSubArea(int x, int y, int width, int height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) {
    // sub area is just different width and height
    double imageU = this.offsetX * drawnU;
    double imageV = this.offsetY * drawnV;
    double imageWidth = this.imageWidth * drawnWidth;
    double imageHeight = this.imageHeight * drawnHeight;
    Minecraft.getMinecraft().renderEngine.bindTexture(imageLocation);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
    bufferbuilder.pos(x, y + height, 0.0D).tex(imageU, imageV + imageHeight).endVertex();
    bufferbuilder.pos(x + width, y + height, 0.0D).tex(imageU + imageWidth, imageV + imageHeight).endVertex();
    bufferbuilder.pos(x + width, y, 0.0D).tex(imageU + imageWidth, imageV).endVertex();
    bufferbuilder.pos(x, y, 0.0D).tex(imageU, imageV).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 47 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class ToolMetaItem method registerModels.

@Override
@SideOnly(Side.CLIENT)
public void registerModels() {
    for (T metaItem : this.metaItems.valueCollection()) {
        String name = metaItem.unlocalizedName;
        ModelBakery.registerItemVariants(this, new ResourceLocation(GTValues.MODID, "tools/" + name.substring(name.indexOf(".") + 1)));
    }
    ModelLoader.setCustomMeshDefinition(this, stack -> {
        if (stack.getMetadata() < this.metaItems.size()) {
            String name = getItem(stack).unlocalizedName;
            return new ModelResourceLocation(new ResourceLocation(GTValues.MODID, "tools/" + name.substring(name.indexOf(".") + 1)), "inventory");
        }
        return new ModelResourceLocation("builtin/missing", "missing");
    });
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 48 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class CustomDataTileHandler method onClientTick.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    if (event.phase != Phase.END)
        return;
    World clientWorld = Minecraft.getMinecraft().world;
    if (clientWorld == null)
        return;
    Iterator<BlockPos> keyIterator = pendingInitialSyncData.keySet().iterator();
    while (keyIterator.hasNext()) {
        BlockPos blockPos = keyIterator.next();
        TileEntity tileEntity = clientWorld.getTileEntity(blockPos);
        if (tileEntity instanceof ICustomDataTile) {
            pendingInitialSyncData.get(blockPos).forEach(((ICustomDataTile) tileEntity)::handleDataPacket);
            keyIterator.remove();
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ICustomDataTile(gregtech.api.capability.ICustomDataTile) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 49 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class NetworkHandler method onClientPacket.

@SubscribeEvent
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void onClientPacket(FMLNetworkEvent.ClientCustomPacketEvent event) {
    Packet packet = proxy2packet(event.getPacket());
    if (clientExecutors.containsKey(packet.getClass())) {
        PacketExecutor<Packet, NetHandlerPlayClient> executor = (PacketExecutor<Packet, NetHandlerPlayClient>) clientExecutors.get(packet.getClass());
        executor.execute(packet, (NetHandlerPlayClient) event.getHandler());
    }
}
Also used : FMLProxyPacket(net.minecraftforge.fml.common.network.internal.FMLProxyPacket) NetHandlerPlayClient(net.minecraft.client.network.NetHandlerPlayClient) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 50 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class OrientedOverlayRenderer method registerSprites.

@SideOnly(Side.CLIENT)
public void registerSprites(TextureMap textureMap) {
    this.sprites = new HashMap<>();
    for (OverlayFace overlayFace : faces) {
        String faceName = overlayFace.name().toLowerCase();
        ResourceLocation normalLocation = new ResourceLocation(GTValues.MODID, String.format("blocks/%s/overlay_%s", basePath, faceName));
        ResourceLocation activeLocation = new ResourceLocation(GTValues.MODID, String.format("blocks/%s/overlay_%s_active", basePath, faceName));
        TextureAtlasSprite normalSprite = textureMap.registerSprite(normalLocation);
        TextureAtlasSprite activeSprite = textureMap.registerSprite(activeLocation);
        sprites.put(overlayFace, new ActivePredicate(normalSprite, activeSprite));
    }
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ResourceLocation(net.minecraft.util.ResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1328 ItemStack (net.minecraft.item.ItemStack)238 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)149 IBlockState (net.minecraft.block.state.IBlockState)140 ResourceLocation (net.minecraft.util.ResourceLocation)139 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)127 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)126 BlockPos (net.minecraft.util.math.BlockPos)85 Block (net.minecraft.block.Block)82 TileEntity (net.minecraft.tileentity.TileEntity)80 EntityPlayer (net.minecraft.entity.player.EntityPlayer)72 Vec3d (net.minecraft.util.math.Vec3d)71 World (net.minecraft.world.World)69 EnumFacing (net.minecraft.util.EnumFacing)64 Minecraft (net.minecraft.client.Minecraft)62 ArrayList (java.util.ArrayList)50 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)42 Nonnull (javax.annotation.Nonnull)41 Entity (net.minecraft.entity.Entity)39 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)39