Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lombokify #524

Merged
merged 26 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
057f062
SpriteSheetTools + BalancePackManager
strubium Nov 4, 2024
c85b8f2
Panel + Slider
strubium Nov 4, 2024
1b50b87
Button + Tuple + WeaponResourcePack
strubium Nov 4, 2024
ce75e98
AnimationGUI + AnimationSet + Weapon + Textbar
strubium Nov 4, 2024
81f5ea0
Weapon
strubium Nov 4, 2024
43e5c62
ModernAnimator + LerpedValue
strubium Nov 4, 2024
69c6fbc
Delete ICloneable
strubium Nov 4, 2024
3ccd5c9
WeaponRenderer + remove some unused imports
strubium Nov 5, 2024
e6aedce
GUIButtonCustom + VehiclePhysSerializer
strubium Nov 5, 2024
71ae8f9
Weapon + ItemMagazine
strubium Nov 5, 2024
d89924f
GrenadeRenderer
strubium Nov 5, 2024
b4a079a
MeleeRenderer + Transition
strubium Nov 5, 2024
0de88ed
AnimationData + OpenGLSelectionHelper
strubium Nov 5, 2024
a1875d3
DebugPositioner + Interpolation + DebugCommand
strubium Nov 5, 2024
f42fc60
CustomArmor + EntityVehicleConfiguration
strubium Nov 5, 2024
21a26e1
MultipartTransition
strubium Nov 9, 2024
75872bb
Switch to new NetworkUtil, + AttachmentCategory and GUIContainerStation
strubium Nov 9, 2024
7445467
Invert the import
strubium Nov 10, 2024
5ed1d8f
Discard changes to src/main/java/com/paneedah/mwc/vehicle/AE86TruenoFโ€ฆ
Desoroxxx Nov 10, 2024
fea07b0
Discard changes to src/main/java/com/paneedah/mwc/vehicle/JLTVM1280Faโ€ฆ
Desoroxxx Nov 10, 2024
cf4a12e
Discard changes to src/main/java/com/paneedah/mwc/vehicle/ATVFactory.โ€ฆ
Desoroxxx Nov 10, 2024
97e3505
Discard changes to src/main/java/com/paneedah/mwc/vehicle/AudiS4Factoโ€ฆ
Desoroxxx Nov 10, 2024
0514818
Discard changes to src/main/java/com/paneedah/mwc/vehicle/McLarenSennโ€ฆ
Desoroxxx Nov 10, 2024
b870bd1
Discard changes to src/main/java/com/paneedah/mwc/vehicle/SampleVehicโ€ฆ
Desoroxxx Nov 10, 2024
432583b
Fix
strubium Nov 11, 2024
213d5c5
Fix 2
strubium Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 9 additions & 32 deletions src/main/java/com/paneedah/weaponlib/CustomArmor.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paneedah.weaponlib;

Check notice on line 1 in src/main/java/com/paneedah/weaponlib/CustomArmor.java

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (next)

โœ… No longer an issue: Low Cohesion

The number of different responsibilities in this module is no longer above the threshold

import com.paneedah.weaponlib.crafting.CraftingEntry;
import com.paneedah.weaponlib.crafting.CraftingGroup;
Expand All @@ -6,6 +6,7 @@
import com.paneedah.weaponlib.crafting.IModernCraftingRecipe;
import com.paneedah.weaponlib.model.ModelBaseRendererWrapper;
import com.paneedah.weaponlib.model.WrappableModel;
import lombok.Getter;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
Expand Down Expand Up @@ -197,8 +198,8 @@

public Builder withCompatibleAttachment(AttachmentCategory category, ModelBase attachmentModel, String textureName,
Consumer<ModelBase> positioner) {
ItemAttachment<CustomArmor> item = new ItemAttachment<CustomArmor>(category, attachmentModel, textureName, null);
compatibleAttachments.put(item, new CompatibleAttachment<CustomArmor>(item, positioner));
ItemAttachment<CustomArmor> item = new ItemAttachment<>(category, attachmentModel, textureName, null);
compatibleAttachments.put(item, new CompatibleAttachment<>(item, positioner));
Desoroxxx marked this conversation as resolved.
Show resolved Hide resolved
return this;
}

Expand Down Expand Up @@ -233,7 +234,7 @@

