-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix? needs compared to paper behavior
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/main/java/io/github/rektroth/whiteout/mixin/entity/passive/BeeEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters