Jump to content

LeeCrafts

Members
  • Posts

    88
  • Joined

  • Last visited

Converted

  • Personal Text
    just a small-time modder who enjoys Minecraft.
    Thingamabobs and Doohickeys: https://www.curseforge.com/minecraft/mc-mods/thingamabobs-and-doohickeys

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

LeeCrafts's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. I have found out that I may need to use the ChannelBuilder class: public static final SimpleChannel INSTANCE = ChannelBuilder.named(new ResourceLocation(SkeletonBowMaster.MODID, "main")).simpleChannel(); However, I am not marking this post as "solved" just yet, as I have not tested the mod.
  2. I followed the documentation (https://docs.minecraftforge.net/en/1.20.x/networking/simpleimpl/) for creating a packet handler. However, as shown in the images below, I have found out that "'net.minecraftforge.network.NetworkRegistry' is marked unstable with @ApiStatus.Internal". Strangely enough, when I created a previous mod for Minecraft version 1.20.4, I did not encounter this problem. My Forge version for this mod is 49.0.27, so I believe some things have changed. Is there a new correct way of creating a packet handler?
  3. Good golly gee I'm dense. I put the is_projectile.json file in the wrong path. It was supposed to be /resources/data/minecraft/tags/damage_type/is_projectile.json, not /resources/data/thingamabobs/tags/damage_type/is_projectile.json! That being said, I do NOT need the bootstrap method in ModDamageTypes.java, and ModDataGenerationHandler.java at all; "runData" does not need to be run either. I had already done the datagen manually.
  4. I do believe your custom mob needs to implement the RangeAttackMob interface. Then make your mob shoot 3 arrows via implementing the performRangedAttack() method. See the AbstractSkeleton class for reference, which makes the Skeleton mobs shoot only 1 arrow. If you need help on making a mob in general, refer to this video: https://www.youtube.com/watch?v=6ycbDR4hAkI
  5. While I cannot pinpoint what is preventing the rooster from damaging the player, try using a debugger and set a breakpoint in the MeleeAttackGoal class--in the tick() and/or checkAndPerformAttack() methods.
  6. Subscribe to EntityJoinLevelEvent and check if that entity is a wandering trader.
  7. I have successfully created a new damage source "bullet". But now I would like to add the damage type tag "is_projectile" to it. Even though I added the file /resources/data/thingamabobs/tags/damage_type/is_projectile.json with the appropriate JSON content, the game still does not seem to register the damage source as a projectile. So I was wondering if I needed to also register it through a bootstrap method--and call that method using an event handler: public interface ModDamageTypes { ResourceKey<DamageType> BULLET = register("bullet"); private static ResourceKey<DamageType> register(String name) { return ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ThingamabobsAndDoohickeys.MODID, name)); } // bootstrap method static void bootstrap(BootstapContext<DamageType> bootstapContext) { bootstapContext.register(BULLET, new DamageType("bullet", 0.1f)); } } @Mod.EventBusSubscriber(modid = ThingamabobsAndDoohickeys.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModDataGenerationHandler { private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder().add(Registries.DAMAGE_TYPE, ModDamageTypes::bootstrap); @SubscribeEvent public static void gatherDataEvent(GatherDataEvent event) { DataGenerator dataGenerator = event.getGenerator(); PackOutput packOutput = dataGenerator.getPackOutput(); dataGenerator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider( packOutput, event.getLookupProvider(), BUILDER, Set.of(ThingamabobsAndDoohickeys.MODID))); } } Unfortunately, the GatherDataEvent does not seem to fire. I heard that I had to run "runData", but the process fails, outputting the log below: What could I be missing? BTW, I was using this post for guidance: https://forums.minecraftforge.net/topic/122311-1194-how-to-create-custom-damagesources/ The rest of my code + JSON files:
  8. I would like to modify the death message for a custom weapon I implemented (e.g. "X was squashed into a pancake by Y" instead of "X was slain by Y"). Is it required that I create a new DamageSource? If not, what else can I do? Edit: The answers in the post below really helped me.
  9. Wow, I didn't know that I had to do that, thank you! This is my code, if any of you are curious: // getter and setter methods that i already had public boolean isSomething() { return this.entityData.get(DATA_IS_SOMETHING); } public void setSomething(boolean isSomething) { this.entityData.set(DATA_IS_SOMETHING, isSomething); } ... // what solved my issue @Override public void addAdditionalSaveData(@NotNull CompoundTag pCompound) { super.addAdditionalSaveData(pCompound); pCompound.putBoolean("IsSomething", this.isSomething()); } @Override public void readAdditionalSaveData(@NotNull CompoundTag pCompound) { super.readAdditionalSaveData(pCompound); this.setSomething(pCompound.getBoolean("IsSomething")); }
  10. I am implementing a custom entity, and so far I had to add synched entity data to it. For example: private static final EntityDataAccessor<Boolean> DATA_IS_SOMETHING = SynchedEntityData.defineId(CustomEntity.class, EntityDataSerializers.BOOLEAN); @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_IS_SOMETHING, false); } Under certain conditions, the DATA_IS_SOMETHING of my entity will change to true. To my dismay though, when the player dies and then respawns, that entity's DATA_IS_SOMETHING resets back to false. Is this normal behavior? If so, then should I use capabilities instead? FYI I need the data to be synced between the server and client.
  11. This is a very specific problem, but let me elaborate: I am implementing a custom GeckoLib entity that is a sticky bomb. When thrown at another entity, the bomb must latch onto that entity by "riding" it. I need to do mainly two things in order to make the bomb really look like it is sticking to an entity: 1. Modify the bomb's riding position by overriding its Entity#setPos method. The bomb must be positioned so that it will appear stuck to the body part of the entity that it hit. 2. Modify the bomb's rotation by overriding its Projectile#updateRotation method. The bomb should be rotated so that it constantly faces its victim (i.e. the center of the victim's hitbox). The math and logic behind implementing #1 and #2 was not that difficult for me, and I was able to implement #1 successfully. However, I am struggling with #2 because whenever the vehicle itself rotates, the bomb seems to rotate the wrong way. I even tried modifying the overridden updateRotation method so that the bomb's rotation is not changed when it is riding a vehicle (i.e. this.getVehicle() != null), but the bomb somehow still rotates when the vehicle rotates. So far, I could not find any other code that modifies the rotation of a passenger entity on a vehicle. But what I have found out is that--when the bomb rotates unexpectedly--its hitbox does not rotate with it (Hitbox rotation is indicated by the direction its blue line is pointing when the player presses F3 + B). Was it being rotated clientside? What could be causing this behavior?
×
×
  • Create New...

Important Information

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