|
1 | 1 | package com.wfphantom.neobeefix.mixin; |
2 | 2 |
|
3 | | -import net.minecraft.nbt.CompoundTag; |
| 3 | +import com.mojang.serialization.Codec; |
4 | 4 | import net.minecraft.server.level.ServerLevel; |
5 | 5 | import net.minecraft.world.entity.AgeableMob; |
6 | | -import net.minecraft.world.entity.animal.Bee; |
7 | | -import net.minecraft.world.level.Level; |
| 6 | +import net.minecraft.world.entity.animal.bee.Bee; |
| 7 | +import net.minecraft.world.level.storage.ValueInput; |
8 | 8 | import org.spongepowered.asm.mixin.Mixin; |
9 | 9 | import org.spongepowered.asm.mixin.injection.At; |
10 | 10 | import org.spongepowered.asm.mixin.injection.Inject; |
11 | | -import org.spongepowered.asm.mixin.injection.Redirect; |
12 | 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
13 | 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
14 | 13 |
|
15 | 14 | @Mixin(Bee.class) |
16 | 15 | public class BeeMixin { |
17 | | - @Redirect(method = "wantsToEnterHive", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;isNight()Z")) |
18 | | - private boolean noSkylight_isNotNight(Level level) { |
19 | | - return level.dimensionType().hasSkyLight() && level.isNight(); |
20 | | - } |
21 | | - @Redirect(method = "wantsToEnterHive", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;isRaining()Z")) |
22 | | - private boolean noSkylight_isNotRaining(Level level) { |
23 | | - return level.dimensionType().hasSkyLight() && level.isRaining(); |
24 | | - } |
25 | 16 | @Inject(method = "readAdditionalSaveData", at = @At("TAIL")) |
26 | | - private void noGravityOnLoad(CompoundTag tag, CallbackInfo ci) { |
27 | | - if (!tag.contains("NoGravity")) ((Bee) (Object) this).setNoGravity(true); |
| 17 | + private void noGravityOnLoad(ValueInput in, CallbackInfo ci) { |
| 18 | + if (in.read("NoGravity", Codec.BOOL).isEmpty()) ((Bee) (Object) this).setNoGravity(true); |
28 | 19 | } |
29 | 20 | @Inject(method = "getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/AgeableMob;", at = @At("RETURN")) |
30 | 21 | private void noGravityOnBreed(ServerLevel level, AgeableMob otherParent, CallbackInfoReturnable<AgeableMob> cir) { |
|
0 commit comments