public void build(boolean isClient) {

// if(FMLCommonHandler.instance().getSide().isClient()) {

Check notice on line 237 in src/main/java/com/paneedah/weaponlib/CustomArmor.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Commented out code

Commented out code (13 lines)
// try {
// chestModel = (ModelBiped) Class.forName(modelClassName).newInstance();
// } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
Expand Down Expand Up @@ -420,7 +421,7 @@

//private EntityEquipmentSlot slot;
private boolean hasNightVision;
private boolean vignetteEnabled;
@Getter private boolean vignetteEnabled;
private float exposureReductionFactor;

private SoundEvent breathingSound;
Expand All @@ -429,12 +430,12 @@
//private boolean shieldEnabled;
private long shieldRegenerationTimeout = 1000;
private double shieldRegenerationRate = 1.0; // restored shield capacity per sec
private double maxShieldCapacity;
@Getter private double maxShieldCapacity;
private final String unlocalizedArmorSetName;
private double shieldIndicatorPositionX;
private double shieldIndicatorPositionY;
private double shieldIndicatorWidth;
private double shieldIndicatorHeight;
@Getter private double shieldIndicatorPositionX;
@Getter private double shieldIndicatorPositionY;
@Getter private double shieldIndicatorWidth;
@Getter private double shieldIndicatorHeight;
private String shieldIndicatorMaskTextureName;
private String shieldIndicatorProgressBarTextureName;

Expand Down Expand Up @@ -645,13 +646,9 @@
return hasNightVision;
}

public boolean isVignetteEnabled() {
return vignetteEnabled;
}

@Override
public Function<Float, Float> getAbsorbFunction(Spreadable spreadable) {
return dose -> dose * (1f - exposureReductionFactor);

Check warning on line 651 in src/main/java/com/paneedah/weaponlib/CustomArmor.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `dose * (1f - exposureReductionFactor)`

Check warning on line 651 in src/main/java/com/paneedah/weaponlib/CustomArmor.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-unboxing

Auto-unboxing `dose`
}

@Override
Expand Down Expand Up @@ -784,26 +781,6 @@
}
}

public double getMaxShieldCapacity() {
return maxShieldCapacity;
}

public double getShieldIndicatorPositionX() {
return shieldIndicatorPositionX;
}

public double getShieldIndicatorPositionY() {
return shieldIndicatorPositionY;
}

public double getShieldIndicatorWidth() {
return shieldIndicatorWidth;
}

public double getShieldIndicatorHeight() {
return shieldIndicatorHeight;
}

