GithubHelp home page GithubHelp logo

moreaxolotlvariantsapi-common's Introduction

AkashiiKun's GitHub stats

moreaxolotlvariantsapi-common's People

Contributors

akashiikun avatar kxmischesdomi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

moreaxolotlvariantsapi-common's Issues

Crash when trying to add Variants

Game crashes when trying to add a Variant (Fabric 1.20.1), not too sure what do here.

[16:15:22] [main/ERROR] (FabricLoader) Minecraft has crashed!
net.fabricmc.loader.impl.FormattedException: java.lang.IllegalAccessError: Update to non-static final field net.minecraft.item.EntityBucketItem.entityType attempted from a different method (handler$zen000$mavapi$onInit) than the initializer method <init> 
	at net.fabricmc.loader.impl.FormattedException.ofLocalized(FormattedException.java:63) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar:?]
Caused by: java.lang.IllegalAccessError: Update to non-static final field net.minecraft.item.EntityBucketItem.entityType attempted from a different method (handler$zen000$mavapi$onInit) than the initializer method <init> 
	at net.minecraft.item.EntityBucketItem.handler$zen000$mavapi$onInit(EntityBucketItem.java:566) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.item.EntityBucketItem.<init>(EntityBucketItem.java:45) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.item.Items.<clinit>(Items.java:1381) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.LightBlock.getOutlineShape(LightBlock.java:63) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.AbstractBlock$AbstractBlockState.getOutlineShape(AbstractBlock.java:1106) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.AbstractBlock$AbstractBlockState.getOutlineShape(AbstractBlock.java:1106) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.AbstractBlock.getCollisionShape(AbstractBlock.java:850) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.AbstractBlock$AbstractBlockState$ShapeCache.<init>(AbstractBlock.java:1106) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.AbstractBlock$AbstractBlockState.initShapeCache(AbstractBlock.java:1106) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.Blocks.<clinit>(Blocks.java:1410) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.block.FireBlock.registerDefaultFlammables(FireBlock.java:286) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.Bootstrap.initialize(Bootstrap.java:53) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:159) ~[minecraft-merged-project-root-1.20.1-net.fabricmc.yarn.1_20_1.1.20.1+build.3-v2.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
	... 3 more

Enum extension after class load is dangerous

Enum.values() and Enum.valueOf(String) are based on the value of synthetic field Enum.$VALUES.

Currently, the api is populating new enum instances at runtime and not adding them the synthetic field in <clinit>.

This will break the mentioned methods, which could be dangerous and confusing for other mods.

This could be solved by regretting to the old <clinit> mixin, and use Service to fetch other mods request on extending the enum at such an early timing.

[1.20.1] Mixin injecting SynchedEntityData into entities not owned by MoreAxolotlVariantsAPI is dangerous

Entity Data Accessors should only be ever set by the creator of the entity. Never added to by other mods.

The reason for this is because Entity Data Accessors are order dependent so if multiple mods tries to add these entity data accessors to mobs and on client, they run in a different order than the server did (because mod load order is not guaranteed), the client will get forcibly disconnected from server when the entity spawns.

Instead, this mixin part needs to be removed and migrated properly to a Forge Capability because capabilities were designed specifically for this use case of attaching data to arbitrary entities. It is safer for mods as the vanilla system is designed specifically only for vanilla and unsafe for mods. Then you would use your own packet to send the data to client when needed.

@Unique
private static final EntityDataAccessor<String> mavapi$VARIANT = SynchedEntityData.defineId(Axolotl.class, EntityDataSerializers.STRING);
protected AxolotlEntityMixin(EntityType<? extends LivingEntity> entityType, Level world) {
super(entityType, world);
}
@Inject(method = "defineSynchedData", at = @At("TAIL"))
private void mavm$initTrackers(CallbackInfo ci) {
this.entityData.define(mavapi$VARIANT, "minecraft:lucy");
}

This is especially a problem in large modpacks where many mods are doing this. Example is TNPLimitless 7 where there's many mods injecting SynchedEntityData onto entities and are getting out of order due to mod load order. Which is causes a lot of reports of people getting disconnected from server due to:
image

Missing the green library badge in modmenu

can you please modify the mod so that it gets properly recognized as a library by modmenu, and therefor doesnt show up by default?

apis like fabric, cloth, yacl etc. have a green library badge in modmenu, and only show up if you toggle the button from "Libraries: Hidden" to "Libraries: Shown". i would appreciate it if mavapi behaved the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.