Skip to content

Commit

Permalink
Remove all spotless comments, Fix #232
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Dec 26, 2024
1 parent f24b733 commit 1c52230
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 109 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ src/main/java/dev/tr7zw/notenoughanimations/NEAnimationsMod.java
src/main/java/dev/tr7zw/util/NMSHelper.java
src/main/java/dev/tr7zw/util/ModLoaderUtil.java
src/main/neoforge-resources/META-INF/neoforge.mods.toml
/src/main/java/dev/tr7zw/util
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.tr7zw.notenoughanimations;

//spotless:off
//#if FABRIC
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public boolean isEnabled() {

@Override
public boolean isValid(AbstractClientPlayer entity, PlayerData data) {
// spotless:off
//#if MC >= 11700
if (!entity.isFallFlying() && !entity.onGround() && !entity.onClimbable() && !entity.getAbilities().flying
//#else
//$$ if (!entity.isFallFlying() && !entity.isOnGround() && !entity.onClimbable() && !entity.abilities.flying
//#endif
//spotless:on
//#endif
&& !entity.isSwimming()) {
FallingData fallData = data.getData(this, () -> new FallingData(entity.getY()));
if (entity instanceof LocalPlayer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public boolean isEnabled() {

@Override
public boolean isValid(AbstractClientPlayer entity, PlayerData data) {
// spotless:off
//#if MC >= 11800
//#if MC >= 11800
return entity.canFreeze() && entity.level().getBlockStatesIfLoaded(entity.getBoundingBox().deflate(1.0E-6D))
//#else
//$$ return entity.canFreeze() && entity.level.getBlockStatesIfLoaded(entity.getBoundingBox().deflate(1.0E-6D))
//#endif
//spotless:on
//#else
//$$ return entity.canFreeze() && entity.level.getBlockStatesIfLoaded(entity.getBoundingBox().deflate(1.0E-6D))
//#endif
.anyMatch(blockState -> (blockState.is(Blocks.POWDER_SNOW)
|| blockState.is(Blocks.POWDER_SNOW_CAULDRON)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ public boolean isValid(AbstractClientPlayer entity, PlayerData data) {
if (entity.onClimbable() && !entity.onGround() && entity.getLastClimbablePos().isPresent()) {
for (Class<? extends Block> blocktype : ladderLikeBlocks) {
if (blocktype.isAssignableFrom(
// spotless:off
//#if MC >= 11800
entity.level().getBlockState(entity.getLastClimbablePos().get()).getBlock().getClass()))
//#else
//$$ entity.level.getBlockState(entity.getLastClimbablePos().get()).getBlock().getClass()))
//#endif
//spotless:on

return true;
}
Expand Down Expand Up @@ -87,13 +85,11 @@ public void apply(AbstractClientPlayer entity, PlayerData data, PlayerModel mode
}
if (part == BodyPart.BODY) {
if (NEABaseMod.config.enableRotateToLadder) {
// spotless:off
//#if MC >= 12005
BlockState blockState = entity.getInBlockState();
//#else
//$$ BlockState blockState = entity.getFeetBlockState();
//#endif
//spotless:on
if (blockState.hasProperty(HorizontalDirectionalBlock.FACING)) {
Direction dir = blockState.getValue(HorizontalDirectionalBlock.FACING);
data.setDisableBodyRotation(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.vehicle.Boat;

public class BoatAnimation extends BasicAnimation {

Expand All @@ -20,7 +19,11 @@ public boolean isEnabled() {

@Override
public boolean isValid(AbstractClientPlayer entity, PlayerData data) {
return entity.isPassenger() && entity.getVehicle() instanceof Boat;
//#if MC > 12102
return entity.isPassenger() && entity.getVehicle() instanceof net.minecraft.world.entity.vehicle.AbstractBoat;
//#else
//$$ return entity.isPassenger() && entity.getVehicle() instanceof net.minecraft.world.entity.vehicle.Boat;
//#endif
}

private final BodyPart[] bothHands = new BodyPart[] { BodyPart.LEFT_ARM, BodyPart.RIGHT_ARM };
Expand Down Expand Up @@ -48,7 +51,12 @@ public void apply(AbstractClientPlayer entity, PlayerData data, PlayerModel mode
return;
}
HumanoidArm arm = part == BodyPart.LEFT_ARM ? HumanoidArm.LEFT : HumanoidArm.RIGHT;
Boat boat = (Boat) entity.getVehicle();
//#if MC > 12102
net.minecraft.world.entity.vehicle.AbstractBoat boat = (net.minecraft.world.entity.vehicle.AbstractBoat) entity
.getVehicle();
//#else
//$$ net.minecraft.world.entity.vehicle.Boat boat = (net.minecraft.world.entity.vehicle.Boat) entity.getVehicle();
//#endif
int id = boat.getPassengers().indexOf(entity);
if (id == 0) {
float paddle = boat.getRowingTime(arm == HumanoidArm.LEFT ? 0 : 1, delta);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ public void apply(AbstractClientPlayer entity, PlayerData data, PlayerModel mode
AbstractHorse horse = (AbstractHorse) entity.getVehicle();
int id = horse.getPassengers().indexOf(entity);
if (id == 0) {
// spotless:off
//#if MC >= 11904
//#if MC >= 11904
float rotation = -Mth.cos(horse.walkAnimation.position() * 0.3f);
//#else
//$$ float rotation = -Mth.cos(horse.animationPosition * 0.3f);
//#endif
//spotless:on
rotation *= 0.1;
AnimationUtil.applyArmTransforms(model, arm, -1.1f - rotation, -0.2f, 0.3f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ public boolean isEnabled() {

private ArmPose rightArmPose;
private ArmPose leftArmPose;
// spotless:off
//#if MC >= 11700
private final EnumSet<ArmPose> singleHandedAnimatios = EnumSet.of(ArmPose.SPYGLASS, ArmPose.THROW_SPEAR);
//#else
//$$ private final EnumSet<ArmPose> singleHandedAnimatios = EnumSet.of(ArmPose.THROW_SPEAR);
//#endif
//spotless:on
private final BodyPart[] left = new BodyPart[] { BodyPart.LEFT_ARM, BodyPart.BODY };
private final BodyPart[] right = new BodyPart[] { BodyPart.RIGHT_ARM, BodyPart.BODY };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
import dev.tr7zw.notenoughanimations.versionless.animations.HoldUpTarget;
import dev.tr7zw.notenoughanimations.versionless.config.Config;
import net.minecraft.client.gui.screens.Screen;
//spotless:off
//#if MC >= 11900
import net.minecraft.client.OptionInstance;
//#else
//$$ import net.minecraft.client.Option;
//#endif
//spotless:on

public class ConfigScreenProvider {

Expand Down Expand Up @@ -110,13 +108,11 @@ public void initialize() {
options.add(getOnOffOption("text.nea.enable.burningAnimation", () -> config.burningAnimation,
b -> config.burningAnimation = b));

// spotless:off
//#if MC >= 11900
getOptions().addSmall(options.toArray(new OptionInstance[0]));
//#else
//$$getOptions().addSmall(options.toArray(new Option[0]));
//#endif
// spotless:on

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
import dev.tr7zw.notenoughanimations.versionless.animations.BodyPart;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.player.AbstractClientPlayer;
// spotless:off
//#if MC >= 11700
import dev.tr7zw.notenoughanimations.animations.fullbody.FreezingAnimation;
//#endif
//spotless:on

public class AnimationProvider {

Expand Down Expand Up @@ -115,11 +113,9 @@ private void loadAnimations() {
addAnimation(new CustomBowAnimation());
addAnimation(new ActionRotationLockAnimation());
addAnimation(new BurningAnimation());
// spotless:off
//#if MC >= 11700
addAnimation(new FreezingAnimation());
//#endif
//spotless:on
}

public void addAnimation(BasicAnimation animation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
// spotless:off
//#if MC >= 11700
import net.minecraft.client.model.geom.ModelLayers;
//#endif
//spotless:on

public class HeldItemHandler {

Expand All @@ -63,13 +61,12 @@ public class HeldItemHandler {
public void onRenderItem(LivingEntity entity, EntityModel<?> model, ItemStack itemStack, HumanoidArm arm,
PoseStack matrices, MultiBufferSource vertexConsumers, int light, CallbackInfo info) {
if (bookModel == null) {
// spotless:off
//#if MC >= 11700
//#if MC >= 11700
bookModel = new BookModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.BOOK));
//#else
//$$ bookModel = new BookModel();
//#endif
//spotless:on
//#else
//$$ bookModel = new BookModel();
//#endif
//spotless:on
}
if (entity.isSleeping()) { // Stop holding stuff in your sleep
if (NEABaseMod.config.dontHoldItemsInBed) {
Expand Down Expand Up @@ -195,13 +192,11 @@ private void renderBook(LivingEntity entity, float delta, ItemStack itemStack, H
//$$vertexConsumer = EnchantTableRenderer.BOOK_LOCATION.buffer(vertexConsumers, RenderType::entitySolid, glow);
//#endif
}
// spotless:off
//#if MC >= 12100
bookModel.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, Integer.MAX_VALUE);
//#else
//$$ bookModel.render(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
//#endif
//spotless:on
matrices.popPose();
if (item == writtenBook) {
matrices.pushPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
// spotless:off
//#if MC >= 12104
import net.minecraft.client.renderer.item.ItemStackRenderState;
import dev.tr7zw.notenoughanimations.access.ExtendedItemStackRenderState;
Expand All @@ -33,7 +32,6 @@
//#else
//$$ import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
//#endif
//spotless:on

@Mixin(ItemInHandLayer.class)
//#if MC >= 12102
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;

//spotless:off
//#if MC >= 12100
import net.minecraft.client.DeltaTracker;
//#if MC >= 12102
Expand All @@ -26,13 +25,11 @@
//#else
//$$ import com.mojang.math.Matrix4f;
//#endif
//spotless:on

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {

@Inject(method = "renderLevel", at = @At("HEAD"))
// spotless:off
//#if MC <= 12004
//$$ private void beforeRender(PoseStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline,
//$$ Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci) {
Expand All @@ -46,15 +43,13 @@ public class LevelRendererMixin {
//#else

private void beforeRender(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker,
boolean bl, Camera camera, GameRenderer gameRenderer,
boolean bl, Camera camera, GameRenderer gameRenderer,
//#if MC <= 12103
//$$LightTexture lightTexture,
//#endif
Matrix4f matrix4f,
Matrix4f matrix4f2, CallbackInfo ci) {
Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
float tickDelta = deltaTracker.getGameTimeDeltaPartialTick(false);
//#endif
//spotless:on
//#endif
NEAnimationsLoader.INSTANCE.playerTransformer.setDeltaTick(tickDelta);
// NEAnimationsLoader.INSTANCE.playerTransformer.nextFrame();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ public abstract class PlayerEntityModelMixin extends HumanoidModel<PlayerRenderS
//#endif

public PlayerEntityModelMixin() {
// spotless:off
//#if MC >= 11700
super(null);
//#else
//$$ super(0);
//#endif
//spotless:on
//#if MC >= 11700
super(null);
//#else
//$$ super(0);
//#endif
//spotless:on

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
// spotless:off
//#if MC >= 12102
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
//#endif
Expand All @@ -22,7 +21,6 @@
//#else
//$$ import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
//#endif
//spotless:on

@Mixin(PlayerRenderer.class)
//#if MC >= 12102
Expand All @@ -33,22 +31,21 @@ public abstract class PlayerRendererMixin
//$$ extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
//#endif

// spotless:off
//#if MC >= 12102
public PlayerRendererMixin(Context context, PlayerModel model, float shadowRadius) {
super(context, model, shadowRadius);
}
//#elseif MC >= 11700
//#elseif MC >= 11700
//$$public PlayerRendererMixin(Context context, PlayerModel<AbstractClientPlayer> entityModel, float f) {
//$$ super(context, entityModel, f);
//$$}
//#else
//$$ public PlayerRendererMixin(EntityRenderDispatcher entityRenderDispatcher,
//$$ PlayerModel<AbstractClientPlayer> entityModel, float f) {
//#else
//$$ public PlayerRendererMixin(EntityRenderDispatcher entityRenderDispatcher,
//$$ PlayerModel<AbstractClientPlayer> entityModel, float f) {
//$$ super(entityRenderDispatcher, entityModel, f);
//$$ }
//#endif
//spotless:on
//$$ }
//#endif
//spotless:on

@Inject(method = "<init>*", at = @At("RETURN"))
public void onCreate(CallbackInfo info) {
Expand Down
Loading

0 comments on commit 1c52230

Please sign in to comment.