Jump to content

Eternaldoom

Forge Modder
  • Posts

    592
  • Joined

  • Last visited

Everything posted by Eternaldoom

  1. Huh. Got it working with GL11.glDepthMask(true) after blendFunc. Thanks!
  2. Anyone? It works fine if I render it in pass 0, but transparent blocks don't appear behind it.
  3. It's done via JSON files now. For each block, you need 3 (a blockstate file, a block model file, and an item model file). There are several tutorials on this, and vanilla assets can be used as an example.
  4. Hello, I'm trying to get transparent blocks to render behind a partially transparent mob. Unfortunately, as seen here, the mob is no longer rendering correctly. Here is my code: In the entity class: @Override public boolean shouldRenderInPass(int pass) { return pass == 1; } And in my model class: public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); hatBase.render(f5); rightFinger1.render(f5); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bottom.render(f5); middle.render(f5); head.render(f5); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); rightArm.render(f5); leftArm.render(f5); rightFinger3.render(f5); rightFinger2.render(f5); leftFinger2.render(f5); leftFinger3.render(f5); leftFinger1.render(f5); hatTop.render(f5); } Does anyone know what the problem is? Thanks!
  5. Hi, I'm using the biome dictionary for mob spawning, and I'm not sure what the correct way to make mobs spawn only in the overworld, but in every biome is. This is a dimension mod so just making sure the type isn't nether or end isn't good enough. I'm currently checking the top block, but this might not work well with mods like twilight forest. Here's my code: public static void addOverworldSpawns() { for (int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) { BiomeGenBase biome = BiomeGenBase.getBiomeGenArray()[i]; if (biome != null){ if (BiomeDictionary.isBiomeOfType(biome, Type.END)) { EntityRegistry.addSpawn(EntityEnderSpider.class, 2, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityEnderTriplets.class, 1, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityEnderWatcher.class, 10, 4, 4, EnumCreatureType.monster, biome); } else if (BiomeDictionary.isBiomeOfType(biome, Type.NETHER)) { //EntityRegistry.addSpawn(EntityHellBat.class, 50, 1, 1, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityHellPig.class, 25, 5, 50, EnumCreatureType.creature, biome); EntityRegistry.addSpawn(EntityHellSpider.class, 50, 1, 1, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityScorcher.class, 7, 4, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityWildfire.class, 50, 1, 1, EnumCreatureType.monster, biome); } else if(biome.topBlock == Blocks.grass || biome.topBlock == Blocks.sand || biome.topBlock == Blocks.snow){ if (BiomeDictionary.isBiomeOfType(biome, Type.SNOWY)) { EntityRegistry.addSpawn(EntityGlacon.class, 10, 1, 1, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityFrost.class, 10, 1, 4, EnumCreatureType.monster, biome); } if (BiomeDictionary.isBiomeOfType(biome, Type.SANDY)) { EntityRegistry.addSpawn(EntityDesertCrawler.class, 10, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityAridWarrior.class, 10, 1, 4, EnumCreatureType.monster, biome); } if (BiomeDictionary.isBiomeOfType(biome, Type.OCEAN)) { EntityRegistry.addSpawn(EntityWhale.class, 1, 1, 1, EnumCreatureType.waterCreature, biome); EntityRegistry.addSpawn(EntityShark.class, 1, 1, 1, EnumCreatureType.waterCreature, biome); } if (BiomeDictionary.isBiomeOfType(biome, Type.BEACH)) { EntityRegistry.addSpawn(EntityCrab.class, 15, 4, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityKingCrab.class, 5, 4, 4, EnumCreatureType.monster, biome); } if (BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE)) { EntityRegistry.addSpawn(EntityJungleBat.class, 20, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityJungleDramcryx.class, 20, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityJungleSpider.class, 10, 1, 4, EnumCreatureType.monster, biome); } EntityRegistry.addSpawn(EntityCyclops.class, 2, 2, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityMiner.class, 1, 1, 1, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityJackOMan.class, 1, 1, 1, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityCaveCrawler.class, 20, 2, 3, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityRotatick.class, 20, 3, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityEnthralledDramcryx.class, 20, 3, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityTheEye.class, 7, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityCaveclops.class, 20, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityEnderSpider.class, 2, 1, 4, EnumCreatureType.monster, biome); EntityRegistry.addSpawn(EntityRainbour.class, 2, 1, 1, EnumCreatureType.ambient, biome); } } } }
  6. I've read that it's the only way to accomplish this. Do you know of another?
  7. Ok, I got the right arm rendering, but held items are no longer translated/rotated. Here's my code: private ModelDismemberedArm model = new ModelDismemberedArm(); @SubscribeEvent public void render(RenderPlayerEvent.Specials.Post evt) { evt.renderer.modelBipedMain.bipedRightArm.showModel = true; evt.renderer.modelBipedMain.bipedLeftArm.showModel = true; GL11.glPushMatrix(); evt.renderer.modelBipedMain.bipedRightArm.postRender(0.0625f); if(evt.entityPlayer instanceof EntityClientPlayerMP)Minecraft.getMinecraft().renderEngine.bindTexture(((EntityClientPlayerMP)evt.entityPlayer).getLocationSkin()); model.render(); GL11.glPopMatrix(); evt.renderer.modelBipedMain.bipedRightArm.showModel = false; evt.renderer.modelBipedMain.bipedLeftArm.showModel = false; } public class ModelDismemberedArm extends ModelBase { public ModelRenderer arm; public ModelDismemberedArm() { this.textureWidth = 64; this.textureHeight = 32; this.arm = new ModelRenderer(this, 40, 16); this.arm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0); } public void render() { this.arm.render(0.0625f); } }
  8. Hello, This is more of a hypothetical question (I don't have any code to show), but what's the best way to change the player's arm rotation? I imagine it would involve a RenderPlayerEvent, where you cancel the arm rendering and render new ones, but how would one get the player's skin to display on these arms? Thanks!
  9. Got it working with if(player instanceof EntityPlayerMP)((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer);
  10. Hi, I'm looking for a way to send the player's inventory from a server to the client periodically. In this case it isn't practical to update the inventory on the client too. Is there some method to do this?
  11. Here's the ChunkProvider: http://pastebin.com/6wahCzv3 The ArcanaChunk class just has methods to set blocks. Here it is: public class ArcanaChunk { private Block[] data; private byte[] meta; public ArcanaChunk() { data = new Block[32768]; meta = new byte[32768]; } public void setBlock(int x, int y, int z, Block b) { this.setBlock(x, y, z, b, 0); } public void setBlock(int x, int y, int z, Block b, int m) { data[x<<11 | z<<7 | y] = b; meta[x<<11 | z<<7 | y] = (byte)m; } public Block getBlock(int x, int y, int z) { return data[x<<11 | z<<7 | y]; } public Block[] getChunkData() { return data; } public byte[] getChunkMetadata() { return meta; } }
  12. Hi, I've created a basic mob spawner TileEntity, but I'm having a problem where the worldObj is sometimes always remote. It works fine when the block is placed, but not when it generates in the provideChunk() method in my ChunkProvider. Here's my code: public class TileEntityStupidSpawner extends TileEntity { private String entityName; private int spawnTimer; private Random rand = new Random(); @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); this.entityName = tag.getString("EntityName"); } @Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setString("EntityName", this.entityName); } @Override public void updateEntity() { super.updateEntity(); for(int n = 0; n < 3; n++) { DivineRPG.proxy.spawnParticle(this.worldObj, this.xCoord+0.5, this.yCoord+0.5, this.zCoord+0.5, "blackFlame", true, 3); } if(!this.worldObj.isRemote && this.worldObj.getClosestPlayer(this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 16D) != null) { if(this.spawnTimer > 0) this.spawnTimer--; if(this.spawnTimer == 0) { int c = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord+1, this.yCoord+1, this.zCoord+1).expand(8, 6, ).size(); if (c < { for(int i = 0; i < 4; i++) { Entity e = EntityList.createEntityByName(this.entityName, this.worldObj); if (e != null) { int x = this.xCoord + this.rand.nextInt(9) - 4; int y = this.yCoord + this.rand.nextInt(3) - 1; int z = this.zCoord + this.rand.nextInt(9) - 4; AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x+e.boundingBox.minX, y+e.boundingBox.minY, z+e.boundingBox.minZ, x+e.boundingBox.maxX, y+e.boundingBox.maxY, z+e.boundingBox.maxZ); if (this.worldObj.checkNoEntityCollision(boundingBox) && this.worldObj.getCollidingBoundingBoxes(e, boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(boundingBox)) { e.setLocationAndAngles(x, y, z, this.rand.nextInt(360), 0); this.worldObj.spawnEntityInWorld(e); } } } } this.spawnTimer = 400; } } } public void setEntityName(String name) { this.entityName = name; } } Putting print statements in updateEntity shows that sometimes it works as expected, with the worldObj being remote half the time and not the other half, but sometimes it is constantly remote. Even when it isn't, mobs are never spawned. If I make it spawn mobs on the client, they appear normally (but don't move of course).
  13. Oops. Thanks. I'd imagine you'd then send a packet?
  14. Hi, I'm trying to use raytracing for an item but when I check if the typeOfHit is an entity, its always false. Do you know why this is? Heres my code: @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { final double eyeHeight = 1.62; final double reachDistance = 300; Vec3 startPos = Vec3.createVectorHelper(player.posX, player.posY, player.posZ); if (!world.isRemote) startPos = startPos.addVector(0, eyeHeight, 0); Vec3 look = player.getLook(1.0F); Vec3 endPos = startPos.addVector(look.xCoord * reachDistance, look.yCoord * reachDistance, look.zCoord * reachDistance); MovingObjectPosition rarTrace = world.rayTraceBlocks(startPos, endPos); if (rarTrace != null) { int x = rarTrace.blockX; int y = rarTrace.blockY; int z = rarTrace.blockZ; List e = world.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(x-1, y-1, z-1, x+1, y+1, z+1)); if(Math.abs(Math.sqrt(player.posX*player.posX + player.posY*player.posY + player.posZ*player.posZ) - Math.sqrt(x*x+y*y+z*z)) < 100){ if(!player.capabilities.isCreativeMode)stack.damageItem(1, player); for(Object o : e){ if(o instanceof EntityLivingBase)((EntityLivingBase)o).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2, true)); } } } return stack; }
  15. It looks like it's related to lighting updates, as when I set hasNoSky to true the lag stops. 3 of the dimensions didn't need a sky so this fixed them, and the other 2 are mostly playable, but it'd still be nice to find a fix.
  16. https://github.com/Eternaldoom/Realms-of-Chaos/blob/1.8/com/eternaldoom/realmsofchaos/blocks/BlockSeaweed.java
  17. Before you spawn the entity, use setLocationAndAngles to set its position.
  18. Hi, I may have missed something, but I can't seem to find a way to get all the biomes registered to spawn with the BiomeManager. I'm trying to make mobs spawn in all biomes in the overworld, including modded ones (for BOP compatibility). Is there a simple way to do this?
  19. Interestingly, when I just use the nether chunk provider the game still lags.
  20. Also, update to 1.7.10 or 1.8. 1.6.4 is severely outdated.
  21. Are you sure you are using forge, or did you get FML?
×
×
  • Create New...

Important Information

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