@Override
public CraftingEntry[] getModernRecipe() {
return this.modernRecipe;
Expand Down
25 changes: 5 additions & 20 deletions src/main/java/com/paneedah/weaponlib/ItemMagazine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.paneedah.weaponlib;

import lombok.Getter;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -64,10 +65,10 @@ protected ItemAttachment<Weapon> createAttachment(ModContext modContext) {

private ModContext modContext;

private final int capacity;
private List<ItemBullet> compatibleBullets;
private SoundEvent reloadSound;
private SoundEvent unloadSound;
@Getter private final int capacity;
@Getter private List<ItemBullet> compatibleBullets;
@Getter private SoundEvent reloadSound;
@Getter private SoundEvent unloadSound;

ItemMagazine(ModelBase model, String textureName, int capacity) {
this(model, textureName, capacity, null, null);
Expand Down Expand Up @@ -103,22 +104,6 @@ public void onCreated(ItemStack stack, World world, EntityPlayer player) {
initializeTag(stack, 0);
}

public List<ItemBullet> getCompatibleBullets() {
return compatibleBullets;
}

public int getCapacity() {
return capacity;
}

public SoundEvent getReloadSound() {
return reloadSound;
}

public SoundEvent getUnloadSound() {
return unloadSound;
}

@Override
public Part getRenderablePart() {
return this;
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/com/paneedah/weaponlib/Tuple.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.paneedah.weaponlib;

import lombok.Getter;
import lombok.Setter;

@Setter @Getter
public final class Tuple<U, V> {

private U u;
Expand All @@ -11,20 +15,4 @@ public Tuple(U u, V v) {
this.v = v;
}

public U getU() {
return u;
}

public void setU(U u) {
this.u = u;
}

public V getV() {
return v;
}

public void setV(V v) {
this.v = v;
}

}
104 changes: 18 additions & 86 deletions src/main/java/com/paneedah/weaponlib/Weapon.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paneedah.weaponlib;

Check notice on line 1 in src/main/java/com/paneedah/weaponlib/Weapon.java

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (next)

โœ… Getting better: Lines of Code in a Single File

The lines of code decreases from 1104 to 1053, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in src/main/java/com/paneedah/weaponlib/Weapon.java

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (next)

โœ… Getting better: Number of Functions in a Single Module

The number of functions decreases from 205 to 188, threshold = 75. This file contains too many functions. Beyond a certain threshold, more functions lower the code health.

import com.paneedah.mwc.network.messages.BlockHitMessage;
import com.paneedah.weaponlib.animation.ScreenShakeAnimation;
Expand All @@ -14,6 +14,7 @@
import com.paneedah.weaponlib.render.shells.ShellParticleSimulator.Shell.Type;
import dev.redstudio.redcore.utils.DecimalUtils;
import io.redstudioragnarok.redcore.vectors.Vector3F;
import lombok.Getter;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.model.ModelBase;
Expand Down Expand Up @@ -114,7 +115,7 @@
private CreativeTabs creativeTab;
private WeaponRenderer renderer;
//float zoom = Weapon.DEFAULT_ZOOM;
List<Integer> maxShots = new ArrayList<>();
@Getter List<Integer> maxShots = new ArrayList<>();
String crosshair;
String crosshairRunning;
String crosshairZoomed;
Expand Down Expand Up @@ -149,7 +150,7 @@
long pumpTimeoutMilliseconds;
long burstTimeoutMilliseconds = Weapon.DEFAULT_BURST_TIMEOUT_MILLISECONDS;

private float inaccuracy = DEFAULT_INACCURACY;
@Getter private float inaccuracy = DEFAULT_INACCURACY;

int pellets = 1;

Expand All @@ -163,15 +164,15 @@

float flashIntensity = 0.2f;

Supplier<Float> flashScale = () -> 1f;

Check warning on line 167 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `1f`

Supplier<Float> flashOffsetX = () -> 0f;

Check warning on line 169 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `0f`

Supplier<Float> flashOffsetY = () -> 0f;

Check warning on line 171 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `0f`

Supplier<Float> smokeOffsetX = () -> 0f;

Check warning on line 173 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `0f`

Supplier<Float> smokeOffsetY = () -> 0f;

Check warning on line 175 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `0f`

long unloadingTimeout = Weapon.DEFAULT_UNLOADING_TIMEOUT_TICKS;

Expand Down Expand Up @@ -218,11 +219,11 @@
private float zoom;


protected Pair<Double, Double> screenShakingParameters = new Pair<Double, Double>(100.0, 1.0);

Check warning on line 222 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `100.0`

Check warning on line 222 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `1.0`

private boolean newSys = false;

private int[][] guiPositions = new int[][]{{-43, 86}, {97, 96}, {92, 34}, {14, -55}, {164, -26}, {145, 67}, {60, 110}, {0, -50}, {-100, -50}, {-29, 44}, {50, 100}};
@Getter private int[][] guiPositions = new int[][]{{-43, 86}, {97, 96}, {92, 34}, {14, -55}, {164, -26}, {145, 67}, {60, 110}, {0, -50}, {-100, -50}, {-29, 44}, {50, 100}};


public Builder() {
Expand Down Expand Up @@ -256,22 +257,10 @@
return this;
}

public List<Integer> getMaxShots() {
return this.maxShots;
}

public int[][] getGUIPositions() {
return this.guiPositions;
}

public float getFirerate() {
return this.fireRate;
}

public float getInaccuracy() {
return this.inaccuracy;
}

public Builder hasFlashPedals() {
this.hasFlashPedals = true;
return this;
Expand Down Expand Up @@ -345,7 +334,7 @@

public Builder withMaxShots(int... maxShots) {
for (int m : maxShots) {
this.maxShots.add(m);

Check warning on line 337 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `m`
}
return this;
}
Expand Down Expand Up @@ -777,7 +766,7 @@
}

public Builder withModernScreenShaking(double intensity, double speedModifier) {
this.screenShakingParameters = new Pair<Double, Double>(intensity, speedModifier);

Check warning on line 769 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `intensity`

Check warning on line 769 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `speedModifier`
return this;
}

Expand Down Expand Up @@ -912,7 +901,7 @@
}

if (maxShots.isEmpty()) {
maxShots.add(Integer.MAX_VALUE);

Check warning on line 904 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-boxing

Auto-boxing `Integer.MAX_VALUE`
}

Weapon weapon = new Weapon(this, modContext);
Expand Down Expand Up @@ -1022,24 +1011,24 @@

public Builder builder;

private final ModContext modContext;
@Getter private final ModContext modContext;

private Vec3d muzzlePosition;
@Getter private Vec3d muzzlePosition;

private CraftingEntry[] modernRecipe;

private SoundEvent shootSound;
private SoundEvent endOfShootSound;
private SoundEvent silencedShootSound;
private SoundEvent reloadSound;
private SoundEvent reloadIterationSound;
private SoundEvent inspectSound;
private SoundEvent drawSound;
private SoundEvent allReloadIterationsCompletedSound;
private SoundEvent unloadSound;
private SoundEvent ejectSpentRoundSound;
private SoundEvent burstShootSound;
private SoundEvent silencedBurstShootSound;
@Getter private SoundEvent shootSound;
@Getter private SoundEvent endOfShootSound;
@Getter private SoundEvent silencedShootSound;
@Getter private SoundEvent reloadSound;
@Getter private SoundEvent reloadIterationSound;
@Getter private SoundEvent inspectSound;
@Getter private SoundEvent drawSound;
@Getter private SoundEvent allReloadIterationsCompletedSound;
@Getter private SoundEvent unloadSound;
@Getter private SoundEvent ejectSpentRoundSound;
@Getter private SoundEvent burstShootSound;
@Getter private SoundEvent silencedBurstShootSound;

public enum State {READY, SHOOTING, RELOAD_REQUESTED, RELOAD_CONFIRMED, UNLOAD_STARTED, UNLOAD_REQUESTED_FROM_SERVER, UNLOAD_CONFIRMED, PAUSED, MODIFYING, EJECT_SPENT_ROUND}

Expand Down Expand Up @@ -1071,59 +1060,6 @@
}


public SoundEvent getShootSound() {
return shootSound;
}

public SoundEvent getBurstShootSound() {
return burstShootSound;
}

public SoundEvent getSilencedBurstShootSound() {
return silencedBurstShootSound;
}

public SoundEvent getEndOfShootSound() {
return endOfShootSound;
}

public SoundEvent getSilencedShootSound() {
return silencedShootSound;
}

public SoundEvent getReloadSound() {
return reloadSound;
}


public SoundEvent getReloadIterationSound() {
return reloadIterationSound;
}

public SoundEvent getInspectSound() {
return inspectSound;
}

public SoundEvent getDrawSound() {
return drawSound;
}

public SoundEvent getAllReloadIterationsCompletedSound() {
return allReloadIterationsCompletedSound;
}

public SoundEvent getUnloadSound() {
return unloadSound;
}

public SoundEvent getEjectSpentRoundSound() {
return ejectSpentRoundSound;
}

public Vec3d getMuzzlePosition() {
return this.muzzlePosition;
}

@Override
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack itemStack) {
return true;
Expand Down Expand Up @@ -1415,7 +1351,7 @@
instance.setState(WeaponState.READY);

instance.setRecoil(BalancePackManager.shouldChangeWeaponRecoil(instance.getWeapon()) ? (float) BalancePackManager.getNewWeaponRecoil(instance.getWeapon()) : builder.recoil);
instance.setMaxShots(builder.maxShots.get(0));

Check warning on line 1354 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-unboxing

Auto-unboxing `builder.maxShots.get(0)`

for (CompatibleAttachment<Weapon> compatibleAttachment : ((Weapon) itemStack.getItem()).getCompatibleAttachments().values()) {
ItemAttachment<Weapon> attachment = compatibleAttachment.getAttachment();
Expand Down Expand Up @@ -1447,15 +1383,15 @@
Iterator<Integer> it = maxShotsList.iterator();
// Iterator<Integer> it = builder.maxShots.iterator();
while (it.hasNext()) {
if (instance.getMaxShots() == it.next()) {

Check warning on line 1386 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-unboxing

Auto-unboxing `it.next()`
break;
}
}

if (it.hasNext()) {
result = it.next();

Check warning on line 1392 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-unboxing

Auto-unboxing `it.next()`
} else {
result = maxShotsList.get(0);

Check warning on line 1394 in src/main/java/com/paneedah/weaponlib/Weapon.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Auto-unboxing

Auto-unboxing `maxShotsList.get(0)`
}

instance.setMaxShots(result);
Expand Down Expand Up @@ -1601,10 +1537,6 @@
return BalancePackManager.shouldChangeWeaponRecoil(this) ? (float) BalancePackManager.getNewWeaponRecoil(this) : builder.recoil;
}

public ModContext getModContext() {
return modContext;
}

public float getShellCasingVerticalOffset() {
return builder.shellCasingVerticalOffset;
}
Expand Down
Loading
Loading