Skip to content

Commit

Permalink
Make slightly code less ridiculous
Browse files Browse the repository at this point in the history
  • Loading branch information
Rektroth committed Apr 26, 2024
1 parent 09529b8 commit 6a640fc
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected AzaleaBlockMixin(Settings settings) {
}

@Override
public boolean canPathfindThrough(BlockState state, NavigationType type) {
protected boolean canPathfindThrough(BlockState state, NavigationType type) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
@Mixin(VillagerTaskListProvider.class)
public abstract class VillagerTaskListProviderMixin {
@Redirect(
at = @At(
target = "Lnet/minecraft/entity/ai/brain/task/WalkToNearestVisibleWantedItemTask;create(FZI)Lnet/minecraft/entity/ai/brain/task/Task;",
value = "INVOKE"),
method = "createCoreTasks")
at = @At(
target = "Lnet/minecraft/entity/ai/brain/task/WalkToNearestVisibleWantedItemTask;create(FZI)Lnet/minecraft/entity/ai/brain/task/Task;",
value = "INVOKE"),
method = "createCoreTasks")
private static Task<LivingEntity> goToWantedItemFix(float speed, boolean requiresWalkTarget, int radius) {
return WalkToNearestVisibleWantedItemTask.create(
villager -> !villager.isSleeping(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
public abstract class WolfBegGoalMixin {
@Redirect(
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;isTamed()Z"),
method = "isAttractive(Lnet/minecraft/entity/player/PlayerEntity;)Z")
public boolean fixedBadTameCheck(WolfEntity instance) {
method = "isAttractive")
private boolean fixedBadTameCheck(WolfEntity instance) {
return !((WolfBegGoalAccessor)this).getWolf().isTamed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@Mixin(EnderDragonFight.class)
public abstract class EnderDragonFightMixin {
@Inject(at = @At("TAIL"), method = "updateFight(Lnet/minecraft/entity/boss/dragon/EnderDragonEntity;)V")
@Inject(at = @At("TAIL"), method = "updateFight")
private void fixedCustomNameCheck(EnderDragonEntity dragon, CallbackInfo ci) {
ServerBossBar bossBar = ((EnderDragonFightAccessor)this).getBossBar();

Expand All @@ -32,7 +32,7 @@ private void fixedCustomNameCheck(EnderDragonEntity dragon, CallbackInfo ci) {

@Redirect(
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/boss/dragon/EnderDragonEntity;hasCustomName()Z"),
method = "updateFight(Lnet/minecraft/entity/boss/dragon/EnderDragonEntity;)V")
method = "updateFight")
private boolean skipBadCustomNameCheck(EnderDragonEntity instance) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class ItemFrameEntityMixin {
at = @At(
target = "Lnet/minecraft/entity/decoration/ItemFrameEntity;getMapId()Lnet/minecraft/component/type/MapIdComponent;",
value = "INVOKE_ASSIGN"),
method = "removeFromFrame(Lnet/minecraft/item/ItemStack;)V"
method = "removeFromFrame"
)
private void getMapIdFromItem(ItemStack stack, CallbackInfo ci, @Local LocalRef<MapIdComponent> mapIdComponent) {
mapIdComponent.set(stack.get(DataComponentTypes.MAP_ID));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ protected BeeEntityMixin(EntityType<? extends AnimalEntity> entityType, World wo

@Inject(
at = @At("TAIL"),
method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V"
method = "<init>"
)
public void fixedMoveControl(EntityType<? extends BeeEntity> entityType, World world, CallbackInfo ci) {
private 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class PlayerManagerMixin {

@Inject(
at = @At("HEAD"),
method = "checkCanJoin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/text/Text;",
method = "checkCanJoin",
cancellable = true)
private void fixedBanCheck(SocketAddress address, GameProfile profile, CallbackInfoReturnable<Text> ci) {
if (((PlayerManagerAccessor)this).getBannedProfiles().contains(profile)) {
Expand All @@ -53,7 +53,7 @@ private void fixedBanCheck(SocketAddress address, GameProfile profile, CallbackI

@Redirect(
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/BannedPlayerList;contains(Lcom/mojang/authlib/GameProfile;)Z"),
method = "checkCanJoin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/text/Text;")
method = "checkCanJoin")
private boolean skipBadBanCheck(BannedPlayerList bannedProfiles, GameProfile profile) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class DeOpCommandMixin {
value = "INVOKE",
target = "Lnet/minecraft/server/command/ServerCommandSource;sendFeedback(Ljava/util/function/Supplier;Z)V"
),
method = "deop(Lnet/minecraft/server/command/ServerCommandSource;Ljava/util/Collection;)I"
method = "deop"
)
private static void skipBadSendFeedback(ServerCommandSource instance, Supplier<Text> feedbackSupplier, boolean broadcastToOps) {
// do nothing
Expand All @@ -42,7 +42,7 @@ private static void skipBadSendFeedback(ServerCommandSource instance, Supplier<T
target = "Lnet/minecraft/server/command/ServerCommandSource;sendFeedback(Ljava/util/function/Supplier;Z)V"
),
locals = LocalCapture.CAPTURE_FAILHARD,
method = "deop(Lnet/minecraft/server/command/ServerCommandSource;Ljava/util/Collection;)I"
method = "deop"
)
private static void fixedSendFeedback(
ServerCommandSource source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class OpCommandMixin {
value = "INVOKE",
target = "Lnet/minecraft/server/command/ServerCommandSource;sendFeedback(Ljava/util/function/Supplier;Z)V"
),
method = "op(Lnet/minecraft/server/command/ServerCommandSource;Ljava/util/Collection;)I"
method = "op"
)
private static void skipBadSendFeedback(ServerCommandSource instance, Supplier<Text> feedbackSupplier, boolean broadcastToOps) {
// do nothing
Expand All @@ -42,7 +42,7 @@ private static void skipBadSendFeedback(ServerCommandSource instance, Supplier<T
target = "Lnet/minecraft/server/command/ServerCommandSource;sendFeedback(Ljava/util/function/Supplier;Z)V"
),
locals = LocalCapture.CAPTURE_FAILHARD,
method = "op(Lnet/minecraft/server/command/ServerCommandSource;Ljava/util/Collection;)I"
method = "op"
)
private static void fixedSendFeedback(
ServerCommandSource source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public abstract class ExplosionMixin {
value = "INVOKE",
target = "Lnet/minecraft/world/explosion/ExplosionBehavior;canDestroyBlock(Lnet/minecraft/world/explosion/Explosion;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;F)Z"),
locals = LocalCapture.CAPTURE_FAILHARD,
method = "collectBlocksAndDamageEntities()V")
public void noHeadlessPiston(
method = "collectBlocksAndDamageEntities")
private void noHeadlessPiston(
CallbackInfo ci,
Set<BlockPos> set,
int i,
Expand Down

0 comments on commit 6a640fc

Please sign in to comment.