Jump to content

Xenocorpse

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Xenocorpse

  1. So I've implemented the code but nothing happens. Where should I call the bindTexture() function? Code:
  2. Simply because I'm not familiar with how TextureManager works. Oh well, looks like I've got some researching to do.
  3. I've noticed that the function is using a TextureManager. Is there any other way to apply the texture to the model?
  4. So I have a mob whose job it is is to drop enchanted golden apples. As such, I'd like the entity itself to have the enchantment glint present like items would, except I can't just override the hasEffect() method like an item. I thought about taking the texture and using it as a second layer but I have no idea where to begin as far as the code.
  5. Thanks for your help! I simply checked that the world isn't remote before changing the variant in my function and everything works properly!
  6. I applied a DataParameter and the textures are changing properly now. However, now the getVariant() function is returning the initial registered data value and not the one set by the texture change and as such is only dropping the item of the first texture applied to the entity. private BlockPos spawnPosition; private int CLOCK; private static final DataParameter<Integer> VARIANT = EntityDataManager.createKey(EntityStinky.class, DataSerializers.VARINT); private int DELAY; private int BURP_DELAY; private int FART_DELAY; public static Random rand = new Random(); public static final ResourceLocation[] TEXTURES = { new ResourceLocation("spawnore:textures/entity/stinky/stinky0.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky1.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky2.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky3.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky4.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky5.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky6.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky7.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky8.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky9.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky10.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky11.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky12.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky13.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky14.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky15.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky16.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky17.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky18.png") }; public static final ResourceLocation hurt = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.hurt"); public static final SoundEvent HURT_SOUND = new SoundEvent(hurt); public static final ResourceLocation death = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.death"); public static final ResourceLocation fart = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.fart"); public static final SoundEvent FART = new SoundEvent(fart); public EntityStinky(World worldIn) { super(worldIn); setSize(0.7F, 1.35F); this.experienceValue = 5; this.isImmuneToFire = true; this.getAttackStrength(this); this.dataManager.register(VARIANT, Integer.valueOf(rand.nextInt(18))); this.DELAY = rand.nextInt(2399)+1; this.BURP_DELAY = rand.nextInt(3599)+1; this.FART_DELAY = rand.nextInt(599)+1; this.CLOCK = 0; } @Nullable @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { return super.onInitialSpawn(difficulty, livingdata); } public void setVariant() { int id = rand.nextInt(18); this.dataManager.set(VARIANT, id); System.out.println("VARIANT set to " + this.dataManager.get(VARIANT)); } public int getVariant() { return this.dataManager.get(VARIANT); } @Override public void onEntityUpdate() { super.onEntityUpdate(); this.CLOCK++; if (this.CLOCK == this.BURP_DELAY) //Coal Burp { if (!this.world.isRemote) this.dropItem(Items.COAL, 1); //World MUST NOT be Client Side or Ghost Items spawn this.playSound(SoundEvents.ENTITY_PLAYER_BURP, 1.0F, 1.0F); this.BURP_DELAY = rand.nextInt(3599)+this.CLOCK; } if (this.CLOCK == this.FART_DELAY) { if (this.getVariant() == 0) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_PEACH, 1); } else if (this.getVariant() == 1) { if (!this.world.isRemote) this.dropItem(Items.BLAZE_POWDER, 1); } else if (this.getVariant() == 2) { if (!this.world.isRemote) this.dropItem(Items.ROTTEN_FLESH, 1); } else if (this.getVariant() == 3) { if (!this.world.isRemote) this.dropItem(Items.MELON_SEEDS, 1); } else if (this.getVariant() == 4) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_URANIUMNUGGET, 1); } else if(this.getVariant() == 5) { if (!this.world.isRemote) this.dropItem(Items.WHEAT, 1); } else if (this.getVariant() == 6) { if (!this.world.isRemote) this.dropItem(Items.BRICK, 1); } else if (this.getVariant() == 7) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.TORCH), 1); } else if (this.getVariant() == 8) { if (!this.world.isRemote) this.dropItem(Items.EMERALD, 1); } else if (this.getVariant() == 9) { if (!this.world.isRemote) this.dropItem(Items.GOLD_INGOT, 1); } else if (this.getVariant() == 10) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.LEAVES), 1); } else if (this.getVariant() == 11) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_TITANIUMNUGGET, 1); } else if (this.getVariant() == 12) { if (!this.world.isRemote) this.dropItem(Items.APPLE, 1); //Apple Tree Seeds } else if (this.getVariant() == 13) { if (!this.world.isRemote) this.dropItem(Items.DIAMOND, 1); } else if (this.getVariant() == 14) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.SAND), 1); } else if (this.getVariant() == 15) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.COBBLESTONE), 1); } else if (this.getVariant() == 16) { if (!this.world.isRemote) this.dropItem(Items.BONE, 1); } else if (this.getVariant() == 17) { if (!this.world.isRemote) this.dropItem(Items.STRING, 1); } else { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_CHERRY, 1); } this.playSound(FART, 1.0F, 1.5F); this.FART_DELAY = rand.nextInt(599)+this.CLOCK; } if (this.CLOCK == this.DELAY) //Skin Randomizer { setVariant(); this.DELAY = rand.nextInt(2399)+this.CLOCK; } }
  7. I have an entity whose function ingame requires random textures that can be retraced to determine an item drop. (Eg: Has diamond ore texture, thus drops a diamond randomly). Everything seems to be working but sometimes the entity drops the wrong item. After some debugging, it turns out that the getEntityTexture function isn't returning the updated VARIANT variable, although the log clearly states that the VARIANT variable has changed. EntityStinky.class private BlockPos spawnPosition; private int CLOCK; public int VARIANT; private int DELAY; private int BURP_DELAY; private int FART_DELAY; public static Random rand = new Random(); public static final ResourceLocation[] TEXTURES = { new ResourceLocation("spawnore:textures/entity/stinky/stinky0.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky1.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky2.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky3.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky4.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky5.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky6.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky7.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky8.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky9.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky10.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky11.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky12.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky13.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky14.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky15.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky16.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky17.png"), new ResourceLocation("spawnore:textures/entity/stinky/stinky18.png") }; public static final ResourceLocation hurt = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.hurt"); public static final SoundEvent HURT_SOUND = new SoundEvent(hurt); public static final ResourceLocation death = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.death"); public static final ResourceLocation fart = new ResourceLocation(SpawnOre.MODID + ":mob.stinky.fart"); public static final SoundEvent FART = new SoundEvent(fart); public EntityStinky(World worldIn) { super(worldIn); setSize(0.7F, 1.35F); this.experienceValue = 5; this.isImmuneToFire = true; this.getAttackStrength(this); setVariant(); this.DELAY = rand.nextInt(2399)+1; this.BURP_DELAY = rand.nextInt(3599)+1; this.FART_DELAY = rand.nextInt(5999)+1; this.CLOCK = 0; } @Nullable @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { return super.onInitialSpawn(difficulty, livingdata); } public void setVariant() { this.VARIANT = rand.nextInt(18); System.out.println("VARIANT set to " + this.VARIANT); } public int getVariant() { return this.VARIANT; } @Override public void onEntityUpdate() { super.onEntityUpdate(); this.CLOCK++; if (this.CLOCK == this.BURP_DELAY) //Coal Burp { if (!this.world.isRemote) this.dropItem(Items.COAL, 1); //World MUST NOT be Client Side or Ghost Items spawn this.playSound(SoundEvents.ENTITY_PLAYER_BURP, 1.0F, 1.0F); this.BURP_DELAY = rand.nextInt(3599)+this.CLOCK; } if (this.CLOCK == this.FART_DELAY) { if (this.VARIANT == 0) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_PEACH, 1); } else if (this.VARIANT == 1) { if (!this.world.isRemote) this.dropItem(Items.BLAZE_POWDER, 1); } else if (this.VARIANT == 2) { if (!this.world.isRemote) this.dropItem(Items.ROTTEN_FLESH, 1); } else if (this.VARIANT == 3) { if (!this.world.isRemote) this.dropItem(Items.MELON_SEEDS, 1); } else if (this.VARIANT == 4) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_URANIUMNUGGET, 1); } else if(this.VARIANT == 5) { if (!this.world.isRemote) this.dropItem(Items.WHEAT, 1); } else if (this.VARIANT == 6) { if (!this.world.isRemote) this.dropItem(Items.BRICK, 1); } else if (this.VARIANT == 7) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.TORCH), 1); } else if (this.VARIANT == 8) { if (!this.world.isRemote) this.dropItem(Items.EMERALD, 1); } else if (this.VARIANT == 9) { if (!this.world.isRemote) this.dropItem(Items.GOLD_INGOT, 1); } else if (this.VARIANT == 10) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.LEAVES), 1); } else if (this.VARIANT == 11) { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_TITANIUMNUGGET, 1); } else if (this.VARIANT == 12) { if (!this.world.isRemote) this.dropItem(Items.APPLE, 1); //Apple Tree Seeds } else if (this.VARIANT == 13) { if (!this.world.isRemote) this.dropItem(Items.DIAMOND, 1); } else if (this.VARIANT == 14) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.SAND), 1); } else if (this.VARIANT == 15) { if (!this.world.isRemote) this.dropItem(ItemBlock.getItemFromBlock(Blocks.COBBLESTONE), 1); } else if (this.VARIANT == 16) { if (!this.world.isRemote) this.dropItem(Items.BONE, 1); } else if (this.VARIANT == 17) { if (!this.world.isRemote) this.dropItem(Items.STRING, 1); } else { if (!this.world.isRemote) this.dropItem(xeno.spawnore.init.Items.ITEM_CHERRY, 1); } this.playSound(FART, 1.0F, 1.5F); this.FART_DELAY = rand.nextInt(5999)+this.CLOCK; } if (this.CLOCK == this.DELAY) //Skin Randomizer { setVariant(); this.DELAY = rand.nextInt(2399)+this.CLOCK; } } RenderStinky.class public static final Factory FACTORY = new Factory(); public RenderStinky(RenderManager rendermanagerIn) { super(rendermanagerIn, new ModelStinky(), 0.5f); } @Override public void doRender(EntityStinky entity, double x, double y, double z, float entityYaw, float partialTicks) { super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override protected ResourceLocation getEntityTexture(EntityStinky entity) { return TEXTURES[entity.VARIANT]; } public static class Factory implements IRenderFactory<EntityStinky> { @Override public Render<? super EntityStinky> createRenderFor(RenderManager manager) { return new RenderStinky(manager); } }
  8. I appreciate it! I've got more to learn definitely, but I'm on the right track
  9. Umm... so I just began minecraft modding and I am learning TileEntities. Which tend to be VERY confusing. So I looked at minecraft code, and tutorials and made a mumbo jumbo of unorganized code that lead to this atrocious crash log. http://pastebin.com/cxn1UaF0 Okay... so here is all of my code. I honestly don't care if you copy it, because if you can understand it, you deserve it... WulfeniteBlocks.class http://pastebin.com/7H31S3bm BlockGrinder.class http://pastebin.com/beth3Y6G TileEntityGrinder.class http://pastebin.com/Z8skuLVZ ContainerGrinder.class http://pastebin.com/bjwYrXHY GrinderGui.class http://pastebin.com/4i3sbLd5 The block appears in the world see through so I can see caves. When right-clicked the crafting table gui pops up for a second, then the game crashes. I know you guys won't do it for me, but I have basic Java knowledge (and if I don't know it, I have a java textbook), so let me know of any changes I should make and kinda help guide me in creating a block with 3 slots. One that is input, one that is output, and one that is fuel. All it should do is take coal, take an ore, and grind it into a dust item I create. Thanks in advance and I apologize about my horrendous coding
×
×
  • Create New...

Important Information

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