codechicken.core.ClientUtils Java Examples
The following examples show how to use
codechicken.core.ClientUtils.
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: EnderStorageClientProxy.java From EnderStorage with MIT License | 6 votes |
@Override public void init() { if(config.getTag("checkUpdates").getBooleanValue(true)) CCUpdateChecker.updateCheck("EnderStorage"); ClientUtils.enhanceSupportersList("EnderStorage"); super.init(); PacketCustom.assignHandler(EnderStorageCPH.channel, new EnderStorageCPH()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(blockEnderChest), new ItemEnderStorageRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnderChest.class, new EnderChestRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnderTank.class, new EnderTankRenderer()); }
Example #2
Source File: RenderTracker.java From WirelessRedstone with MIT License | 6 votes |
public void renderTracker(int freq) { GL11.glDisable(GL11.GL_LIGHTING); TextureUtils.bindAtlas(0); CCRenderState.reset(); CCRenderState.startDrawing(7); CCRenderState.setColour(0xFFFFFFFF); model.render(new IconTransformation(Blocks.obsidian.getIcon(0, 0))); CCRenderState.draw(); Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(0, 0.44+RedstoneEther.getSineWave(ClientUtils.getRenderTime(), 7)*0.02, 0), new Rotation(RedstoneEther.getRotation(ClientUtils.getRenderTime(), freq), new Vector3(0, 1, 0)), 0.04); CCRenderState.changeTexture("wrcbe_core:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCRenderState.setColour(freq == 0 ? 0xC0C0C0FF : 0xFFFFFFFF); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example #3
Source File: TranslocatorClientProxy.java From Translocators with MIT License | 6 votes |
public void init() { if(config.getTag("checkUpdates").getBooleanValue(true)) CCUpdateChecker.updateCheck("Translocator"); ClientUtils.enhanceSupportersList("Translocator"); super.init(); ClientRegistry.bindTileEntitySpecialRenderer(TileItemTranslocator.class, new TileTranslocatorRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileLiquidTranslocator.class, new TileTranslocatorRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileCraftingGrid.class, new TileCraftingGridRenderer()); PacketCustom.assignHandler(TranslocatorCPH.channel, new TranslocatorCPH()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(blockTranslocator), new ItemTranslocatorRenderer()); FMLCommonHandler.instance().bus().register(CraftingGridKeyHandler.instance); ClientRegistry.registerKeyBinding(CraftingGridKeyHandler.instance); }
Example #4
Source File: TranslocatorCPH.java From Translocators with MIT License | 6 votes |
@Override public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) { switch (packet.getType()) { case 1: case 2: case 3: TileEntity tile = mc.theWorld.getTileEntity(packet.readInt(), packet.readInt(), packet.readInt()); if (tile instanceof ICustomPacketTile) ((ICustomPacketTile) tile).handleDescriptionPacket(packet); break; case 4: int windowId = packet.readUByte(); GuiTranslocator gui = new GuiTranslocator(new ContainerItemTranslocator( new InventorySimple(9, packet.readUShort(), packet.readString()), mc.thePlayer.inventory)); ClientUtils.openSMPGui(windowId, gui); break; case 5: mc.thePlayer.openContainer.putStackInSlot(packet.readUByte(), packet.readItemStack(true)); break; } }
Example #5
Source File: WRCoreClientProxy.java From WirelessRedstone with MIT License | 5 votes |
@Override public void init() { if(SaveManager.config().getTag("checkUpdates").getBooleanValue(true)) CCUpdateChecker.updateCheck("WR-CBE", WirelessRedstoneCore.class.getAnnotation(Mod.class).version()); ClientUtils.enhanceSupportersList("WR-CBE|Core"); super.init(); PacketCustom.assignHandler(channel, new WRCoreCPH()); }
Example #6
Source File: WRAddonClientProxy.java From WirelessRedstone with MIT License | 5 votes |
@Override public void init() { super.init(); ClientUtils.enhanceSupportersList("WR-CBE|Addons"); WRCoreCPH.delegates.add(new WRAddonCPH()); GuiWirelessSniffer.loadColours(SaveManager.config().getTag("addon")); MinecraftForgeClient.registerItemRenderer(tracker, new RenderTracker()); MinecraftForgeClient.registerItemRenderer(wirelessMap, new WirelessMapRenderer()); RenderingRegistry.registerEntityRenderingHandler(EntityREP.class, new RenderSnowball(rep)); RenderingRegistry.registerEntityRenderingHandler(EntityWirelessTracker.class, new RenderTracker()); }
Example #7
Source File: RenderTracker.java From WirelessRedstone with MIT License | 5 votes |
@Override public void doRender(Entity entity, double x, double y, double z, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslated(x, y+0.2, z); EntityWirelessTracker tracker = (EntityWirelessTracker) entity; if(tracker.isAttachedToEntity()) { Vector3 relVec = tracker.getRotatedAttachment(); Vector3 yAxis = new Vector3(0, 1, 0); Vector3 axis = relVec.copy().crossProduct(yAxis); double angle = -(relVec.angle(yAxis)*todeg); GL11.glTranslated(-x, -y-0.2, -z);//undo translation Vector3 pos = new Vector3(tracker.attachedEntity.lastTickPosX + (tracker.attachedEntity.posX - tracker.attachedEntity.lastTickPosX)*f1, tracker.attachedEntity.lastTickPosY + (tracker.attachedEntity.posY - tracker.attachedEntity.lastTickPosY)*f1 + tracker.attachedEntity.height/2 - tracker.attachedEntity.yOffset - tracker.height, tracker.attachedEntity.lastTickPosZ + (tracker.attachedEntity.posZ - tracker.attachedEntity.lastTickPosZ)*f1); pos.add(relVec).add(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ); GL11.glTranslated(pos.x, pos.y, pos.z); GL11.glRotatef((float)angle, (float)axis.x, (float)axis.y, (float)axis.z); } else if(tracker.item) { double bob = sin(ClientUtils.getRenderTime() / 10) * 0.1; double rotate = ClientUtils.getRenderTime() / 20 * todeg; GL11.glRotatef((float) rotate, 0, 1, 0); GL11.glTranslated(0, bob + 0.2, 0); } GL11.glTranslated(0, -0.2, 0); renderTracker(tracker.freq); GL11.glPopMatrix(); }
Example #8
Source File: WRAddonEventHandler.java From WirelessRedstone with MIT License | 5 votes |
@SubscribeEvent public void clientTick(ClientTickEvent event) { if(ClientUtils.inWorld()) { if (event.phase == Phase.START) TriangTexManager.processAllTextures(); else RedstoneEtherAddons.client().tick(); } }
Example #9
Source File: WRLogicClientProxy.java From WirelessRedstone with MIT License | 5 votes |
@Override public void init() { super.init(); ClientUtils.enhanceSupportersList("WR-CBE|Logic"); MinecraftForgeClient.registerItemRenderer(itemwireless, new ItemWirelessRenderer()); }
Example #10
Source File: JammerPart.java From WirelessRedstone with MIT License | 5 votes |
@Override public double getPearlSpin() { if(world().rand.nextInt(100) == 0 || randfreqspeed == 0) randfreqspeed = world().rand.nextInt(5000) + 1; if(!active()) return 0; return RedstoneEther.getRotation(ClientUtils.getRenderTime(), randfreqspeed); }
Example #11
Source File: TransmitterPart.java From WirelessRedstone with MIT License | 5 votes |
@Override public double getPearlSpin() { if (spinoffset < 0) return RedstoneEther.getRotation(-spinoffset, currentfreq); return RedstoneEther.getRotation(ClientUtils.getRenderTime() - spinoffset, currentfreq); }
Example #12
Source File: ReceiverPart.java From WirelessRedstone with MIT License | 5 votes |
@Override public double getPearlSpin() { if(spinoffset < 0) return RedstoneEther.getRotation(-spinoffset, currentfreq); return RedstoneEther.getRotation(ClientUtils.getRenderTime()-spinoffset, currentfreq); }
Example #13
Source File: NEICPH.java From NotEnoughItems with MIT License | 5 votes |
@Override public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient netHandler) { switch (packet.getType()) { case 1: handleSMPCheck(packet.readUByte(), packet.readString(), mc.theWorld); break; case 10: handleLoginState(packet); break; case 11: handleActionDisabled(packet); break; case 12: handleActionEnabled(packet); break; case 13: ClientHandler.instance().addSMPMagneticItem(packet.readInt(), mc.theWorld); break; case 14: handleGamemode(mc, packet.readUByte()); break; case 21: ClientUtils.openSMPGui(packet.readUByte(), new GuiEnchantmentModifier(mc.thePlayer.inventory, mc.theWorld)); break; case 23: if (packet.readBoolean()) ClientUtils.openSMPGui(packet.readUByte(), new GuiExtendedCreativeInv(new ContainerCreativeInv(mc.thePlayer, new ExtendedCreativeInv(null, Side.CLIENT)))); else mc.displayGuiScreen(new GuiInventory(mc.thePlayer)); break; case 24: ClientUtils.openSMPGui(packet.readUByte(), new GuiPotionCreator(mc.thePlayer.inventory)); break; } }
Example #14
Source File: ClientHandler.java From NotEnoughItems with MIT License | 5 votes |
@SubscribeEvent public void tickEvent(TickEvent.ClientTickEvent event) { if(event.phase == Phase.END) return; Minecraft mc = Minecraft.getMinecraft(); if(mc.theWorld != null) { if(loadWorld(mc.theWorld)) { NEIClientConfig.setHasSMPCounterPart(false); NEIClientConfig.setInternalEnabled(false); if (!Minecraft.getMinecraft().isSingleplayer())//wait for server to initiate in singleplayer NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~')); } if (!NEIClientConfig.isEnabled()) return; KeyManager.tickKeyStates(); NEIController.updateUnlimitedItems(mc.thePlayer.inventory); if (mc.currentScreen == null) NEIController.processCreativeCycling(mc.thePlayer.inventory); updateMagnetMode(mc.theWorld, mc.thePlayer); } GuiScreen gui = mc.currentScreen; if (gui != lastGui) { if (gui instanceof GuiMainMenu) lastworld = null; else if (gui instanceof GuiSelectWorld) NEIClientConfig.reloadSaves(); } lastGui = gui; }
Example #15
Source File: ChunkLoaderClientProxy.java From ChickenChunks with MIT License | 5 votes |
@Override public void init() { if(config.getTag("checkUpdates").getBooleanValue(true)) CCUpdateChecker.updateCheck("ChickenChunks"); ClientUtils.enhanceSupportersList("ChickenChunks"); super.init(); PacketCustom.assignHandler(ChunkLoaderCPH.channel, new ChunkLoaderCPH()); ClientRegistry.bindTileEntitySpecialRenderer(TileChunkLoader.class, new TileChunkLoaderRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileSpotLoader.class, new TileChunkLoaderRenderer()); RenderingRegistry.registerBlockHandler(new ChunkLoaderSBRH()); }
Example #16
Source File: TankSynchroniser.java From EnderStorage with MIT License | 5 votes |
@SubscribeEvent public void tickEnd(ClientTickEvent event) { if(event.phase == Phase.END) if(ClientUtils.inWorld()) clientState.update(); }
Example #17
Source File: EnderItemStorage.java From EnderStorage with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void openClientGui(int windowID, InventoryPlayer playerInv, String name, int size) { this.size = size; empty(); ClientUtils.openSMPGui(windowID, new GuiEnderItemStorage(playerInv, this, name)); }
Example #18
Source File: EnderChestRenderer.java From EnderStorage with MIT License | 5 votes |
public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, float lidAngle) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e); GL11.glColor4f(1, 1, 1, 1); CCRenderState.changeTexture("enderstorage:textures/enderchest.png"); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1, 1, 1, 1); GL11.glTranslated(x, y + 1.0, z + 1.0F); GL11.glScalef(1.0F, -1F, -1F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); model.chestLid.rotateAngleX = lidAngle; model.render(owned); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); renderButtons(freq, rotation, lidAngle); GL11.glPopMatrix(); double time = ClientUtils.getRenderTime() + offset; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + EnderStorageClientProxy.getPearlBob(time), z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example #19
Source File: TileCraftingGridRenderer.java From Translocators with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { TileCraftingGrid tcraft = (TileCraftingGrid)tile; TextureUtils.bindAtlas(0); IIcon icon = Translocator.blockCraftingGrid.gridIcon; Tessellator t = Tessellator.instance; t.setTranslation(x, y+0.001, z); t.startDrawingQuads(); t.setNormal(0, 1, 0); t.addVertexWithUV(1, 0, 0, icon.getMinU(), icon.getMinV()); t.addVertexWithUV(0, 0, 0, icon.getMinU(), icon.getMaxV()); t.addVertexWithUV(0, 0, 1, icon.getMaxU(), icon.getMaxV()); t.addVertexWithUV(1, 0, 1, icon.getMaxU(), icon.getMinV()); t.draw(); t.setTranslation(0, 0, 0); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslated(x+0.5, y, z+0.5); Transformation orient = Rotation.quarterRotations[tcraft.rotation]; for(int i = 0; i < 9; i++) { ItemStack item = tcraft.items[i]; if(item == null) continue; int row = i/3; int col = i%3; Vector3 pos = new Vector3((col-1)*5/16D, 0.1+0.01*Math.sin(i*1.7+ClientUtils.getRenderTime()/5), (row-1)*5/16D).apply(orient); GL11.glPushMatrix(); GL11.glTranslated(pos.x, pos.y, pos.z); GL11.glScaled(0.5, 0.5, 0.5); RenderUtils.renderItemUniform(item); GL11.glPopMatrix(); } if(tcraft.result != null) { GL11.glPushMatrix(); GL11.glTranslated(0, 0.6 + 0.02 * Math.sin(ClientUtils.getRenderTime() / 10), 0); GL11.glScaled(0.8, 0.8, 0.8); RenderUtils.renderItemUniform(tcraft.result, ClientUtils.getRenderTime()); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); }
Example #20
Source File: NEICPH.java From NotEnoughItems with MIT License | 4 votes |
private static String getSaveName(String worldName) { if (Minecraft.getMinecraft().isSingleplayer()) return "local/" + ClientUtils.getWorldSaveName(); return "remote/" + ClientUtils.getServerIP().replace(':', '~') + "/" + worldName; }
Example #21
Source File: WirelessPart.java From WirelessRedstone with MIT License | 4 votes |
public double getFloating() { if (tile() != null) return RedstoneEther.getSineWave(ClientUtils.getRenderTime() + x() * 3 + y() * 5 + z() * 9, 7); return 0; }
Example #22
Source File: TileChunkLoaderRenderer.java From ChickenChunks with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { CCRenderState.reset(); CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); double rot = ClientUtils.getRenderTime()*2; double height; double size; double updown = (ClientUtils.getRenderTime()%50) / 25F; updown = (float) Math.sin(updown*3.141593); updown *= 0.2; TileChunkLoaderBase chunkLoader = (TileChunkLoaderBase)tile; if(chunkLoader instanceof TileChunkLoader) { TileChunkLoader ctile = (TileChunkLoader)chunkLoader; rot /= Math.pow(ctile.radius, 0.2); height = 0.9; size = 0.08; } else if(chunkLoader instanceof TileSpotLoader) { height = 0.5; size = 0.05; } else return; RenderInfo renderInfo = chunkLoader.renderInfo; double active = (renderInfo.activationCounter)/20D; if(chunkLoader.active && renderInfo.activationCounter < 20) active += f/20D; else if(!chunkLoader.active && renderInfo.activationCounter > 0) active -= f/20D; if(renderInfo.showLasers) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); drawRays(d, d1, d2, rot, updown, tile.xCoord, tile.yCoord, tile.zCoord, chunkLoader.getChunks()); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_FOG); } rot = ClientUtils.getRenderTime()*active / 3F; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(d+0.5, d1+height+(updown + 0.3)*active, d2+0.5), new Rotation(rot, new Vector3(0, 1, 0)), size); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("chickenchunks:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example #23
Source File: EnderTankRenderer.java From EnderStorage with MIT License | 4 votes |
public static void renderTank(int rotation, float valve, int freq, boolean owned, double x, double y, double z, int offset) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e); GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslated(x+0.5, y, z+0.5); GL11.glRotatef(-90*(rotation+2), 0, 1, 0); CCRenderState.changeTexture("enderstorage:textures/endertank.png"); CCRenderState.startDrawing(4); tankModel.render(); CCRenderState.draw(); CCRenderState.changeTexture("enderstorage:textures/buttons.png"); CCRenderState.startDrawing(7); for(int i = 0; i < 3; i++) { int colour = EnderStorageManager.getColourFromFreq(freq, i); buttons[i].render(new UVTranslation(0.25 * (colour % 4), 0.25 * (colour / 4))); } CCRenderState.draw(); new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)).glApply(); CCRenderState.changeTexture("enderstorage:textures/endertank.png"); CCRenderState.startDrawing(4); valveModel.render(new UVTranslation(0, owned ? 13/64D : 0)); CCRenderState.draw(); GL11.glPopMatrix(); double time = ClientUtils.getRenderTime()+offset; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(x+0.5, y+0.45+EnderStorageClientProxy.getPearlBob(time)*2, z+0.5), new Rotation(time/3, new Vector3(0, 1, 0)), 0.04); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }