Jump to content

DaryBob

Members
  • Posts

    70
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

DaryBob's Achievements

Stone Miner

Stone Miner (3/8)

3

Reputation

  1. If I delete doRender, the wolfs are invisible, so it must be the doRender method?
  2. private final Render renderCat = new RenderOcelot(Minecraft.getMinecraft().getRenderManager(), new ModelOcelot(), 0.5F); @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Pre event) { if(Minecraft.getMinecraft().thePlayer.isPotionActive(BLFeatures.fungiPotion)) { if(event.entity instanceof EntityWolf) { //System.out.println("Is this correct?"); event.setCanceled(true); renderCat.doRender(event.entity, 0F, 0F, 0F, 0F, 0F); } } }
  3. The doRender method for rendering the cat fails lol
  4. So instead checking the renderer, I checked the entity (event.entity instanceof EntityWolf), and I changed it to .Pre. It obviously spammed the line into the console log, but Minecraft crashed. Here is the log:
  5. Nice public class BLEventHandler { private final Render renderCat = new RenderOcelot(Minecraft.getMinecraft().getRenderManager(), new ModelOcelot(), 0.5F); @SubscribeEvent public void onRenderLiving(RenderLivingEvent event) { System.out.println("does this work"); //if(event.entityLiving.isPotionActive(BLFeatures.fungiPotion)) { if(event.renderer instanceof RenderWolf) { System.out.println("Is this correct?"); event.setCanceled(true); renderCat.doRender(event.entity, 0F, 0F, 0F, 0F, 0F); } //} } } I have this but it doesnt trigger the event idk why. ClientProxy: @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); BLEventHandler event = new BLEventHandler(); MinecraftForge.EVENT_BUS.register(event); FMLCommonHandler.instance().bus().register(event); BlockRenderRegister.preInit(); ItemRenderRegister.preInit(); } Main @EventHandler public void init(FMLInitializationEvent event) { this.proxy.init(event); MinecraftForge.EVENT_BUS.register(new BLEventHandler()); }
  6. Sorry for my stupidity. I use RenderLivingEvent now.
  7. So, I made a custom potion. In the LivingUpdateEvent, it checks if this potion is active, and if yes, it checks for dogs.
  8. Can I use the LivingUpdateEvent instead onFoodEaten? Since it needs to check dog entities.
  9. Oh yeah, the class 'RenderLivingEvent" exists.
  10. So theres the method onFoodEaten in my item class. Can I trigger the effect here? Can I check for entities with the class World?
  11. At the moment I can't really update it. Would be nice if you still could help me though!
  12. Hey guys! I have a question on how to switch models. There is an item in my mod, called the psychedelic shroom. Now, I want to make dogs look like cats if that shroom was eaten. After a while, the effects reset and dogs look like cats again. However, I just want them to render like a cat, their entity stays the same. Where can I switch the models (in clientside, since others who didn't eat the shroom look everything normally)? How do I access the render classes? Thanks for some ideas!
  13. Ok, so you mean if(!world.isRemote)?
  14. Hi guy's, today I made a mob. If I spawn him, he has like two textures, very weird. I also wanted him to wear an armor and an item. I thought about it, and removed the armor code. But he still was there two times.. Could you please take a look into ma' code? Thanks, Dary EntityCreator.java package netcrafter.mods.aoto.util; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.projectile.EntityEgg; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import netcrafter.mods.aoto.Main; public class EntityCreator { public static final void createEntity(Class entityClass, Render renderer, String name, EnumCreatureType type, boolean doesSpawn, int probability, int minSpawn, int maxSpawn, BiomeGenBase[] biomes, int solidColor, int spotColor, boolean hasSpawnEgg) { int id = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, name, id); EntityRegistry.registerModEntity(entityClass, name, id, Main.instance, 64, 1, true); RenderingRegistry.registerEntityRenderingHandler(entityClass, renderer); if(doesSpawn) { EntityRegistry.addSpawn(name, probability, minSpawn, maxSpawn, type, biomes); } if(hasSpawnEgg) { EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, solidColor, spotColor)); } } public static final void createEntityItem(Class entityClass, Render renderer, String name) { int id = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, name, id); EntityRegistry.registerModEntity(entityClass, name, id, Main.instance, 64, 1, true); RenderingRegistry.registerEntityRenderingHandler(entityClass, renderer); } } CommonProxy.java package netcrafter.mods.aoto.proxy; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import netcrafter.mods.aoto.Main; import netcrafter.mods.aoto.crafting.AOTOCrafting; import netcrafter.mods.aoto.entity.boss.EntityForestGuardian; import netcrafter.mods.aoto.entity.boss.EntityKingSteve; import netcrafter.mods.aoto.entity.mob.EntityTreeMinion; import netcrafter.mods.aoto.entity.projectile.EntityTreeRoot; import netcrafter.mods.aoto.init.AOTOBlocks; import netcrafter.mods.aoto.init.AOTOItems; import netcrafter.mods.aoto.render.entity.RenderForestGuardian; import netcrafter.mods.aoto.render.entity.RenderKingSteve; import netcrafter.mods.aoto.render.entity.RenderTreeMinion; import netcrafter.mods.aoto.util.EntityCreator; import netcrafter.mods.aoto.util.WorldGenRegister; import netcrafter.mods.aoto.world.gen.feature.ForestGen; public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { //Creating and registering items and blocks AOTOItems.createItems(); AOTOBlocks.createBlocks(); } public void init(FMLInitializationEvent e) { //Register crafting recipes AOTOCrafting.initCrafting(); //Create and register entities EntityCreator.createEntityItem(EntityTreeRoot.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), AOTOItems.tree_root, Minecraft.getMinecraft().getRenderItem()), "TreeRoot"); EntityCreator.createEntity(EntityKingSteve.class, new RenderKingSteve(), "KingSteve", EnumCreatureType.MONSTER, false, 0, 0, 0, null, 0xF2FF00, 0x020B12, true); EntityCreator.createEntity(EntityForestGuardian.class, new RenderForestGuardian(), "ForestGuardian", EnumCreatureType.MONSTER, false, 0, 0, 0, null, 0xC219A3, 0x19C238, true); EntityCreator.createEntity(EntityTreeMinion.class, new RenderTreeMinion(), "TreeMinion", EnumCreatureType.MONSTER, false, 0, 0, 0, null, 0xA85236, 0x6E260E, true); //Register world generators WorldGenRegister.registerGenerators(); } public void postInit(FMLPostInitializationEvent e) { } public void registerRenders() { } } EntityKingSteve.java package netcrafter.mods.aoto.entity.boss; import java.util.Random; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveTowardsTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import netcrafter.mods.aoto.Reference; import netcrafter.mods.aoto.entity.mob.EntityTreeMinion; import netcrafter.mods.aoto.entity.projectile.EntityTreeRoot; import netcrafter.mods.aoto.init.AOTOItems; public class EntityKingSteve extends EntityMob implements IBossDisplayData { private int attackCounter = 0; private int deathTicks = 0; private int regenTime = 0; public EntityKingSteve(World worldIn) { super(worldIn); this.setSize(1.5F, 7.0F); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 2.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 1.0D, (float) 2.0D)); this.tasks.addTask(3, new EntityAIWander(this, 1.0D)); this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(5, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(360.0F); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.26D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(15.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(2.0D); } protected void func_180481_a(DifficultyInstance p_180481_1_) { super.func_180481_a(p_180481_1_); this.setCurrentItemOrArmor(0, new ItemStack(AOTOItems.long_diamond_sword)); this.setCurrentItemOrArmor(1, new ItemStack(AOTOItems.beard)); } @Override protected String getLivingSound() { return Reference.MOD_ID + ":mob.forestguardian.living"; } @Override protected String getHurtSound() { return Reference.MOD_ID + ":mob.forestguardian.hurt"; } @Override protected String getDeathSound() { return Reference.MOD_ID + ":mob.forestguardian.death"; } /** Calls this method if the mob is dead */ @SuppressWarnings("unchecked") @Override protected void onDeathUpdate() { //Increments deathTicks every tick ++this.deathTicks; //Creates a huge explosion if the value of deathTicks is between 180 and 200 if (this.deathTicks >= 180 && this.deathTicks <= 200) { final float f = (this.rand.nextFloat() - 0.5F) * 1.5F; final float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F; final float f2 = (this.rand.nextFloat() - 0.5F) * 1.5F; //Spawns the explosion into the world this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + f, this.posY + 2.0D + f1, this.posZ + f2, 0.0D, 0.0D, 0.0D); } int i; int j; if (!this.worldObj.isRemote) { if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { i = 30; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; //Spawns xp orbs while i is bigger than zero this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } } //Rotates the mob this.moveEntity(0.0D, 0.10000000149011612D, 0.0D); this.renderYawOffset = this.rotationYaw += 20.0F; //Checks if the death ticks reached 200 if (this.deathTicks == 200 && !this.worldObj.isRemote) { i = 20; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; //Spawns xp orbs while i is bigger than 0 this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } //Drops an item this.entityDropItem(new ItemStack(AOTOItems.gem, 1, 1), 0.5F); //Spawns a lighting bolt into the world this.worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, this.posX + 6, this.posY + 6, this.posZ)); //Sets this mob dead super.setDead(); } } @Override protected void dropFewItems(boolean par1, int par2) { final ItemStack var2 = new ItemStack(AOTOItems.crown); EnchantmentHelper.addRandomEnchantment(this.rand, var2, 5); this.entityDropItem(var2, 0.0F); } @Override public EntityItem entityDropItem(ItemStack par1ItemStack, float par2) { final EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + par2, this.posZ, par1ItemStack); entityitem.motionY = -2.0D; entityitem.setPickupDelay(60); if (this.captureDrops) { this.capturedDrops.add(entityitem); }else{ this.worldObj.spawnEntityInWorld(entityitem); } return entityitem; } @Override public void onLivingUpdate() { if(regenTime++ > 10) { regenTime = 0; this.heal(4); } super.onLivingUpdate(); } } RenderKingSteve.java package netcrafter.mods.aoto.render.entity; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerHeldItem; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.util.ResourceLocation; import netcrafter.mods.aoto.Reference; import netcrafter.mods.aoto.entity.boss.EntityKingSteve; import netcrafter.mods.aoto.entity.mob.EntityTreeMinion; import netcrafter.mods.aoto.model.ModelKingSteve; import netcrafter.mods.aoto.model.ModelTreeMinion; public class RenderKingSteve extends RenderBiped { public RenderKingSteve() { super(Minecraft.getMinecraft().getRenderManager(), new ModelKingSteve(), 0); this.addLayer(new LayerHeldItem(this)); LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { protected void func_177177_a() { this.field_177186_d = new ModelBiped(1.0F); this.field_177189_c = new ModelBiped(0.5F); } }; this.addLayer(layerbipedarmor); } @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return new ResourceLocation(Reference.MOD_ID, "textures/models/king_steve.png"); } private void renderEntity(EntityKingSteve entity, double x, double y, double z, float yaw, float partialTickTime) { super.doRender(entity, x, y, z, yaw, partialTickTime); } @Override public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { BossStatus.setBossStatus((IBossDisplayData) par1EntityLiving, false); super.doRender(par1EntityLiving, par2, par4, par6, par8, par9); } } ModelKingSteve.java package netcrafter.mods.aoto.model; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelKingSteve extends ModelBiped { ModelRenderer head; ModelRenderer body; ModelRenderer rightarm; ModelRenderer leftarm; ModelRenderer rightleg; ModelRenderer leftleg; public ModelKingSteve() { textureWidth = 64; textureHeight = 32; head = new ModelRenderer(this, 0, 0); head.addBox(-4F, -8F, -4F, 8, 8, ; head.setRotationPoint(0F, 0F, 0F); head.setTextureSize(64, 32); head.mirror = true; setRotation(head, 0F, 0F, 0F); body = new ModelRenderer(this, 16, 16); body.addBox(-4F, 0F, -2F, 8, 12, 4); body.setRotationPoint(0F, 0F, 0F); body.setTextureSize(64, 32); body.mirror = true; setRotation(body, 0F, 0F, 0F); rightarm = new ModelRenderer(this, 40, 16); rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); rightarm.setRotationPoint(-5F, 2F, 0F); rightarm.setTextureSize(64, 32); rightarm.mirror = true; setRotation(rightarm, 0F, 0F, 0F); leftarm = new ModelRenderer(this, 40, 16); leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); leftarm.setRotationPoint(5F, 2F, 0F); leftarm.setTextureSize(64, 32); leftarm.mirror = true; setRotation(leftarm, 0F, 0F, 0F); rightleg = new ModelRenderer(this, 0, 16); rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); rightleg.setRotationPoint(-2F, 12F, 0F); rightleg.setTextureSize(64, 32); rightleg.mirror = true; setRotation(rightleg, 0F, 0F, 0F); leftleg = new ModelRenderer(this, 0, 16); leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); leftleg.setRotationPoint(2F, 12F, 0F); leftleg.setTextureSize(64, 32); leftleg.mirror = true; setRotation(leftleg, 0F, 0F, 0F); } 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); head.render(f5); body.render(f5); rightarm.render(f5); leftarm.render(f5); rightleg.render(f5); leftleg.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } Well now, that I pasted the model, maybe it renders it two times, because it is already a modelbiped?
  15. Hi I made a dimension, which has a room in every chunk. Every portal block has an id. It will teleport you to that room which has the same id as the portal. It works with players, but if I teleport a mob, it disappears, becuz its far and the chunk was not loaded. If I go in there first, then the mobs, they will teleport to that far chunk. So is there any method to force load the chunk, so that if an entity travels far it doesnt get removed?
×
×
  • Create New...

Important Information

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