Skip to content

Commit

Permalink
fix? needs compared to paper behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Rektroth committed Apr 25, 2024
1 parent 5121bcc commit 5b940b2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.github.rektroth.whiteout.mixin.entity.passive;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.control.FlightMoveControl;
import net.minecraft.entity.ai.control.MoveControl;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.BeeEntity;
import net.minecraft.world.World;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(BeeEntity.class)
public abstract class BeeEntityMixin extends AnimalEntity {
protected BeeEntityMixin(EntityType<? extends AnimalEntity> entityType, World world) {
super(entityType, world);
}

@Inject(
at = @At("TAIL"),
method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V"
)
public void fixedMoveControl(EntityType<? extends BeeEntity> entityType, World world, CallbackInfo ci) {
class BeeFlyingMoveControl extends FlightMoveControl {
public BeeFlyingMoveControl(final MobEntity entity, final int maxPitchChange, final boolean noGravity) {
super(entity, maxPitchChange, noGravity);
}

@Override
public void tick() {
if (!BeeEntityMixin.this.getWorld().isInBuildLimit(this.entity.getBlockPos())) {
this.entity.setNoGravity(false);
}

super.tick();
}
}

this.moveControl = new BeeFlyingMoveControl(this, 20, true);
}
}
1 change: 1 addition & 0 deletions src/main/resources/whiteout.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"entity.ai.goal.WolfBegGoalMixin",
"entity.boss.dragon.EnderDragonFightAccessor",
"entity.boss.dragon.EnderDragonFightMixin",
"entity.passive.BeeEntityMixin",
"server.PlayerManagerAccessor",
"server.PlayerManagerMixin",
"server.dedicated.command.DeOpCommandMixin",
Expand Down

0 comments on commit 5b940b2

Please sign in to comment.