MightyPirates / TIS-3D

TIS-100 inspired low-tech computing in Minecraft.
https://www.curseforge.com/minecraft/mc-mods/tis-3d
Other
105 stars 35 forks source link

ExecutionModule: Mark state texture IDs as client-sided #105

Closed Sturmlilie closed 4 years ago

Sturmlilie commented 4 years ago

Fixes crash on dedicated server.

Git bisect saves lives.
(Also could you make a new CurseForge release while at it? :>)

Sturmlilie commented 4 years ago

So, this crashes:

@Environment(EnvType.CLIENT)
static final Identifier[] STATE_LOCATIONS = new Identifier[]{
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_IDLE,
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_ERROR,
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_RUNNING,
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_WAITING
};

and this

static final Identifier[] STATE_LOCATIONS = new Identifier[]{
    @Environment(EnvType.CLIENT)
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_IDLE,
    @Environment(EnvType.CLIENT)
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_ERROR,
    @Environment(EnvType.CLIENT)
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_RUNNING,
    @Environment(EnvType.CLIENT)
    Textures.LOCATION_OVERLAY_MODULE_EXECUTION_WAITING
};

doesn't compile. Regarding the DisplayModule: That was not an array type variable. So I'm kinda out of options, if you know another way I'd be all ear :shrug:

fnuecke commented 4 years ago

Right you are. The latest docs even make this clear (the ones my 1.15 dev env downloads doesn't, hence my expectations). Thanks for checking!

In that case I'd agree this is the most readable solution. A lambda that checks net.fabricmc.loader.api.FabricLoader.getInstance().getEnvironmentType() looks pretty noisy.