MrCrayfish's Gun Mod

MrCrayfish's Gun Mod

25M Downloads

Make guns being disguised code-side as crossbows/bows

TheSatanSpartan opened this issue ยท 3 comments

commented

Mods like Overloard and Guard Villagers are able to use crossbows and bows,
can be a great integration to disguise the guns as crossbows or bows to make guns usable by those mods' mobs.

commented

ChatGPT:

To implement this requirement in Minecraft Forge modding, you will need to create a custom goal for mobs to use your weapons. Here's a general outline of the steps you can follow:

Determine which mobs you want to target. You can use the EntityType class to check if a mob is vanilla or modded, and the EntityDataManager class to check if a mob is capable of using bows or crossbows.

Create a custom goal class that extends Goal. This class will contain the logic for your mobs to use your weapons.

Register your custom goal class with Forge's event bus using the ForgeRegistries.GOALS.register method.

In your mod's init method, you can use the EntityType.MOB.getClass method to get a list of all mobs that extend EntityMob, and use the EntityDataManager class to check if each mob is capable of using bows or crossbows.

For each mob that meets the criteria, you can use the GoalSelector class to add your custom goal to the mob's goal selector. You can do this by calling the addGoal method on the GoalSelector instance for the mob.

Test your mod to ensure that your custom goal is being applied to the correct mobs and that they are using your weapons as intended.

commented

You can't fake an item being a bow/crossbow. Those mods are hardcoded to only accept those items and aren't flexible. Also never send me ChatGPT "instructions".