Skip to content

Commit

Permalink
Introduce spotless linter.
Browse files Browse the repository at this point in the history
Signed-off-by: = <[email protected]>
  • Loading branch information
bvanseg committed Mar 20, 2024
1 parent 9c22573 commit d3c251f
Show file tree
Hide file tree
Showing 281 changed files with 20,296 additions and 14,481 deletions.
18 changes: 17 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import groovy.json.JsonOutput
import groovy.json.JsonSlurper

plugins {
id 'com.diffplug.spotless' version "${spotless_version}" apply(false)
id 'fabric-loom' version "${fabric_loom_version}" apply(false)
id 'org.spongepowered.gradle.vanilla' version "${spongepowered_vanilla_gradle_version}" apply(false)
id 'org.spongepowered.mixin' version "${spongepowered_mixin_version}" apply(false)
Expand All @@ -14,6 +15,7 @@ def MAX_DISPLAY_ERRORS = "1000"

subprojects {
apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'

java.toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION)
java.withSourcesJar()
Expand Down Expand Up @@ -55,11 +57,25 @@ subprojects {
}

tasks.withType(JavaCompile).configureEach {

it.options.encoding = 'UTF-8'
it.options.getRelease().set(JAVA_VERSION)
}

spotless {
java {
eclipse().configFile("$rootDir/eclipse-formatter.xml")
endWithNewline()
importOrder("", "java", group.toString(), "\\#")
indentWithSpaces(4)
removeUnusedImports()
trimTrailingWhitespace()
}
}

tasks.build {
dependsOn("spotlessApply")
}

processResources {
def expandProps = [
"fabric_loader_version" : project.fabric_loader_version,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package mod.azure.azurelib.common.api.client.helper;

import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import mod.azure.azurelib.common.internal.client.renderer.GeoRenderer;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import org.lwjgl.glfw.GLFW;

import mod.azure.azurelib.common.internal.client.renderer.GeoRenderer;

/**
* Helper class for segregating client-side code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
package mod.azure.azurelib.common.api.client.model;

import mod.azure.azurelib.core.animatable.GeoAnimatable;
import net.minecraft.resources.ResourceLocation;

import mod.azure.azurelib.core.animatable.GeoAnimatable;

/**
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.level.block.Block Blocks}.
* Using this class pre-sorts provided asset paths into the "block" subdirectory
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.level.block.Block Blocks}. Using this class
* pre-sorts provided asset paths into the "block" subdirectory
*/
public class DefaultedBlockGeoModel<T extends GeoAnimatable> extends DefaultedGeoModel<T> {
/**
* Create a new instance of this model class.<br>
* The asset path should be the truncated relative path from the base folder.<br>
* E.G.
* <pre>{@code
* new ResourceLocation("myMod", "workbench/sawmill")
* }</pre>
*/
public DefaultedBlockGeoModel(ResourceLocation assetSubpath) {
super(assetSubpath);
}

@Override
protected String subtype() {
return "block";
}

/**
* Changes the constructor-defined model path for this model to an alternate.<br>
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture and animations for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltModel(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>)super.withAltModel(altPath);
}

/**
* Changes the constructor-defined animations path for this model to an alternate.<br>
* This is useful if your animatable shares an animations path with another animatable that differs in path to the model and texture for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltAnimations(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>)super.withAltAnimations(altPath);
}

/**
* Changes the constructor-defined texture path for this model to an alternate.<br>
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model and animations for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltTexture(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>)super.withAltTexture(altPath);
}

/**
* Create a new instance of this model class.<br>
* The asset path should be the truncated relative path from the base folder.<br>
* E.G.
*
* <pre>{@code
* new ResourceLocation("myMod", "workbench/sawmill")
* }</pre>
*/
public DefaultedBlockGeoModel(ResourceLocation assetSubpath) {
super(assetSubpath);
}

@Override
protected String subtype() {
return "block";
}

/**
* Changes the constructor-defined model path for this model to an alternate.<br>
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture
* and animations for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltModel(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>) super.withAltModel(altPath);
}

/**
* Changes the constructor-defined animations path for this model to an alternate.<br>
* This is useful if your animatable shares an animations path with another animatable that differs in path to the
* model and texture for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltAnimations(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>) super.withAltAnimations(altPath);
}

/**
* Changes the constructor-defined texture path for this model to an alternate.<br>
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model
* and animations for this model
*/
@Override
public DefaultedBlockGeoModel<T> withAltTexture(ResourceLocation altPath) {
return (DefaultedBlockGeoModel<T>) super.withAltTexture(altPath);
}
}
Original file line number Diff line number Diff line change
@@ -1,83 +1,89 @@
package mod.azure.azurelib.common.api.client.model;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;

import mod.azure.azurelib.common.internal.client.model.data.EntityModelData;
import mod.azure.azurelib.common.internal.common.constant.DataTickets;
import mod.azure.azurelib.core.animatable.GeoAnimatable;
import mod.azure.azurelib.core.animatable.model.CoreGeoBone;
import mod.azure.azurelib.core.animation.AnimationState;
import mod.azure.azurelib.common.internal.client.model.data.EntityModelData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;

/**
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.entity.Entity Entities}.
* Using this class pre-sorts provided asset paths into the "entity" subdirectory
* Additionally it can automatically handle head-turning if the entity has a "head" bone
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.entity.Entity Entities}. Using this class pre-sorts
* provided asset paths into the "entity" subdirectory Additionally it can automatically handle head-turning if the
* entity has a "head" bone
*/
public class DefaultedEntityGeoModel<T extends GeoAnimatable> extends DefaultedGeoModel<T> {
private final boolean turnsHead;

/**
* Create a new instance of this model class.<br>
* The asset path should be the truncated relative path from the base folder.<br>
* E.G.
* <pre>{@code
* new ResourceLocation("myMod", "animals/red_fish")
* }</pre>
*/
public DefaultedEntityGeoModel(ResourceLocation assetSubpath) {
this(assetSubpath, false);
}
private final boolean turnsHead;

/**
* Create a new instance of this model class.<br>
* The asset path should be the truncated relative path from the base folder.<br>
* E.G.
*
* <pre>{@code
* new ResourceLocation("myMod", "animals/red_fish")
* }</pre>
*/
public DefaultedEntityGeoModel(ResourceLocation assetSubpath) {
this(assetSubpath, false);
}

public DefaultedEntityGeoModel(ResourceLocation assetSubpath, boolean turnsHead) {
super(assetSubpath);
public DefaultedEntityGeoModel(ResourceLocation assetSubpath, boolean turnsHead) {
super(assetSubpath);

this.turnsHead = turnsHead;
}
this.turnsHead = turnsHead;
}

@Override
protected String subtype() {
return "entity";
}
@Override
protected String subtype() {
return "entity";
}

@Override
public void setCustomAnimations(T animatable, long instanceId, AnimationState<T> animationState) {
if (!this.turnsHead)
return;
@Override
public void setCustomAnimations(T animatable, long instanceId, AnimationState<T> animationState) {
if (!this.turnsHead)
return;

CoreGeoBone head = getAnimationProcessor().getBone("head");
CoreGeoBone head = getAnimationProcessor().getBone("head");

if (head != null) {
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);
if (head != null) {
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);

head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD);
head.setRotY(entityData.netHeadYaw() * Mth.DEG_TO_RAD);
}
}
head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD);
head.setRotY(entityData.netHeadYaw() * Mth.DEG_TO_RAD);
}
}

