
BadBichShaquonda
Members-
Posts
14 -
Joined
-
Last visited
Everything posted by BadBichShaquonda
-
Using the DifficultyChangeEvent
BadBichShaquonda replied to BadBichShaquonda's topic in Modder Support
Can this potentially be a forge bug? EDIT: I was also trying to figure out how/where in the code, zombies despawn when changing to peaceful. Couldn't find it tho -
Hi everyone, I'm having issues using this event. All I did was add a simple logger to it, and it does not log when I change difficulty through commands in game (/difficulty peaceful), while other events do log properly. Here is the code: package com.eon.sharkmod.events; import com.eon.sharkmod.SharkMod; import net.minecraft.world.Difficulty; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.event.DifficultyChangeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = SharkMod.MOD_ID, bus = Bus.FORGE) public class DifficultyChangeEventHandler { @SubscribeEvent public static void difficultyChangeEvent(DifficultyChangeEvent event) { SharkMod.LOGGER.info("testing"); Difficulty newDiff = event.getDifficulty(); SharkMod.LOGGER.info("Hey! New dif: " + newDiff + ", old dif: " + event.getOldDifficulty()); } } Neither of these logs print. Can anyone point me in the right direction? I've tried changing the bus to MOD, even tho I knew it was dumb (it didn't work). I was also maybe thinking that this event only fires if the difficulty is changed through actual java code (instead of commands), so I tried this: this.entity.world.getWorldInfo().setDifficulty(Difficulty.HARD); First, this did change the difficulty but did not fire the event. I also put this line in the tick() method, and then launched my game and tried changing difficulty with commands all while difficulty was changing with the every tick, but nothing logged. What am I doing wrong? Is there some other way of knowing when the difficulty changes? I'd like to adjust my shark's ai goals and stats Thank you!
-
The other solution is to just make the boat drop as normal, or not make it drop at all. I may just make it drop as normal since that will just solve everything. Actually no it won't. Because the shark will only be able to break vanilla boats. The check I'm using is if(enemy.isPassenger() && enemy.getRidingEntity().getClass() == BoatEntity.class) { BoatEntity boat = (BoatEntity) enemy.getRidingEntity(); boat.entityDropItem(boat.getItemBoat()); boat.remove(); } Honestly I guess I'll just make it vanilla compatible, and the shark wont be able to break other mods' boats. and if someone wants it to be compatible, i'll make it compatible with some specific mods XD Thanks XD
-
This mod has a bamboo boat: https://github.com/bageldotjpg/Bamboo-Blocks/tree/master/src/main/java/com/pugz/bambooblocks/core In https://github.com/bageldotjpg/Bamboo-Blocks/blob/master/src/main/java/com/pugz/bambooblocks/core/BambooBlocksRegistry.java : public static final RegistryObject<Item> BAMBOO_BOAT = HELPER.createBoatItem("bamboo", BAMBOO_PLANKS); I'm guessing then that any boat that would extend the boat item class would work in my favor? The HELPER variable is of type RegistryHeper.
-
So then there would be no way of using loot modifiers to get this to work, I assume? Not sure what you mean by this, but essentially what I want is the boat to drop its wooden materials when my shark "breaks" it. Would there be any other way, java-wise, that I could get the type of the boat and then make it drop its planks, whether the boat is from some other mod or not? Thank you
-
Hi guys, I'm making a new shark entity and I wanted to make it so that if my shark breaks any kind of boat, modded or not, the respective wood drops with some sticks. For example, if a shark breaks an obsidian wood boat from some random obsidian boat mod, it should drop obsidian wood planks and two sticks (complete fictional mod). Before I ask my questions, I want to point out a couple things: when a player breaks a boat, the boat item is dropped from the Minecraft code itself (no loot tables involved), and it is then destroyed using its .remove() method. Minecraft determines what kind of boat to drop using a switch block. I'm unsure how is it done in other mods, probably using a loot table, but anyway, just wanted to point this out. Additionally, what I'm doing in my shark entity, specifically in my SharkAttackGoal, is the following: 0. ... lots of code: here's my GitHub: https://github.com/BadBichShaquonda/shark-mod/tree/dr_shtroumphi ... 1. Check if the shark is close enough to attack 2. If it is, check if the entity that is being attacked is in a boat 3. If it is, call the boat method to drop an Item and then the boat method to remove the boat, exactly like vanilla Minecraft 4. This essentially means that my shark has no actual link to the boat, which had to do with one of the questions I will ask My questions are.. 1. Is this even possible? My java programming skills are a lot better than my JSON loot table skills Assuming it is possible, then: 2. Are there any good guides for making loot modifiers? I know there is a guide for global loot modifiers which does not look too complicated. 3. I know what tags are, so would I use tags in this case to get modded wood from modded boats, or is this completely wrong? What should I use? 4. Because my shark has no link to the boat, what condition would I have to add in the JSON for this? I know there is 'killer', but is my shark actually considered the killer? If not, how can I make it so? 5. Would I have to make a new condition, or function? How would I go about doing either of those things? Assuming it isn't possible, then what would be better? Making my own loot modifiers for simple Minecraft boats, or just doing it in java as the normal Minecraft code does..? Any help here would be appreciated, as I don't quite know the limitations of loot tables. Have a great day, and thank you for your reply!
-
[1.15.2] Help with Mob Movement (Please ;_;)
BadBichShaquonda replied to BadBichShaquonda's topic in Modder Support
I'll definitely try this. Thank you for your kind words. I'm probably going to copy paste all of the entity methods and put prints literally everywhere and we shall see in what order things are called. -
[1.15.2] Help with Mob Movement (Please ;_;)
BadBichShaquonda replied to BadBichShaquonda's topic in Modder Support
Hey, good morning Sorry about not posting my code at the beginning. I guess what I was looking for was more explanations than actual code. Here is my github: https://github.com/BadBichShaquonda/shark-mod/tree/dr_shtroumphi Nothing much to see, but basically I created my own SharkMovementHelperController class in client/entity/ai (my mob class is SharkEntity in entities/). The code in there is vanilla dolphin's MoveHelper. I tried screwing around with the dolphin values, but setting them to constant values every tick changed nothing visible. In hindsight, I know this was not the best idea because those values clearly change on every tick, but I just wanted to try some stuff out of desperation. Here are two things I've realized: 1. The reason all aquatic animals have their own 'helper' version of MovementController is because they also move on the Y axis (pretty obvious, I know) 2. Yaw, Pitch and Roll - I didn't know what these words meant in the code (I'm french origin) (for example: mob.rotationYaw, mob.rotationPitch). I thought it was something like, rotation of the Y axis on aw, and never did I think to google search the terms. Well, today I did, and found this wonderful wikipedia page (https://en.wikipedia.org/wiki/Yaw_(rotation)) that explains everything. So, all this to say that these types of rotations can be seen in the aquatic animal movement helper controllers, and basically mean that they can rotate on more axes (obviously, and this coincides with point 1, but at least now I know what those variables are for!) Another thing I will add is that I got my best friend on board who is a mcgill mathematician (so I have that going for me, woohoo!), but he doesn't know too much code. Today we setup the modding environment on his computer and he seems excited to help me figure out what's going on in the movement controllers, and how we can similarly make our own. What I need help with is figuring out the link between all the movement classes/methods, and in what order the framework calls them and what the framework provides. I understand that you may not know this, but essentially, this is what I need. Any information here would help, such as how Paths and PathNavigators and PathFinders interact with each other, and what that group of Path classes has to do with MovementControllers and Movement-related goals. Also, how does having a path navigator work? Does the framework randomly decide whether it's getting a Path or moving with the base movement controller? Thank you for your help, I could not do this without this community. Any tip would be appreciated. Have a great day -
[1.15.2] Help with Mob Movement (Please ;_;)
BadBichShaquonda replied to BadBichShaquonda's topic in Modder Support
I do have a basic understanding of math (Calculus 1 level) and I took Linear algebra 2 years ago, so I know what Vectors are and mostly how they work. My issue is that I have no idea how they are applied. Can you help me out? -
Hey guys, As you can probably tell by the title, I'm feeling very demotivated right now. This is because I have spent countless hours tinkering with and trying to figure out movement controllers. My friend and I went through the dolphin's movehelper and all we got from it is that it calculates a whole bunch of angles using arctangeants and sets them to some properties that I don't even know what they do. Basically, what I'm asking is this: can anyone here explain to me (here, on discord [BadBichShaquonda#4858], anywhere) how movement controllers work, as well as any of the following classes: PathNavigator, Path, PathFinder any any movement-related goals. These classes all seem to be related to each other. I can share my github if needed, although I don't really have anything on it other than me failing hahaha Any help would be greatly appreciated; there is so much extending going on, properties all over the place, and the frameworks calls some of their methods in some specific order which makes things even more complex. I've been coding for the past 4 years and I've never seen something this complex. Like I said, any help would be appreciated, and honestly I would pay for help at this point. Here's what (I THINK) I've figured out so far: MovementController does not actually move the mob, rather it tells it how to move IF it were to move. How it does this is beyond me. Movement-related goals seem to somehow get the mob to move using PathNavigator potentially? If a mob has a PATH, then the MovementController logic is not applied until the PATH is complete. I'm thinking that I would somehow need to create a Path/PathNavigator/PathFinder, but I'm not sure which one, nor what each do Vectors vectors vectors. I tried using the entity's travel method by supplying a vector I created out of the blue, but that just made my entity go in random directions This may also work, but because it wasn't too clear and I wanted to try using the other 300 classes, I gave up on this I also tried this using the base MovementController's setMoveTo, but that did almost the same thing Sorry for the long and rather desperate post. I feel like I'm running out of options and I really don't want to give up. Thank you for your help
-
Hi guys, I'm trying to implement a shark. I'm having a few issues, can anyone help me out? As it stands, my "shark" is using the dolphin model without the texture. I'm trying to make my shark attack nearby entities, and attack an entity if it is attacked. First, I tried making a mob that extends MonsterEntity and gave it some attacking goals from the spider / zombie class. Didn't seem to do anything. Now, my shark extends WaterMobEntity (similar to a dolphin) and swims kind of wonkily, but ok (it mostly sticks to the ground). Just now I tried adding some "NearestAttackableTargetGoal" for Player and AbstractFishEntity, but it wasn't working, until it crashed just now. Does anyone have any advice or help for coding aggressive mobs? I'm thinking it may have crashed because I targeted the abstract class, but I assumed it was target all children of it. Probably wrong of me. I also changed my code from the abstract class to TropicalFishEntity, the game didn't crash, but it did not attack anything. The stack trace: https://pastebin.com/Zcrm7WVF Is it possible that it's because it doesn't have an attack animation? Or because I'm missing some base attack method? Here's my repo: https://github.com/BadBichShaquonda/shark-mod/tree/dr_shtroumphi