Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Oct 3, 2023
2 parents 62e54dd + c8716e7 commit 4bd4659
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/vazkii/quark/mixin/BeehiveBlockEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.animal.Bee;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(value = BeehiveBlockEntity.class)
public class BeehiveBlockEntityMixin {
Expand All @@ -14,4 +19,13 @@ private static boolean doNotRemoveUUIDOfBees(CompoundTag instance, String key) {
return !key.equals("UUID");
}


@Inject(method = "setBeeReleaseData", at = @At("HEAD"))
private static void rerollUUIDIfNeeded(int ticksInHive, Bee bee, CallbackInfo ci) {
if (bee.level instanceof ServerLevel level) {
if (level.getEntities().get(bee.getUUID()) != null)
bee.setUUID(Mth.createInsecureUUID(level.random));
}
}

}

0 comments on commit 4bd4659

Please sign in to comment.