Skip to content

Commit

Permalink
Fix crash with HNN
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Sep 22, 2024
1 parent 1e4d66b commit ba60825
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@

package net.fabricmc.fabric.mixin.object.builder;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

import com.google.common.collect.ImmutableSet;
import com.mojang.datafixers.types.Type;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
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.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

@Mixin(BlockEntityType.class)
public class BlockEntityTypeMixin<T extends BlockEntity> implements FabricBlockEntityType {
Expand All @@ -42,7 +43,9 @@ public class BlockEntityTypeMixin<T extends BlockEntity> implements FabricBlockE

@Inject(method = "<init>", at = @At("RETURN"))
private void mutableBlocks(BlockEntityType.BlockEntitySupplier<? extends T> factory, Set<Block> blocks, Type<?> type, CallbackInfo ci) {
this.validBlocks = new HashSet<>(this.validBlocks);
if (this.validBlocks instanceof ImmutableSet<Block>) {
this.validBlocks = new HashSet<>(this.validBlocks);
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion ffapi.gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
loom.platform=neoforge
fabric.loom.dontRemap=true

implementationVersion=2.0.12
implementationVersion=2.0.13

versionMc=1.21.1
versionForge=21.1.57
Expand Down

0 comments on commit ba60825

Please sign in to comment.