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 e4c66ff commit cb2fb30
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 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 java.util.function.Supplier;

Expand Down Expand Up @@ -47,7 +46,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 snownee.fruits.CoreModule;
import snownee.fruits.FruitfulFun;
Expand Down Expand Up @@ -137,8 +135,6 @@ public static void renderVacGunInHand(
public void onInitializeClient() {
EntityRendererRegistry.register(CoreModule.SLIDING_DOOR.getOrCreate(), SlidingDoorRenderer::new);

WoodType.register(CoreModule.CITRUS_WOOD_TYPE);

Supplier<BlockColor> oakBlockColor = ColorProviderUtil.delegate(Blocks.OAK_LEAVES);
ColorProviderRegistry.BLOCK.register(
(state, world, pos, i) -> {
Expand Down Expand Up @@ -195,8 +191,6 @@ public void onInitializeClient() {
GRAPEFRUIT_LEAVES.get(),
APPLE_LEAVES.get());

WoodType.register(REDLOVE_WOOD_TYPE);

ParticleFactoryRegistry.getInstance().register(PETAL_CHERRY.getOrCreate(), PetalParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(PETAL_REDLOVE.getOrCreate(), PetalParticle.Factory::new);

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/fruitfulfun.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"RideableBeePlayerMixin",
"ServerEntityMixin",
"ServerLevelMixin",
"SkullBlockEntityMixin"
"SkullBlockEntityMixin",
"WoodTypeMixin"
],
"client": [
"client.BeeRendererMixin",
Expand Down

0 comments on commit cb2fb30

Please sign in to comment.