/**
* Changes the constructor-defined model path for this model to an alternate.<br>
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture and animations for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltModel(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>)super.withAltModel(altPath);
}
/**
* Changes the constructor-defined model path for this model to an alternate.<br>
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture
* and animations for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltModel(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>) super.withAltModel(altPath);
}

/**
* Changes the constructor-defined animations path for this model to an alternate.<br>
* This is useful if your animatable shares an animations path with another animatable that differs in path to the model and texture for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltAnimations(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>)super.withAltAnimations(altPath);
}
/**
* Changes the constructor-defined animations path for this model to an alternate.<br>
* This is useful if your animatable shares an animations path with another animatable that differs in path to the
* model and texture for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltAnimations(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>) super.withAltAnimations(altPath);
}

/**
* Changes the constructor-defined texture path for this model to an alternate.<br>
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model and animations for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltTexture(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>)super.withAltTexture(altPath);
}
/**
* Changes the constructor-defined texture path for this model to an alternate.<br>
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model
* and animations for this model
*/
@Override
public DefaultedEntityGeoModel<T> withAltTexture(ResourceLocation altPath) {
return (DefaultedEntityGeoModel<T>) super.withAltTexture(altPath);
}
}
Loading

0 comments on commit d3c251f

Please sign in to comment.