@SideOnly(Side.CLIENT) public final class ComponentManagerHUD { public static final List<Component> components = Lists.newArrayList(); private static final Minecraft mc = Minecraft.getMinecraft(); private static final TextureManager tex = mc.getTextureManager(); private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; private static int prevX, prevY; private static final HUDOverlayBase[] overlays = new HUDOverlayBase[] {new HUDOccurrence()}; private ComponentManagerHUD() {} @SubscribeEvent public static void drawElements(RenderGameOverlayEvent.Pre event) { if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) { GlStateManager.pushMatrix(); GlStateManager.bindTexture(UITextures.GUI.getGlTextureId()); for (Component component : components) component.atlasPass(0, event.getPartialTicks()); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.bindTexture(mc.getTextureMapBlocks().getGlTextureId()); for (Component component : components) component.itemPass(0, event.getPartialTicks()); tex.bindTexture(UITextures.RSS_GLINT); for (Component component : components) { GlStateManager.pushMatrix(); component.itemEffectPass(0, event.getPartialTicks()); GlStateManager.popMatrix(); } GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); for (Component component : components) component.textPass(0, event.getPartialTicks(), font); GlStateManager.popMatrix(); } } @SubscribeEvent public static void updateElements(TickEvent.ClientTickEvent event) { components.forEach(Component::tick); } public static void rebuildComponentList() { components.clear(); for (HUDOverlayBase overlay : overlays) if (overlay.isEnabled()) overlay.build(components); } }
public void RenderAffinity(int i, int j) { AMVector2 affinityPos = getShiftedVector(AMCore.config.getAffinityPosition(), i, j); int x = affinityPos.iX; int y = affinityPos.iY; AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer); for (Affinity affinity : ad.getHighestAffinities()) { if (affinity == null || affinity == Affinity.NONE) continue; GL11.glColor3f(1.0f, 1.0f, 1.0f); AMGuiHelper.instance.DrawIconAtXY( affinity.representItem.getIconFromDamage(affinity.representMeta), x, y, j, 12, 12, true); if (AMCore.config.getShowNumerics()) { String display = String.format( "%.2f%%", AffinityData.For(mc.thePlayer).getAffinityDepth(affinity) * 100); if (x < i / 2) Minecraft.getMinecraft().fontRenderer.drawString(display, x + 14, y + 2, affinity.color); else Minecraft.getMinecraft() .fontRenderer .drawString( display, x - 2 - Minecraft.getMinecraft().fontRenderer.getStringWidth(display), y + 2, affinity.color); } y += 15; } }
private static void addRSPack(boolean refreash) { File rspack = new File(getConfigFolder(), "/resources"); if (!rspack.exists()) return; if (!Arrays.asList(rspack.list()).contains("pack.mcmeta")) { try { JsonWriter writer = new JsonWriter(new FileWriter(new File(rspack, "pack.mcmeta"))); writer.beginObject(); writer.name("pack"); writer.beginObject(); writer.name("pack_format").value(1); writer.name("description").value("Draconic Evolution GUI Images"); writer.endObject(); writer.endObject(); writer.close(); } catch (IOException e) { LogHelper.error("Error creating pack.mcmeta"); e.printStackTrace(); } } Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); f.setAccessible(true); try { List defaultResourcePacks = (List) f.get(Minecraft.getMinecraft()); defaultResourcePacks.add(new FolderResourcePack(rspack)); f.set(Minecraft.getMinecraft(), defaultResourcePacks); LogHelper.info("RS Added"); if (refreash) Minecraft.getMinecraft().refreshResources(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
@Override @SideOnly(Side.CLIENT) public void renderFilter(int x, int y) { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); RenderHelper.renderRect(x, y, 16, 16, 0, 0, 1, 1); String text = String.valueOf(mValue); int fwidth = Minecraft.getMinecraft().fontRenderer.getStringWidth(text); GL11.glPushMatrix(); GL11.glTranslated(x + 17 - fwidth, y + 9, 0); if (fwidth > 16) { GL11.glTranslatef( fwidth / 2 - 1, Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2f - 1, 0); GL11.glScalef(0.5f, 0.5f, 0.5f); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, 0, 0, 16777215); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); }
public List func_94266_e(String par1Str) { ArrayList var2 = new ArrayList(); ITexturePack var3 = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); try { BufferedImage var9 = ImageIO.read(var3.getResourceAsStream("/" + par1Str)); int var10 = var9.getHeight(); int var11 = var9.getWidth(); String var12 = this.func_98146_d(par1Str); if (this.func_98147_a(par1Str, var3)) { int var13 = var11; int var14 = var11; int var15 = var10 / var11; for (int var16 = 0; var16 < var15; ++var16) { Texture var17 = this.func_94261_a( var12, 2, var13, var14, 10496, 6408, 9728, 9728, false, var9.getSubimage(0, var14 * var16, var13, var14)); var2.add(var17); } } else if (var11 == var10) { var2.add(this.func_94261_a(var12, 2, var11, var10, 10496, 6408, 9728, 9728, false, var9)); } else { Minecraft.getMinecraft() .func_98033_al() .func_98236_b( "TextureManager.createTexture: Skipping " + par1Str + " because of broken aspect ratio and not animation"); } return var2; } catch (FileNotFoundException var18) { Minecraft.getMinecraft() .func_98033_al() .func_98236_b( "TextureManager.createTexture called for file " + par1Str + ", but that file does not exist. Ignoring."); } catch (IOException var19) { Minecraft.getMinecraft() .func_98033_al() .func_98236_b( "TextureManager.createTexture encountered an IOException when trying to read file " + par1Str + ". Ignoring."); } return var2; }
public EntityNameRenderer() { Field[] fields = Minecraft.getMinecraft().getClass().getDeclaredFields(); for (Field field : fields) { if (field.getType().isAssignableFrom(Timer.class)) { try { field.setAccessible(true); timer = (Timer) field.get(Minecraft.getMinecraft()); if (timer == null) { System.out.println( "***THIS MESSAGE SHOULD NOT APPEAR, CRASH IS IMMINENT\n***DO NOT START SINGLE/MULTIPLAYER"); try { throw new Exception("NULL TIMER WTFBBQ"); } catch (Exception e) { e.printStackTrace(); System.out.println("please report to Mazetar with your logs (FULL LOG)"); } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
@Override protected void drawSlot(int id, int x, int y, int var4, int var5, int var6) { Block block = blocks.get(id); ItemStack itemStack = new ItemStack(Item.getItemFromBlock(block)); GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); if (itemStack.getItem() != null) try { Minecraft.getMinecraft() .getRenderItem() .renderItemAndEffectIntoGUI(itemStack, x + 4, y + 4); } catch (Exception e) { e.printStackTrace(); } else mc.fontRendererObj.drawString("?", x + 10, y + 9, 10526880); Minecraft.getMinecraft() .getRenderItem() .func_175030_a(Minecraft.getMinecraft().fontRendererObj, itemStack, x + 4, y + 4); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); glDisable(GL_LIGHTING); mc.fontRendererObj.drawString( "Name: " + (itemStack.getItem() == null ? block.getLocalizedName() : itemStack.getDisplayName()), x + 31, y + 3, 10526880); int blockID = Block.getIdFromBlock(block); mc.fontRendererObj.drawString("ID: " + blockID, x + 31, y + 15, 10526880); }
public void renderIcon(float p_178663_1_, int alpha) { int i = -1; String s = FontRenderer.getFormatFromString(this.team.getColorPrefix()); if (s.length() >= 2) { i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1)); } if (i >= 0) { float f = (float) (i >> 16 & 255) / 255.0F; float f1 = (float) (i >> 8 & 255) / 255.0F; float f2 = (float) (i & 255) / 255.0F; Gui.drawRect( 1, 1, 15, 15, MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24); } Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float) alpha / 255.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); }
@SubscribeEvent public void onRenderGUI(RenderGameOverlayEvent.Pre event) { // we're only interested in the inventory if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) { return; } EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack stack = player.getCurrentEquippedItem(); if (stack == null) { return; } // do we hold a tool that supports secondary item usage? if (stack.getItem() instanceof ToolCore && ((ToolCore) stack.getItem()).canUseSecondaryItem()) { int slot = ToolHelper.getSecondaryItemSlot(player); if (slot != player.inventory.currentItem) { // render the special border around the secondary item that would be used int x = event.resolution.getScaledWidth() / 2 - 90 + slot * 20 + 2; int y = event.resolution.getScaledHeight() - 16 - 3; // render a cool underlay thing GlStateManager.color(1, 1, 1, 0.5f); Minecraft.getMinecraft().getTextureManager().bindTexture(widgetsTexPath); Gui.drawScaledCustomSizeModalRect(x, y, 1, 23, 22, 22, 16, 16, 256, 256); } } }
@Override public void onUpdate() { if (!Minecraft.getMinecraft().thePlayer.isCollidedHorizontally && Minecraft.getMinecraft().thePlayer.moveForward > 0 && !Minecraft.getMinecraft().thePlayer.isSneaking()) Minecraft.getMinecraft().thePlayer.setSprinting(true); }
@Override public Render<? super EntityEggcendiary> createRenderFor(RenderManager manager) { return new RenderSnowball( Minecraft.getMinecraft().getRenderManager(), ModItems.itemEggcendiary, Minecraft.getMinecraft().getRenderItem()); }
@Override public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.drawDefaultBackground(); this.drawGradientRect( 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, 0x404040FF, 0x404040FF); this.drawGradientRect( this.guiLeft, this.guiTop, this.xSize, this.ySize, supposedBoundsColor, supposedBoundsColor); MathHelper.circle(16, 16, 8).primitiveDraw(GL11.GL_LINE_LOOP, true, windowColor, zLevel); RenderHelper.drawHollowCircle( 16, 32, 8, MathHelper.getEstimatedSegmentCount("circle", 8), zLevel, windowColor); this.drawGradientRect( this.mc.displayWidth / 2 - 8, this.mc.displayHeight - 16, this.mc.displayWidth / 2 + 8, this.mc.displayHeight, supposedBoundsColor, supposedBoundsColor); }
@Override public void updateEntity() { Random r = new Random(); int i = this.xCoord; int j = this.yCoord; int k = this.zCoord; World world = this.worldObj; count = count + 1; if (count % 1 == 0) { for (int num = 0; num < Particles.INTENSITY; num++) { double theta = r.nextDouble() * Math.PI * 2; double x = Math.cos(theta) * 1.5D; double z = Math.sin(theta) * 1.5D; AcceleratedParticle p = new AcceleratedParticle( world, i + 0.5 + x, j, k + 0.5 + z, -x / 7.5D, 1.5 / 10D, -z / 7.5D); p.setRBGColorF((0.5F + (r.nextFloat() / 2)), 0.0F, 1.0F); p.setParticleTextureIndex(3); Minecraft.getMinecraft().effectRenderer.addEffect(p); AcceleratedParticle l = new AcceleratedParticle( world, i + 0.5 + x, j + 3, k + 0.5 + z, -x / 7.5D, -(1.75 / 10D), -z / 7.5D); l.setRBGColorF((0.5F + (r.nextFloat() / 2)), 0.0F, 1.0F); l.setParticleTextureIndex(3); Minecraft.getMinecraft().effectRenderer.addEffect(l); } } }
@Override @SideOnly(Side.CLIENT) public void onShooterClientUpdate( ItemStack itemStack, World world, EntityPlayer entityPlayer, boolean sendServerTick) { if (Mouse.isButtonDown(0) && hasShootDelayPassed()) { if (canFire(itemStack, world, entityPlayer)) { itemStack.getTagCompound().setLong("LastShot", world.getTotalWorldTime()); ItemRenderPlasmaShotgun.RECOIL_AMOUNT = 12 + getAccuracy(itemStack, entityPlayer, isWeaponZoomed(entityPlayer, itemStack)) * 2; ItemRenderPlasmaShotgun.RECOIL_TIME = 1; Minecraft.getMinecraft().renderViewEntity.hurtTime = 15; Minecraft.getMinecraft().renderViewEntity.maxHurtTime = 30; Vec3 dir = entityPlayer.getLook(1); Vec3 pos = getFirePosition(entityPlayer, dir, Mouse.isButtonDown(1)); WeaponShot shot = createShot(itemStack, entityPlayer, Mouse.isButtonDown(1)); onClientShot(itemStack, entityPlayer, pos, dir, shot); addShootDelay(itemStack); sendShootTickToServer(world, shot, dir, pos); return; } else if (needsRecharge(itemStack)) { chargeFromEnergyPack(itemStack, entityPlayer); } } super.onShooterClientUpdate(itemStack, world, entityPlayer, sendServerTick); }
@Override public void onPlayerStoppedUsing( ItemStack weapon, World world, EntityPlayer entityPlayer, int time) { if (world.isRemote) { int maxCount = getShotCount(weapon, entityPlayer); int timeElapsed = (getMaxItemUseDuration(weapon) - time); int count = Math.max(1, (int) ((1f - (timeElapsed / (float) MAX_CHARGE_TIME)) * maxCount)); float shotPercent = count / (float) getShotCount(weapon, entityPlayer); ItemRenderPlasmaShotgun.RECOIL_AMOUNT = 15 + (maxCount - count) * 2 + getAccuracy(weapon, entityPlayer, isWeaponZoomed(entityPlayer, weapon)) * 2; ItemRenderPlasmaShotgun.RECOIL_TIME = 1 + (maxCount - count) * 0.03f; Minecraft.getMinecraft().renderViewEntity.hurtTime = 15 + (maxCount - count); Minecraft.getMinecraft().renderViewEntity.maxHurtTime = 30 + (maxCount - count); Vec3 dir = entityPlayer.getLook(1); Vec3 pos = getFirePosition(entityPlayer, dir, Mouse.isButtonDown(1)); WeaponShot shot = createShot(weapon, entityPlayer, Mouse.isButtonDown(1)); shot.setCount(count); shot.setAccuracy(shot.getAccuracy() * shotPercent); shot.setRange(shot.getRange() + (int) (shot.getRange() * (1 - shotPercent))); onClientShot(weapon, entityPlayer, pos, dir, shot); MatterOverdrive.packetPipeline.sendToServer( new PacketFirePlasmaShot(entityPlayer.getEntityId(), pos, dir, shot)); addShootDelay(weapon); stopChargingSound(); entityPlayer.clearItemInUse(); } }
private void doInventoryRendering( ItemStack item, HeraldryData heraldryData, IHeraldryItem heraldryItem) { Minecraft.getMinecraft().getTextureManager().bindTexture(map_overlay); BattlegearRenderHelper.renderTexturedQuad(0, 0, itemRenderer.zLevel, 16, 16); // IIcon icon = heraldryItem.getBaseIcon(item); itemRenderer.zLevel += 100; glPushMatrix(); RefreshableTexture currentCrest = new RefreshableTexture(32, 32); currentCrest.refreshWith(heraldryData, false); ResourceLocation crestLocation = Minecraft.getMinecraft() .getTextureManager() .getDynamicTextureLocation("gui_crest", currentCrest); ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(crestLocation); if (texture == null) { texture = new HeraldryTextureSmall(heraldryData); Minecraft.getMinecraft().getTextureManager().loadTexture(crestLocation, texture); } Minecraft.getMinecraft().getTextureManager().bindTexture(crestLocation); BattlegearRenderHelper.renderTexturedQuad(2, 2, itemRenderer.zLevel, 12, 12); glPopMatrix(); itemRenderer.zLevel -= 100; }
public void renderItem(ItemRenderType var1, ItemStack var2, Object... var3) { switch (RenderHelper.newRender[var1.ordinal()]) { case 1: GL11.glPushMatrix(); Minecraft.getMinecraft() .renderEngine .bindTexture("/blfngl/fallout/textures/AntiMaterielRifle.png"); boolean var4 = false; if (var3[1] != null && var3[1] instanceof EntityPlayer) { float var5; if ((EntityPlayer) var3[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && (!(Minecraft.getMinecraft().currentScreen instanceof GuiInventory) && !(Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) || RenderManager.instance.playerViewY != 180.0F)) { var4 = true; GL11.glTranslatef(0.7F, 0.5F, -0.25F); GL11.glRotatef(205.0F, 0.0F, 0.0F, 1.0F); } else { var5 = 0.3F; GL11.glTranslatef(0.7F, 0.5F, -0.2F); GL11.glScalef(var5, var5, var5); GL11.glRotatef(295.0F, 0.0F, 0.0F, 1.0F); } } this.model.render((Entity) var3[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); default: } }
public static void playBlockBreakParticles(BlockPos pos, IBlockState state) { ParticleManager pm = Minecraft.getMinecraft().effectRenderer; for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { double d0 = (double) pos.getX() + ((double) j + 0.5D) / 4D; double d1 = (double) pos.getY() + ((double) k + 0.5D) / 4D; double d2 = (double) pos.getZ() + ((double) l + 0.5D) / 4D; Particle digging = diggingFactory.getEntityFX( 0, Minecraft.getMinecraft().theWorld, d0, d1, d2, d0 - (double) pos.getX() - 0.5D, d1 - (double) pos.getY() - 0.5D, d2 - (double) pos.getZ() - 0.5D, Block.getStateId(state)); pm.addEffect(digging); } } } }
@Override public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) { if (inGame && minecraft.currentScreen == null) { if (LiteModExample.toggleJumpKeybinding.isPressed()) { Minecraft.getMinecraft().gameSettings.autoJump = !Minecraft.getMinecraft().gameSettings.autoJump; ITextComponent message = new TextComponentString(""); ITextComponent prefix = new TextComponentString("[ToggleJump] "); prefix.setStyle(new Style().setColor(TextFormatting.GOLD)); ITextComponent text; if (Minecraft.getMinecraft().gameSettings.autoJump) { text = new TextComponentString("Auto jump is now enabled"); } else { text = new TextComponentString("Auto jump is now disabled"); } message.appendSibling(prefix); message.appendSibling(text); Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(message); } } }
public void renderParticle( Tessellator tess, float ptt, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { brightness = brightnessFade.updateFade(particleAge); float progress = (float) particleAge / particleMaxAge; // tess.draw(); // glPushMatrix(); glDepthMask(false); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Minecraft.getMinecraft().renderEngine.bindTexture(tex); float scale = data.size; float[] pos = FXHelper.trackingParticleLocale(this, ptt); float[] rot = new float[] {rotX, rotXZ, rotZ, rotYZ, rotXY}; pos[0] += data.xRad * Math.cos(2 * Math.PI * progress); pos[1] += 0.5 * data.yRad * Math.cos(2 * Math.PI * progress) * Math.sin(2 * Math.PI * progress); pos[2] += data.zRad * Math.sin(2 * Math.PI * progress); draw(tess, pos, scale, rot); glDisable(GL_BLEND); glDepthMask(true); // glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(FXHelper.getParticleTexture()); // tess.startDrawingQuads(); }
public static float[] getRotationsNeeded(Entity entity) { if (entity == null) return null; double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX; double diffY; if (entity instanceof EntityLivingBase) { EntityLivingBase entityLivingBase = (EntityLivingBase) entity; diffY = entityLivingBase.posY + entityLivingBase.getEyeHeight() * 0.9 - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()); } else diffY = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()); double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ; double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ); float yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / Math.PI) - 90.0F; float pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / Math.PI); return new float[] { Minecraft.getMinecraft().thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(yaw - Minecraft.getMinecraft().thePlayer.rotationYaw), Minecraft.getMinecraft().thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float( pitch - Minecraft.getMinecraft().thePlayer.rotationPitch) }; }
public static void resetConfig() { try { menuProps.setProperty("selectedMenu", ""); menuProps.setProperty("loopMusic", "true"); menuProps.setProperty("muteMusic", "false"); menuProps.setProperty("lastMusicIndex", String.valueOf(jukebox.getIndexFromName("Strad"))); menuProps.setProperty("musicIndex", String.valueOf(jukebox.getIndexFromName("Strad"))); menuProps.setProperty("musicSet", "false"); menuProps.setProperty("hasPlayedMusic", "false"); menuProps.setProperty("hasStartedMusic", "false"); Minecraft.getMinecraft(); menuProps.store( new FileOutputStream(Minecraft.getMinecraftDir() + "/MenuAPI.properties"), null); Minecraft.getMinecraft(); FileInputStream in = new FileInputStream(Minecraft.getMinecraftDir() + "/MenuAPI.properties"); menuProps.load(in); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
/** {@inheritDoc} */ @Init public void load(final FMLInitializationEvent event) { klaxon = new ItemKlaxon(klaxonId); LanguageRegistry.addName(klaxon, "Klaxon"); GameRegistry.addRecipe( new ItemStack(klaxon), " x ", "xox", " x ", 'x', new ItemStack(Item.stick), 'o', new ItemStack(Item.leather)); if (event.getSide() == Side.CLIENT) { String name = "klaxon" + Minecraft.getMinecraft().session.username; Minecraft.getMinecraft().sndManager.addSound(name + ".ogg", file); FMLLog.log(MOD_ID, Level.INFO, "klaxon name %s", name); } // Adds listeners. if (event.getSide() == Side.CLIENT) { providerListener = new MyProviderListener(); fileListener = new MyFileListener(); IProvider p = P2P.get(P2P.CLIENT_PROVIDER); p.addListener(providerListener); p.getFileProvider().addListener(fileListener); } }
public void drawBars() { if (RLMPlayerProps.get(Minecraft.getMinecraft().thePlayer) != null) { bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/rim.png")); drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 256, 256, 256, 256); // bindTexture(emptybar); // drawModalRectWithCustomSizedTexture(20, 5, 0, 0, 49, 6, 49, 6); EntityPlayer player = Minecraft.getMinecraft().thePlayer; RLMPlayerProps props = RLMPlayerProps.get(player); poopbar.drawWidget(0, 0, 0F); peebar.drawWidget(0, 0, 0F); bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/lucky.png")); drawScaledCustomSizeModalRect(65, 1, 0, 0, 31, 31, 20, 20, 32, 32); drawString( Minecraft.getMinecraft().fontRendererObj, String.valueOf("Cash: " + props.cash + "$"), 2, 2, Color.white.getRGB()); float temperature = TemperatureHelper.getTemperaturesForBiomes( player.worldObj.getBiomeGenForCoords(player.getPosition()), player); drawString( Minecraft.getMinecraft().fontRendererObj, String.valueOf("Temp: " + temperature + "°"), 2, 13, TemperatureHelper.getColorForTemperature(temperature)); } }
@SubscribeEvent public void onClientTicket(ClientTickEvent evt) { if (evt.phase == TickEvent.Phase.END && Minecraft.getMinecraft().theWorld != null) { Random rnd = Minecraft.getMinecraft().theWorld.rand; float chance = 0.004f; if (VintageCraft.proxy.meteorShowerDuration > 0) { VintageCraft.proxy.meteorShowerDuration--; chance = 0.11f; } if (rnd.nextFloat() < chance && RenderSkyVC.shootingStars.size() < 35) { RenderSkyVC.shootingStars.add( new ShootingStar( rnd.nextFloat() * 300 - 150, rnd.nextFloat() * 300 - 150, rnd.nextFloat())); } for (Iterator<ShootingStar> iterator = RenderSkyVC.shootingStars.iterator(); iterator.hasNext(); ) { ShootingStar star = iterator.next(); star.tick(); if (star.isDead()) { // Remove the current element from the iterator and the list. iterator.remove(); } } } }
@Override public void registerTileEntities() { super.registerTileEntities(); IReloadableResourceManager IRRM = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); IRRM.registerReloadListener(this); RenderManager rm = Minecraft.getMinecraft().getRenderManager(); RenderingRegistry.registerEntityRenderingHandler(EntityStone.class, new RenderEntityStone()); RenderingRegistry.registerEntityRenderingHandler( EntityMobHorse.class, new RenderHorse(rm, new ModelHorse(), 0.75f)); RenderingRegistry.registerEntityRenderingHandler( EntityForestSpider.class, new RenderForestSpider(rm)); RenderingRegistry.registerEntityRenderingHandler( EntityCoalPoweredMinecartVC.class, new RenderMinecart(rm)); RenderingRegistry.registerEntityRenderingHandler( EntityEmptyMinecartVC.class, new RenderMinecart(rm)); RenderingRegistry.registerEntityRenderingHandler( EntityCowVC.class, new RenderCow(rm, new ModelCowVC(), 0.7F)); RenderingRegistry.registerEntityRenderingHandler( EntitySheepVC.class, new RenderSheep(rm, new ModelSheep2(), 0.7F)); }
@SideOnly(Side.CLIENT) private void spawnParticle(World world, int x, int y, int z) { int p = Minecraft.getMinecraft().gameSettings.particleSetting; if (rand.nextInt(1 + p / 2) == 0) { double d = 1.25; double rx = ReikaRandomHelper.getRandomPlusMinus(x + 0.5, d); double ry = ReikaRandomHelper.getRandomPlusMinus(y + 0.5, d); double rz = ReikaRandomHelper.getRandomPlusMinus(z + 0.5, d); EntityFlareFX fx = new EntityFlareFX(color, world, rx, ry, rz); Minecraft.getMinecraft().effectRenderer.addEffect(fx); } if (this.isEnhanced()) { int n = 2 + (int) Math.sin(Math.toRadians(this.getTicksExisted())); for (int i = 0; i < n; i++) { float s = (float) ReikaRandomHelper.getRandomPlusMinus(2D, 1); int l = 10 + rand.nextInt(50); EntityFloatingSeedsFX fx = new EntityFloatingSeedsFX( world, x + 0.5, y + 0.5, z + 0.5, rand.nextInt(360), ReikaRandomHelper.getRandomPlusMinus(0, 90)); fx.fadeColors(ReikaColorAPI.mixColors(color.getColor(), 0xffffff, 0.375F), color.getColor()) .setScale(s) .setLife(l) .setRapidExpand(); fx.freedom *= 3; fx.velocity *= 3; Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } }
@SideOnly(Side.CLIENT) public static boolean isHoldingItemStack(ItemStack itemStack) { if (Minecraft.getMinecraft().thePlayer == null) return false; ItemStack tempStack = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(); if (itemStack != null && tempStack != null) return tempStack.getItem().equals(itemStack.getItem()); return false; }
public static String getName() { String dim = Minecraft.getMinecraft().theWorld.provider.getDimensionName(); if (!Server.inServer()) { return Minecraft.getMinecraft().getIntegratedServer().getWorldName() + " (" + dim + ")"; } else { return Minecraft.getMinecraft().theWorld.getWorldInfo().getWorldName() + " (" + dim + ")"; } }
@Override @SideOnly(Side.CLIENT) public int getLightBrightnessForSkyBlocks(int x, int y, int z, int meta) { Entity ent = Minecraft.getMinecraft().renderViewEntity; return Minecraft.getMinecraft() .theWorld .getLightBrightnessForSkyBlocks((int) ent.posX, (int) ent.posY, (int) ent.posZ, meta); }