Jump to content

TheAwesomeGem

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by TheAwesomeGem

  1. I managed to solve it by myself. It seems to be a bug with Minecraft itself.
  2. I even changed step height but that didn't fix it either. Seems like riding entities are broken.
  3. So I have a custom entity that extends from the EntityMob class and I made it ride a horse. But for some reason, it doesn't want to step down a block. But it can set-up on a block. What am I missing here?
  4. Well, managed to solve it by myself using string delimiter. Is there any string length limit for a getStringArray?
  5. This is the data container I have: public static Map<Integer, List<Pair<String, Integer>>> warriorEquipmentMainHandMap = new HashMap<Integer, List<Pair<String, Integer>>>() {{ put(1, new ArrayList<Pair<String, Integer>>() {{ add(new Pair<>("wooden_axe", 70)); add(new Pair<>("stone_axe", 30)); }}); put(2, new ArrayList<Pair<String, Integer>>() {{ add(new Pair<>("wooden_axe", 20)); add(new Pair<>("stone_axe", 70)); add(new Pair<>("iron_axe", 10)); }}); put(3, new ArrayList<Pair<String, Integer>>() {{ add(new Pair<>("stone_axe", 70)); add(new Pair<>("iron_axe", 30)); }}); }}; Basically I want to turn that into this on the config: warriorequipmentmainhand{ 1{ "wooden_axe":70, "stone_axe":30 } 2{ "wooden_axe":20, "stone_axe":70, "iron_axe":10 } 3{ "stone_axe":70, "iron_axe":30 } } How would I go about doing that since I don't see a list of keyvalpair on configuration?
  6. I ended up doing this. Not sure if it's more efficient but it's less code to write. @SubscribeEvent public void onLivingSpawnCheck(LivingSpawnEvent.CheckSpawn e) { if(e.getWorld().isRemote) return; if(!(e.getEntityLiving() instanceof EntityUndead)) return; int range = 64; float minX = e.getX() - range; float minY = e.getY() - range; float minZ = e.getZ() - range; float maxX = e.getX() + range; float maxY = e.getY() + range; float maxZ = e.getZ() + range; List<EntityUndead> entityUndeadList = e.getWorld().getEntitiesWithinAABB(EntityUndead.class, new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ)); if(entityUndeadList.size() > 5) e.setResult(Result.DENY); }
  7. This is what I have so far @SubscribeEvent public void onPreEntitySpawn(PotentialSpawns e) { if(e.getWorld().isRemote) return; List<SpawnListEntry> spawnListEntryList = e.getList(); Iterator<SpawnListEntry> spawnListEntryIterator = spawnListEntryList.listIterator(); while(spawnListEntryIterator.hasNext()) { SpawnListEntry spawnListEntry = spawnListEntryIterator.next(); if(spawnListEntry.entityClass.equals(EntityUndead.class)) { Chunk chunk = e.getWorld().getChunkFromBlockCoords(e.getPos()); int undeadCount = 0; ClassInheritanceMultiMap<Entity>[] entityInheirtanceMapList = chunk.getEntityLists(); for(ClassInheritanceMultiMap<Entity> entityInheritanceMap : entityInheirtanceMapList) { Iterable<EntityUndead> entityList = entityInheritanceMap.getByClass(EntityUndead.class); for (EntityUndead ignored : entityList) undeadCount++; } System.out.println(e.getPos().toString() + " Undead Count: " + undeadCount); } } } The reason I need this is to control the number of my own custom entity on a chunk. So what I am trying to achieve here so removing PotentialSpawn of my custom creature on a chunk that has surpassed the max number of my custom entity per chunk. However, it doesn't look clean at all and is pretty inefficient. Any other ways to achieve the same thing?
  8. Where does that rendering take place at? I can see the vanilla code and replicate it.
  9. I have a custom entity and I want to add an extra information under the player nametag. How would I go about doing that?
  10. Interesting. How do you fix an issue like that? Use Minecraft.getMinecraft() only on the client proxy?
  11. So on the code above, it wouldn't crash the server because of the isRemote check. But I see it as a good example when to use isRemote.
  12. Aaah I see. Thanks for the warning. On that case, we will have to use @SideOnly BTW world.isRemote is always false on dedicated server isn't it?
  13. What do you mean? Can you give me an example.
  14. Final question, is it bad to almost do the world.isRemote check just to make sure whatever logic is only being applied to the server?
  15. Is there like documentation on which events/class gets run where? Like the item/block/entity class. Also, is capabilities clientside or serverside?
  16. Does all the classes in my mod load for both the server and client?(excluding the client proxy, renderers and models are only loaded in the client) I know I can use world.isRemote to choose which side I want to work with. Does all the events are called for both client and server? Does the Item, Block, Entity, AI class gets loaded and called for both the client and server? How do you know which class gets called for the server, client or both?(Just so I know when to use world.isRemote so I don't get desync)
  17. That make sense. Is there anyway to disable entity updates on the end though? I remember disabling the end with cauldron and it worked fine. However, I do not wish to use that.
  18. I am glad I didn't miss a config for that. Do you know what function I can use on my mod to disable the whole end dimension(no chunk updates or entity updates) including the region files?
  19. I can't find a way to disable the end. How would I go about removing that dim?
  20. Doesn't seem like their is a way to increase the zombie's speed in water since movement speed is based on the land. However, maybe altering velocity would work. But I don't know if it's a way to go.
  21. How do I increase the movement speed of zombies when they are on the water? I tried this but it did not work. @SubscribeEvent public void onLivingEntityUpdate(LivingEvent.LivingUpdateEvent e) { Entity entity = e.entity; if(e.entity instanceof EntityLiving) { if(e.entity instanceof EntityZombie) { EntityZombie zombie = (EntityZombie) entity; if(zombie.isInWater()) { if(zombie.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() != 2.0) { zombie.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.0); } } else { if(zombie.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() != 0.23) { zombie.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23); } } } } }
  22. Thanks guys! I will try to figure out how to work it out, now that I know how the system works.
  23. Can you possible change textures in real-time? I have mine changing it on interact, but it doesn't change the texture. What's a good method to change the textures in real-time?
  24. Is there actually any way to do it?
  25. Really frustrating that I cannot do this without getting any problems.
×
×
  • Create New...

Important Information

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