BenGBoo
-
Posts
5 -
Joined
-
Last visited
Posts posted by BenGBoo
-
-
1 hour ago, NOctu said:
Simply get the chunk
Chunk chunk = mc.theWorld.getChunkFromChunkCoords(entity.getPosX(), entity.getPosZ());
Oh, perfect! And is there any way to disable certain mobs / hostile mobs from spawning in this specific chunk?
-
Hey all, I'm looking to make a simple mod that disables mobs from spawning in a square around a chunk. I'm new to Java (and therefore Minecraft Modding), so I poked around last night to come up with a simple Event Listener that intercepts new spawns and entity.remove()s the new entity before it can spawn. This seems inefficient because of game mechanics and ongoing spawns, so I was hoping that there was a way to simply disable spawns in a given Chunk. Is this possible?
I suppose I'm a bit overwhelmed with the vast amount of classes and methods of Forge's documentation. Anyone have a good recommendation as to where I should start? Or is my code (below) a sufficient place to start?
@SubscribeEvent public static void spawnEntity(LivingSpawnEvent event) { LivingEntity entity = event.getEntityLiving(); double deltaX = entity.getPosX() - 50; double deltaY = entity.getPosY() - 4; double deltaZ = entity.getPosZ() - 50; double distance = (Math.sqrt((deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ))); if (distance < 100) { entity.remove(); NoSpawn.LOGGER.info("DELETED"); } else { NoSpawn.LOGGER.info(distance); } }
-
14 minutes ago, Draco18s said:
They really aren't that hard to work with, but do require creating a few classes that don't seem to make a lot of sense.
You can see an example I did for TE machines here, but the process will be the same for player capabilities. The only difference is how you attach the capability (for a player, I believe you would use the AttachCapabilityEvent, though I'm not 100% sure on that)
Thank you very much! I don't know exactly what capabilities are but that's a great starting point, I'll do some research. Thanks again!
-
Hello everyone, this is my first modding attempt and I've gotten down making items, tools, blocks, and crafting recipes. I have a decent grasp on Java as a programming language but I'm still very new and unsure of Minecraft's modding. The mod I want to make relies heavily on a skill sort of system, where repeating an action like chopping down a tree gives you experience towards that skill, and leveling up increases your efficiency at that skill, so chopping just a tiny bit faster or maybe a chance at getting an extra log. I want this to be a feature of every part of the game, like a skill for farming, tree chopping, mining, etc., but I don't know exactly how to accomplish this. I was thinking that advancements would be a great way to track and see progress on these levels, but how would I go about tracking "blocks mined/xp gained", and how would I reward the player with a constant and permanent stat buff?
Thank you all very much for your help.
How can I disable hostile mob spawns in certain chunks?
in Modder Support
Posted
Awesome, thanks a bunch for the thorough answer, I really appreciate it!