Jump to content

ShipHeatRook

Members
  • Posts

    12
  • Joined

  • Last visited

ShipHeatRook's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Man, chill. It was my own choice to make them instances and it's just a hassle to me to redo them, but this doesn't mean I won't. I haven't been coding mods since 1.12.2, so this is still pretty new to me and I came to ask lmao.
  2. Thank you very much for your tip. My original item is an instance of a set of swords, so I don't really know about overriding a method, might as well think of another useful feature to implement ahah. But while we're at it, I've noticed that 1.16.5 Forge lets you use something like: wolf.getBrain().setMemory(MemoryModuleType.PACIFIED, true); But it doesn't seem to do much to me. Am I missing something or is this yet another dead end about easily manipulating a mob's AI?
  3. I did that now and, while the event itself runs fine, the game crashes as soon as I hit a wolf, with a NullPointerException. These two are respectively: The function that I implemented public static void woof(PlayerEntity player, World worldIn) { ItemStack stack = player.getHeldItemOffhand(); if(stack.getItem() == ModItems.COOLSWORD.get().getItem()) { List<WolfEntity> wolves = worldIn.getEntitiesWithinAABB(WolfEntity.class, new AxisAlignedBB(player.getPosX() - 20.0D, player.getPosY() - 20.0D, player.getPosZ() - 20.0D, player.getPosX() + 20.0D, player.getPosY() + 20.0D, player.getPosZ() + 20.0D)); if (wolves.isEmpty()) { return; } for (WolfEntity wolf : wolves) { if (wolf.isAggressive() && wolf.getAttackTarget() == player) { wolf.setRevengeTarget((LivingEntity) null); wolf.setAngerTarget((UUID) null); wolf.setAttackTarget((LivingEntity) null); wolf.setAngerTime(0); } } } } And this is the LivingSetAttackTargetEvent: @SubscribeEvent public static void LivingSetAttackTargetEvent (LivingSetAttackTargetEvent event) { Entity player = event.getTarget(); World worldIn = event.getEntity().world; Actions.woof((PlayerEntity) player, worldIn); } The NullPointerException is fired when the wolf ticks, apparently because it points to a vehicle (???) -- Entity being ticked -- Details: Entity Type: minecraft:wolf (net.minecraft.entity.passive.WolfEntity) Entity ID: 463 Entity Name: Wolf Entity's Exact location: -193.30, 72.00, -63.07 Entity's Block location: World: (-194,72,-64), Chunk: (at 14,4,0 in -13,-4; contains blocks -208,0,-64 to -193,255,-49), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Entity's Momentum: 0.03, -0.08, 0.03 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.guardEntityTick(World.java:601) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:407) ~[forge:?] {re:classloading} What am I doing wrong? Thanks in advance for your help.
  4. Hello, I've been working on a mod of mine, recently, and I've found it difficult to implement a certain feature of an item. What I want to do is: when the player is holding a certain item in the off-hand, even if they hit wolves, they don't attack back. At first, this looked easy with the methods setAttackTarget() and setAngerTime(), but I've found that wolves actually keep attacking the player, just with the normal texture instead of the angry, red-eyed one. Could someone help me with the code? I'll past here the function. Be aware that this has nothing to do with recognising the item in the off-hand, as I have made many other similar functions doing different things, and they've all worked: my only issue seems to be with manipulating the wolves' behaviour. else if (stack.getItem() == ModItems.COOLSWORD.get().getItem()){ List<WolfEntity> wolves = worldIn.getEntitiesWithinAABB(WolfEntity.class, new AxisAlignedBB(player.getPosX() - 20.0D, player.getPosY() - 20.0D, player.getPosZ() - 20.0D, player.getPosX() + 20.0D, player.getPosY() + 20.0D, player.getPosZ() + 20.0D)); if (wolves.isEmpty()) { return; } for (WolfEntity wolf : wolves) { if(wolf.isAggressive() && wolf.getAttackTarget() == player) { wolf.setRevengeTarget((LivingEntity)null); wolf.setAngerTarget((UUID)null); wolf.setAttackTarget((LivingEntity)null); wolf.setAngerTime(0); } return; } }
  5. Solved it by applying a DeferredRegister instead of creating a new item entirely
  6. Hello everyone! So, I've been experimenting with different things to implement in a mod, more as a way to get some practice myself. I want to make a mod that makes Vanilla milk a fluid and everything has been going smooth so far, except for one thing that's my question of the day. How do I make an existent item in Minecraft act as a BucketItem? Because I can't obviously use the milk bucket as it is, since I need to specify a bucket for my new fluid, nor I can write code like this because it would create a textureless new milk bucket. It doesn't help that in the .bucket() properties of the ForgeFlowingFluid.Properties I can only specify what the already filled bucket is, so I can collect the fluid with an empty bucket and get the vanilla milk bucket, but from then I can't place it because the vanilla item isn't recognised as a BucketItem. Any way to solve this?
  7. Did you manage to solve it? If so, would you mind sharing the code or a link to one of your tutorials? I'm trying to create a fluid mod myself, but it seems I can't get the fluid to work, like it didn't initialize at all
  8. Hello! I've been updating old and abandoned mods to the newer versions of Forge as an hobby and to learn more and more of coding myself. I've happened to run into an outdated mod that, in 1.12.2 Forge, implements a new fluid: however, it does so by calling and which apparently isn't possible for 1.16.5 Forge. I need the first one to initialize the fluid and the latter to add it to the registry and use it elsewhere in the mod, so how would I do it? Also, is there anywhere I can follow Forge's updates and changes in its classes or structures? It's not the first time I've run into a problem of this sort. Sorry if my question sounds dumb. Thanks so much!
  9. Could you tell me how to use a specific Java version when executing the command? Or do I need to uninstall every Java version until I only have Java 8? I'm on Windows 10
  10. Hello, This is my first thread here, I've read the EAQ and I hope everything will be fine. I'm trying to host a localhost Forge server (1.12.2) but, apparently, the Windows Forge Installer (version 14.23.5.2768) doesn't install everything that's required for the server to start up: first of all, it creates no "mods" folder. Secondly, I can't run the server because of some error the console shows me. Here I'll attach the log Forge prints when installing libraries and the start.bat file I use to start my server up, along with a screenshot of the server files I have in there. Thank you, I hope you'll be able to help me.start_server.bat forge-1.12.2-14.23.5.2768-installer-win.exe.log start_server.bat
×
×
  • Create New...

Important Information

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