Jump to content

nil

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by nil

  1. Nevermind it's just the model that's not working correctly, it does shoot.
  2. import java.util.Random; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class EntityPlagueArcher extends EntitySkeleton { public EntityPlagueArcher(World worldIn) { super(worldIn); } @Override protected EntityArrow getArrow(float p_190726_1_) { Random rand = new Random(); EntityArrow entityarrow = super.getArrow(p_190726_1_); if (rand.nextInt(2) == 0) { ItemStack item = new ItemStack(Items.TIPPED_ARROW,1,14); ((EntityTippedArrow)entityarrow).setPotionEffect(item); return entityarrow; } else { return entityarrow; } } } Sry if it's not color coded i don't know how you did that last time.
  3. Using this: for (EntityAITaskEntry task : this.tasks.taskEntries) { if (task.priority == 1) { this.tasks.taskEntries.remove(task); } } causes the entity to not spawn with the following Error Message: [23:55:37] [Server thread/ERROR] [FML]: Encountered an exception while constructing entity 'jmyst:ibex' java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_211] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_211] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_211] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_211] at net.minecraftforge.fml.common.registry.EntityEntryBuilder$ConstructorFactory.apply(EntityEntryBuilder.java:306) [EntityEntryBuilder$ConstructorFactory.class:?] at net.minecraftforge.fml.common.registry.EntityEntryBuilder$ConstructorFactory.apply(EntityEntryBuilder.java:292) [EntityEntryBuilder$ConstructorFactory.class:?] at net.minecraftforge.fml.common.registry.EntityEntry.newInstance(EntityEntry.java:68) [EntityEntry.class:?] at net.minecraft.entity.EntityList.createEntityByIDFromName(EntityList.java:244) [EntityList.class:?] at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:242) [ItemMonsterPlacer.class:?] at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:98) [ItemMonsterPlacer.class:?] at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:876) [ForgeHooks.class:?] at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:200) [ItemStack.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:507) [PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) [CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) [CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_211] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_211] at net.minecraft.util.Util.runTask(Util.java:53) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] Caused by: java.util.ConcurrentModificationException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(Unknown Source) ~[?:1.8.0_211] at java.util.LinkedHashMap$LinkedKeyIterator.next(Unknown Source) ~[?:1.8.0_211]
  4. 1. When i spawned the entity into the world i noticed that it did not carry a bow. Is it possible to use something like AbstractSkeleton.setEquipmentBasedOnDifficulty to set the bow or do i have to manually add the bow to the entities mainhand? 2.Since i want the entity to move like a normal skeleton would, where can i find the rotationAngle values used by the original?
  5. Thx. I had hoped that i could avoid iterating over that but ok.
  6. Both this.tasks.removeTask() and this.tasks.EntityAITasks.remove() don't work with a new instance of the task i want to remove. How do i (or do i need to) get the specific instances?
  7. Do you mean super.initEntityAI() ? If i use this, it will still run tasks deleted from the overridden method. Basically, what i'm trying to do is to remove this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); And have it attack the player instead.
  8. package JophiMa.myst.entity; import javax.annotation.Nullable; import JophiMa.myst.util.handlers.LootTableHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIEatGrass; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITempt; import net.minecraft.entity.ai.EntityAIWanderAvoidWater; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityIbex extends EntitySheep { private float ageWidth = 0.9F; private float ageHeight = 1.4F; private int angerLevel; private EntityAIEatGrass entityAIEatGrass; public EntityIbex(World worldIn) { super(worldIn); this.setSize(0.9F, 1.4F); this.setSheared(true); } @Override public void eatGrassBonus() { if (this.isChild()) { this.addGrowth(10); } } /*@Override protected void initEntityAI() { this.entityAIEatGrass = new EntityAIEatGrass(this); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.WHEAT, false)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); this.tasks.addTask(5, this.entityAIEatGrass); this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); //this.targetTasks.addTask(1, new EntityIbex.AIHurtByAggressor(this)); //this.targetTasks.addTask(2, new EntityIbex.AITargetAggressor(this)); }*/ @Nullable @Override protected ResourceLocation getLootTable() { return LootTableHandler.ENTITIES_IBEX; } @Override public EntitySheep createChild(EntityAgeable ageable) { EntityIbex entityibex1 = new EntityIbex(this.world); entityibex1.setGrowingAge(-40); return entityibex1; } /*private void becomeAngryAt(Entity entity) { this.angerLevel = 400 + this.rand.nextInt(400); if (entity instanceof EntityLivingBase) { this.setRevengeTarget((EntityLivingBase)entity); } } public boolean isAngry() { return this.angerLevel > 0; } static class AIHurtByAggressor extends EntityAIHurtByTarget { public AIHurtByAggressor(EntityIbex entity) { super(entity, true); } protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn) { super.setEntityAttackTarget(creatureIn, entityLivingBaseIn); if (creatureIn instanceof EntityIbex) { ((EntityIbex)creatureIn).becomeAngryAt(entityLivingBaseIn); } } } static class AITargetAggressor extends EntityAINearestAttackableTarget<EntityPlayer> { public AITargetAggressor(EntityIbex entity) { super(entity, EntityPlayer.class, true); } /** * Returns whether the EntityAIBase should begin execution. */ /*public boolean shouldExecute() { return ((EntityIbex)this.taskOwner).isAngry() && super.shouldExecute(); } }*/ } Btw the reason that it's identical is because i tried to see if exactly copying the function from the extended class would fix this issue. Sadly, it doesn't.
  9. The Crash report is added as a file below, this is the part of the class which causes the crash: @Override protected void initEntityAI() { this.entityAIEatGrass = new EntityAIEatGrass(this); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.WHEAT, false)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); this.tasks.addTask(5, this.entityAIEatGrass); this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); //this.targetTasks.addTask(1, new EntityIbex.AIHurtByAggressor(this)); //this.targetTasks.addTask(2, new EntityIbex.AITargetAggressor(this)); } crash-2019-10-30_17.42.26-server.txt
  10. When i tried to Override protected void initEntityAI() the game crashes upon entering a world containing my custom entity. The Error is the following : Entity's Vehicle: ~~ERROR~~ NullPointerException: null How do i fix this?
  11. In my WorldEvents class, i want to implement a damage reduction and need to filter out if the hurt entity is the player. I tried this: if(event.getEntityLiving().getClass().equals(EntityPlayer.class)) and this: if(event.getEntityLiving().getClass() == EntityPlayer.class but it refuses to go into the if. How do i get this to work?
  12. I'm trying to manually edit the position values of some model parts, but i can't find where they are stored. Am i overlooking them in the model class or are they stored somewhere else?
  13. Both things actually work: Apparently postrendering a part makes the part rendered afterwards "connected" like in salvestroms example, however i'm not having any issues like this: Also you can do this: By calling addChild in the render method however it still rescales the part.
  14. do you mean setting the model parts rotationPoints and rotationAngles to the parent parts?
  15. Is it possible to add a model part to another model parts child list while keeping its custom scale? If not is there another way to make this part turn in sync with the other part?
  16. Ok thx everything is working now.
  17. I tried using this in my CustomPotions class however this doesn't work: @Override public void performEffect(EntityLivingBase entityLivingBaseIn, int amplifier) { if (entityLivingBaseIn.isPotionActive(MystPotions.PLAGUE_EFFECT)) { if(!entityLivingBaseIn.isEntityUndead()) { if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth() * 0.5 && entityLivingBaseIn.world.getDifficulty() != EnumDifficulty.EASY) { entityLivingBaseIn.attackEntityFrom(DamageSource.MAGIC, 1.0F); } } else { if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth()) { entityLivingBaseIn.heal(1.0F); } } } } NOTE: i am not using a different class per potion so isPotionActive or sth similar has to be checked
  18. I'm going of off tutorials on youtube to find my way around the minecraft classes and this is one of the ways shown in the vid. I just changed it and put it directly into the potion init class and everything works fine now. However i still need access to the player's hp for this code: How do i get the player/entity affected by this effect?
  19. My code: /** * defines what the plague effect does and clears the modifiers after the effect has ended * @param event : world events */ @SubscribeEvent public static void plaguePotionActive(PlayerTickEvent event) { boolean isActive = false; if (event.player.isPotionActive(MystPotions.PLAGUE_EFFECT)) { isActive = true; } if (isActive == true) { if(MystPotions.alreadyActive == false) { String UUID = MathHelper.getRandomUUID().toString(); MystPotions.PLAGUE_EFFECT.registerPotionAttributeModifier(SharedMonsterAttributes.MOVEMENT_SPEED, UUID, -0.15000000596046448D * 0.5, 2); MystPotions.PLAGUE_EFFECT.registerPotionAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED, UUID, -0.10000000149011612D * 0.5, 2); MystPotions.alreadyActive = true; } if (event.player.getHealth() > event.player.getMaxHealth() * 0.5 && event.player.world.getDifficulty() != EnumDifficulty.EASY) { event.player.attackEntityFrom(DamageSource.MAGIC, 1.0F); } } else { //Map<IAttribute, AttributeModifier> tmp = MystPotions.PLAGUE_EFFECT.getAttributeModifierMap(); //Multimap<String, AttributeModifier> modifiers = (Multimap) tmp; //event.player.getAttributeMap().removeAttributeModifiers(modifiers); //MystPotions.PLAGUE_EFFECT.removeAttributesModifiersFromEntity(event.player, (AbstractAttributeMap) tmp, 2); MystPotions.alreadyActive = false; } } Using the code that is in comments above causes the game to crash as i can't cast a Map to an AbstractAttributeMap. What methods can i use to only remove the modifiers of this potion?
  20. No, there are no methods that use isChild in my model class. Is it also possible to use a different model for the child while still using the resizing of the body provided by Minecraft ?(i want to use the same texture but less model parts)
  21. I tried doing this by changing the rotationpoint values, which simply makes the part not render. Since i'm using a custom scale on these parts, i can't set it as a child of the head without reshaping the part. Is it possible to add the model part to the child list without changing the parts scale? If not, is there another way to synch the rotation of the part with the rotation of the head?
  22. Does this not set the boolean to true?: entityibex1.setGrowingAge(-40); Do you mean setting it as a ModelQuadruped in some way? It only extends RenderLiving.
  23. I'm having issues getting the babies of the animal to spawn resized like with other animals. I'm currently using the code below: @Override public EntitySheep createChild(EntityAgeable ageable) { //EntityIbex entityibex = (EntityIbex)ageable; EntityIbex entityibex1 = new EntityIbex(this.world); entityibex1.setGrowingAge(-40); return entityibex1; } Using this.setSize() doesn't work either. What am i missing?
×
×
  • Create New...

Important Information

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