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();
}
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");
});
}
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();
}
}
}
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());
}
}
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));
}
}
Aggregations