Jump to content

Mark136

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by Mark136

  1. hey there, I want to update my mod to 1.11. and most changes are like mc.theworld = mc.world or mc.theplayer = mc.player and these are easy to update but the worst thing i have is that the ItemStack cannot be null anymore and a nullstack is now stack.EMPTY, and "stack == null" = ItemStack.isEmpty() can i do something with eclipse so eclipse will error all the stack == null and nullstacks for me. like what I do with depricates. using preference>Java>Compiler... is there a way to do that? this can me save hours/Days of work
  2. okay thanks, I now have custom HP, but cant find out how to work with the LivingRenderEvent or something like that to spawn A damageIndicator (the number of the hit that is done) I also thought I could do something like that using a particle but what i say at the begin of the topic i don't know how to use the minecraft fonts texture and use them in the particle(I think this is a really hard way and that there are much easier ways to do this like using the LivingRenderEvent.
  3. ... I was registering the Mobs in init instead of pre-init, so the rendering part was registered before the EntityRegistry. resulting in an invisible projectile. why the projectile was going through blocks is that I forgot the !world.isRemote() check in ItemWand. now the projectile is spawning well. thx for the help
  4. hey, I already checked this with particle trails, and when the projectile lands in the water. the particles spawn, but the projectile doesn't I currently busy with separating the projectile from the rest of my code so its easier to read. I also gonna create a Git repo of it. I don't extend the entity Throwable because I want to change the character a bit. the gravity, the valocity ect. also, if i shoot an entityFireBall. the fireball goes through everything. here is ItemWand class. this is the Item how I shoot the projectile. Git repo is coming! public class MarkWand extends Item { /** * custom EnumMaterial to calculate some values that I need for * my combat system. * */ private EnumMaterial material; private float AttackDamage; private int Cooldown = 0; public MarkWand(EnumMaterial Material){ this.material = Material; this.maxStackSize = 1; this.setMaxDamage(Material.getMaxUses()); } /** TODO: Does Nothing, Why I have this, this is for holding a Tool right? */ @SideOnly(Side.CLIENT) public boolean isFull3D() { return true; } @Override public ActionResult<ItemStack> onItemRightClick(ItemStack I, World W, EntityPlayer Player, EnumHand hand) { if(this.Cooldown < 1){ this.Cooldown = 30; Entity GemBall; if(this == MarkItems.Wand1){ GemBall = new EntityOpalShot(W, Player, 0); ((EntityOpalShot) GemBall).setHeadingFromThrower(Player, Player.rotationPitch, Player.rotationYaw, 0.0F, 1.5F, 1.0F); I.damageItem(1, Player); } else{ Vec3d aim = Player.getLookVec(); GemBall = new EntitySmallFireball(W, Player, 1, 1, 1); ((EntitySmallFireball)GemBall).setPosition( Player.posX + aim.xCoord * 1.5D, Player.posY + aim.yCoord * 1.5D, Player.posZ + aim.zCoord * 1.5D); ((EntitySmallFireball)GemBall).accelerationX = aim.xCoord * 0.1; ((EntitySmallFireball)GemBall).accelerationY = aim.yCoord * 0.1; ((EntitySmallFireball)GemBall).accelerationZ = aim.zCoord * 0.1; } W.spawnEntityInWorld(GemBall); } return new ActionResult(EnumActionResult.PASS, I); } /** I want a cooldown period between the shots, so this is why I have this */ @Override public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean B) { if (this.Cooldown > 0){ this.Cooldown--; } } }
  5. ok, this are the constructors now: public EntityOpalShot(World worldIn) { super(worldIn); this.xTile = -1; this.yTile = -1; this.zTile = -1; this.setSize(0.25F, 0.25F); } public EntityOpalShot(World worldIn, EntityLivingBase throwerIn, int ID) { this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ, ID); this.shooter = throwerIn; } public EntityOpalShot(World worldIn, double x, double y, double z, int ID) { this(worldIn); this.setPosition(x, y, z); this.BurstID = ID; } unfortunately, nothing happened
  6. ok, it is almost fully copied from EntityThrowable with some small changes public class EntityOpalShot extends Entity implements IProjectile { /** will be used Later for particle Trails */ //TODO private int BurstID; private int ignoreTimeM; private int xTile; private int yTile; private int zTile; private Block inTile; protected boolean inGround; public int throwableShake; /** The entity that threw this throwable item. */ private EntityLivingBase thrower; private String throwerName; private int ticksInGround; private int ticksInAir; public Entity ignoreEntity; public EntityOpalShot(World worldIn, int ID) { super(worldIn); this.xTile = -1; this.yTile = -1; this.zTile = -1; this.setSize(0.25F, 0.25F); this.BurstID = ID; } public EntityOpalShot(World worldIn, EntityLivingBase throwerIn, int ID) { this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ, ID); this.thrower = throwerIn; this.BurstID = ID; } public EntityOpalShot(World worldIn, double x, double y, double z, int ID) { this(worldIn, ID); this.setPosition(x, y, z); } protected void entityInit() { } /** * Checks if the entity is in range to render. */ @SideOnly(Side.CLIENT) public boolean isInRangeToRenderDist(double distance) { double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; if (Double.isNaN(d0)) { d0 = 4.0D; } d0 = d0 * 64.0D; return distance < d0 * d0; } /** * Sets throwable heading based on an entity that's throwing it */ public void setHeadingFromThrower(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy) { float f = -MathHelper.sin(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * 0.017453292F); float f2 = MathHelper.cos(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); this.setThrowableHeading((double)f, (double)f1, (double)f2, velocity, inaccuracy); this.motionX += entityThrower.motionX; this.motionZ += entityThrower.motionZ; if (!entityThrower.onGround) { this.motionY += entityThrower.motionY; } } /** * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. */ public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { float f = MathHelper.sqrt_double(x * x + y * y + z * z); x = x / (double)f; y = y / (double)f; z = z / (double)f; x = x + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; y = y + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; z = z + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; x = x * (double)velocity; y = y * (double)velocity; z = z * (double)velocity; this.motionX = x; this.motionY = y; this.motionZ = z; float f1 = MathHelper.sqrt_double(x * x + z * z); this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI)); this.rotationPitch = (float)(MathHelper.atan2(y, (double)f1) * (180D / Math.PI)); this.prevRotationYaw = this.rotationYaw; this.prevRotationPitch = this.rotationPitch; this.ticksInGround = 0; } /** * Updates the velocity of the entity to a new value. * TODO: No Idea where this is called. Check if this is useful to keep in code. */ @SideOnly(Side.CLIENT) public void setVelocity(double x, double y, double z) { this.motionX = x; this.motionY = y; this.motionZ = z; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(x * x + z * z); this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI)); this.rotationPitch = (float)(MathHelper.atan2(y, (double)f) * (180D / Math.PI)); this.prevRotationYaw = this.rotationYaw; this.prevRotationPitch = this.rotationPitch; } } /** * updating movement, checks for inpact ect. TODO: check if I can lower the Velocity * and remove the Gravity. also check if there is some "if ticks in air = ? set dead ect." */ public void onUpdate() { this.lastTickPosX = this.posX; this.lastTickPosY = this.posY; this.lastTickPosZ = this.posZ; super.onUpdate(); if (this.throwableShake > 0) { --this.throwableShake; } if (this.inGround) { if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksInGround; if (this.ticksInGround == 1200) { this.setDead(); } return; } this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksInGround = 0; this.ticksInAir = 0; } else { ++this.ticksInAir; } Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); RayTraceResult raytraceresult = this.worldObj.rayTraceBlocks(vec3d, vec3d1); vec3d = new Vec3d(this.posX, this.posY, this.posZ); vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (raytraceresult != null) { vec3d1 = new Vec3d(raytraceresult.hitVec.xCoord, raytraceresult.hitVec.yCoord, raytraceresult.hitVec.zCoord); } Entity entity = null; List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D)); double d0 = 0.0D; boolean flag = false; for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity)list.get(i); if (entity1.canBeCollidedWith()) { if (entity1 == this.ignoreEntity) { flag = true; } else if (this.ticksExisted < 2 && this.ignoreEntity == null) { this.ignoreEntity = entity1; flag = true; } else { flag = false; AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D); RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1); if (raytraceresult1 != null) { double d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec); if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } } } } } if (this.ignoreEntity != null) { if (flag) { this.ignoreTimeM = 2; } else if (this.ignoreTimeM-- <= 0) { this.ignoreEntity = null; } } if (entity != null) { raytraceresult = new RayTraceResult(entity); } if (raytraceresult != null) { if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && this.worldObj.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL) { this.setPortal(raytraceresult.getBlockPos()); } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI)); for (this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f1 = 0.99F; float f2 = this.getGravityVelocity(); if (this.isInWater()) { for (int j = 0; j < 4; ++j) { float f3 = 0.25F; this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ, new int[0]); } f1 = 0.8F; } this.motionX *= (double)f1; this.motionY *= (double)f1; this.motionZ *= (double)f1; if (!this.func_189652_ae()) { this.motionY -= (double)f2; } this.setPosition(this.posX, this.posY, this.posZ); } /** * Gets the amount of gravity to apply to the thrown entity with each tick. */ protected float getGravityVelocity() { return 0.03F; } /** * TODO: check why this is'nt called. * */ protected void onImpact(RayTraceResult result) { if (result.entityHit != null) { result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 2.0F); } if (!this.worldObj.isRemote) { this.setDead(); } } /** * TODO: wtf is this? Checkout! * */ public static void func_189661_a(DataFixer p_189661_0_, String p_189661_1_) { } /** * Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound compound) { compound.setInteger("xTile", this.xTile); compound.setInteger("yTile", this.yTile); compound.setInteger("zTile", this.zTile); ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(this.inTile); compound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); compound.setByte("shake", (byte)this.throwableShake); compound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); if ((this.throwerName == null || this.throwerName.isEmpty()) && this.thrower instanceof EntityPlayer) { this.throwerName = this.thrower.getName(); } compound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); } /** * Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { this.xTile = compound.getInteger("xTile"); this.yTile = compound.getInteger("yTile"); this.zTile = compound.getInteger("zTile"); if (compound.hasKey("inTile", 8)) { this.inTile = Block.getBlockFromName(compound.getString("inTile")); } else { this.inTile = Block.getBlockById(compound.getByte("inTile") & 255); } this.throwableShake = compound.getByte("shake") & 255; this.inGround = compound.getByte("inGround") == 1; this.thrower = null; this.throwerName = compound.getString("ownerName"); if (this.throwerName != null && this.throwerName.isEmpty()) { this.throwerName = null; } this.thrower = this.getThrower(); } @Nullable public EntityLivingBase getThrower() { if (this.thrower == null && this.throwerName != null && !this.throwerName.isEmpty()) { this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); if (this.thrower == null && this.worldObj instanceof WorldServer) { try { Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName)); if (entity instanceof EntityLivingBase) { this.thrower = (EntityLivingBase)entity; } } catch (Throwable var2) { this.thrower = null; } } } return this.thrower; } }
  7. Ok, Thanks, I didn't knew I could run a server in Eclipse. now i had far more errors than this one, I didn't registered the the client things well, now I have separated the client things and the server things. and now the client and server both working. but it still didn't fix the problem. this is how my client proxy looks right now public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); this.registerRenderers(); } public void registerRenderers(){ RenderingRegistry.registerEntityRenderingHandler(EntityOpalShot.class, RenderOpalShot::new); }
  8. @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { I havend done something with the proxies for over a year, but everything is working. No Crashes(proxy part) only added the line for the new Entity Projectile and that time the Old RegisterEntityRenderingHandler became Depricated in favor of the IRenderFactory thing
  9. Hello, I created a custom firebal projectile but it doest render well. the particles renders and the entity exist, only the projectile does'nt render. I think it is something stupid but can't find it. so here you can see my renderOpalShot Class, and I already checked that the doRender and the getEntityTexture both got called: @SideOnly(Side.CLIENT) public class RenderOpalShot extends Render<EntityOpalShot>{ private ResourceLocation location = new ResourceLocation("mark13695","textures/entity/Opal1.png"); public RenderOpalShot(RenderManager renderManager) { super(renderManager); } @Override public void doRender(EntityOpalShot entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); this.bindEntityTexture(entity); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.enableRescaleNormal(); GlStateManager.scale(0.5F, 0.5F, 0.5F); TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(MarkItems.OpalShotIcon); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMaxU(); float f2 = textureatlassprite.getMinV(); float f3 = textureatlassprite.getMaxV(); GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * -this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL); vertexbuffer.pos(-0.5D, -0.25D, 0.0D).tex((double)f, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(0.5D, -0.25D, 0.0D).tex((double)f1, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(0.5D, 0.75D, 0.0D).tex((double)f1, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(-0.5D, 0.75D, 0.0D).tex((double)f, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); tessellator.draw(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override protected ResourceLocation getEntityTexture(EntityOpalShot entity) { return location; } } yeah, as you see, I copied most of the code from EntityFireBall... this file is called in clientproxy, with all my other entities that havend Spawning problems public static void registerRenderers(){ //... RenderingRegistry.registerEntityRenderingHandler(EntityOpalShot.class, RenderOpalShot::new); } and this is called in the pre-Init method in the mainfile: @EventHandler public void PreInit(FMLPreInitializationEvent Event){ //... ClientProxy.registerRenderers(); } @EventHandler public void init(FMLInitializationEvent Event){ //... MobRegistry.init(); } and here I registered my mobs: public static void init(){ //... EntityRegistry.registerModEntity(EntityOpalShot.class, "OpalShot", 23, MainRegistry.instance, 80, 3, true); } thanks for helping me.
  10. hello again, i'm currently trying to do something with combat, but minecraft code punches me in the face again. -RangedAttribute MAX_HEALTH caps at 1024... DONE! -Particle DAMAGE_INDICATOR needs to be replaced by a Clearer indicator to solve both problems,I created to create a new current HP value and a Max HP value with the Capabiities System I canceled LivingHurtEvent so Vanilla Health does'nt have any effect anymore, and I can still use the damage source + amount in the event to change the custom HP.(only works on Server Side) I still need to find a way to get the HP on the clientSide For my HUD and for above the mob DONE! I also need to check if I can get a TextComponentString into a TextureAtlasSprite for my clearer indicator or how to get LivingRenderEvent to work
  11. hey i'm back, had it a little busy last time, did'nt fix the chat, so i leave that for later. i also want to change something more, more particle things i want to replace the Damage_Indicator(id44) with my custom particle that shows the damage instead of the hearths. how do i remove a type of vanilla particle?
  12. I don't think it's worth it to change the whole chat for just adding Hex colors. isn't there an better way to do this. I still did'nt find it jet where minecraft sets $(..) to colors and styles in chat. it must be somewhere linked with the TextComponentString class i think.
  13. is there really no way to get more than those 16 colours?, like: For GuiChat: Replacing the GuiChat with a costum one. and for the HUD Chat, I can do the Same with RenderGameOverlay Event or something like that could this work? The only problem I could expect is the incompatability with other mods editing chat
  14. bump... ok found something to do what i want, i can change chat names with ClientChatReceived Event but now I got stuck at the TextFormatter#getHexColour because there isn't any code for the chat like that... can I create a Custom TextFormatter so I can set the chat colour to Whatever color I want instead of the only 16 colours? also, question 2: how to render some stuff like a Health bar above every LivingEntity. how can I do that?
  15. i think he cannot find the Block models line 100 in your logs says: Caused by: java.io.FileNotFoundException: luminousity:models/block/models/block/sun_crystal.json you can also look in the jar in the roaming/.minecraft/versions/[your_version] folder to look at the assets how minecraft creates models
  16. can you tell me more about your problem, show crash report or something like that. yes, u need an Item Model to Render your ItemBlock maybe this will help? http://greyminecraftcoder.blogspot.nl/2015/03/troubleshooting-block-and-item-rendering.html
  17. oke, maybe a simple example. as i need the same sort of code in my mod, but a little differend than i gonna tell here: Can i make my displayname different for each player, so for one player my name will be shown as "serverAdmin" and for another player my name will be shown as "Mark136" ect. is this possible with PlayerEvent#NameFormat, or can I only just changing the displayName?
  18. Hi, I'm done with the toolboxes and now busy with editing some gameOverlay things I've Already changed the Health & FoodBars and added my own Hunger System. I still got some problems on editing the Players Display name. I know i can do that with PlayerEvent#NameFormat but i want to do some extra. I want to Change the Name to Name[playerlevel] but with some more effects: what I want is that the [playerlevel] part is gonna have a colour depending on the clientplayer's level (the player who receives the string) and the StringPlayer's level. is this even possible with PlayerEvent#NameFormat? also I want to render some stuff like a Health bar above every LivingEntity. how can I do that?
  19. ah, thanks, never knew that there was an event called GuiOpenEvent I only had looked in the event Map of minecraft forge but forgot there were also Client events everything is working fine now
  20. hallo, I currently stuck at replacing the player's inventory with my custom one, I have googled much for a solution for this, but cannot find anything that would help me I've already tried this: @SubscribeEvent public void PlayerContainerEvent(net.minecraftforge.event.entity.player.PlayerContainerEvent e){ Container container = e.getContainer(); EntityPlayer player = e.getEntityPlayer() if(container == player.inventoryContainer && !player.isCreative()){ //also true when my custom gui is opened ? and yeah, i wish to keep creative inventory System.out.println("do some stuff like opening my own gui & container"); } but somewhere if i open my Gui, the booleancontainer == player.inventoryContainer is also true, so this hasn't worked for me. does someone know something better then this ore something to fix my problem.
  21. Thanks MadMartian btw, disabling the depht fixes my problem now the Items spawn under the Textures!
  22. i see some z values in drawItemStack : zLevel and ItemRender.zLevel. and some translate stuff what sets the z index to 32: private void drawItemStack(ItemStack stack, int x, int y, String altText) { GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; net.minecraft.client.gui.FontRenderer font = null; if (stack != null) font = stack.getItem().getFontRenderer(stack); if (font == null) font = fontRendererObj; this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : , altText); this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; } and here some code of the minecraft GuiContainer#drawScreen : public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); int i = this.guiLeft; int j = this.guiTop; this.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); super.drawScreen(mouseX, mouseY, partialTicks); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate((float)i, (float)j, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableRescaleNormal(); this.theSlot = null; int k = 240; int l = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1); this.drawSlot(slot); if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.canBeHovered()) { this.theSlot = slot; GlStateManager.disableLighting(); GlStateManager.disableDepth(); int j1 = slot.xDisplayPosition; int k1 = slot.yDisplayPosition; GlStateManager.colorMask(true, true, true, false); this.drawGradientRect(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableLighting(); GlStateManager.enableDepth(); } } RenderHelper.disableStandardItemLighting(); this.drawGuiContainerForegroundLayer(mouseX, mouseY); RenderHelper.enableGUIStandardItemLighting(); InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack; if (itemstack != null) { int j2 = 8; int k2 = this.draggedStack == null ? 8 : 16; String s = null; if (this.draggedStack != null && this.isRightMouseClick) { itemstack = itemstack.copy(); itemstack.stackSize = MathHelper.ceiling_float_int((float)itemstack.stackSize / 2.0F); } else if (this.dragSplitting && this.dragSplittingSlots.size() > 1) { itemstack = itemstack.copy(); itemstack.stackSize = this.dragSplittingRemnant; if (itemstack.stackSize == 0) { s = "" + TextFormatting.YELLOW + "0"; } } this.drawItemStack(itemstack, mouseX - i - 8, mouseY - j - k2, s); } if (this.returningStack != null) { float f = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F; if (f >= 1.0F) { f = 1.0F; this.returningStack = null; } int l2 = this.returningStackDestSlot.xDisplayPosition - this.touchUpX; int i3 = this.returningStackDestSlot.yDisplayPosition - this.touchUpY; int l1 = this.touchUpX + (int)((float)l2 * f); int i2 = this.touchUpY + (int)((float)i3 * f); this.drawItemStack(this.returningStack, l1, i2, (String)null); } GlStateManager.popMatrix(); if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack()) { ItemStack itemstack1 = this.theSlot.getStack(); this.renderToolTip(itemstack1, mouseX, mouseY); } GlStateManager.enableLighting(); GlStateManager.enableDepth(); RenderHelper.enableStandardItemLighting(); } are the z values responsible for that the Items are always in front?
  23. I think your right Draco18s, DrawItemStack is called after drawGuiContainerForegroundLayer and drawSlot is private, also DrawItemStack and isMouseOverSlot are private. so there is'nt no other way :'( then I have a lot of work to do.
  24. i don't think you understand what i mean, i also want to draw the texture over the Item in the slot, currently i can make the slot darker but the item in the slot still pushing to the top of everything, giving me a dark slot background. but the item is still in the front. i don't have an idea how to simply draw something over a slot with an item in it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.