Skip to content

Commit

Permalink
fix: crash with Let's Do API (close #78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snownee committed May 20, 2024
1 parent 997e8a6 commit 0f5c240
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
25 changes: 25 additions & 0 deletions src/main/java/snownee/fruits/mixin/WoodTypeMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package snownee.fruits.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.world.level.block.state.properties.WoodType;
import snownee.fruits.CoreModule;
import snownee.fruits.cherry.CherryModule;

@Mixin(WoodType.class)
public abstract class WoodTypeMixin {
@Shadow
public static WoodType register(WoodType woodType) {
throw new AssertionError();
}

@Inject(method = "<clinit>", at = @At("RETURN"))
private static void initWoodTypes(CallbackInfo ci) {
register(CoreModule.CITRUS_WOOD_TYPE);
register(CherryModule.REDLOVE_WOOD_TYPE);
}
}
6 changes: 0 additions & 6 deletions src/main/java/snownee/fruits/util/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static snownee.fruits.cherry.CherryModule.PETAL_CHERRY;
import static snownee.fruits.cherry.CherryModule.PETAL_REDLOVE;
import static snownee.fruits.cherry.CherryModule.REDLOVE_LEAVES;
import static snownee.fruits.cherry.CherryModule.REDLOVE_WOOD_TYPE;

import org.joml.Matrix4f;
import org.joml.Vector3f;
Expand All @@ -39,7 +38,6 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GrassColor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.ModelEvent;
Expand Down Expand Up @@ -73,8 +71,6 @@ public static void init() {
event.registerEntityRenderer(CoreModule.SLIDING_DOOR.getOrCreate(), SlidingDoorRenderer::new);
});

WoodType.register(CoreModule.CITRUS_WOOD_TYPE);

eventBus.addListener((RegisterColorHandlersEvent.Block event) -> {
BlockColor oakBlockColor = ColorProviderUtil.delegate(Blocks.OAK_LEAVES);
event.register(
Expand Down Expand Up @@ -135,8 +131,6 @@ public static void init() {
APPLE_LEAVES.get());
});

WoodType.register(REDLOVE_WOOD_TYPE);

eventBus.addListener((RegisterParticleProvidersEvent event) -> {
event.registerSpriteSet(PETAL_CHERRY.getOrCreate(), PetalParticle.Factory::new);
event.registerSpriteSet(PETAL_REDLOVE.getOrCreate(), PetalParticle.Factory::new);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/fruitfulfun.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ServerEntityMixin",
"ServerLevelMixin",
"SkullBlockEntityMixin",
"WoodTypeMixin",
"forge.FoliagePlacerAccess"
],
"client": [
Expand Down

0 comments on commit 0f5c240

Please sign in to comment.