Skip to content

Commit

Permalink
Lombokify (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium authored Nov 11, 2024
1 parent 57e665c commit e637f05
Show file tree
Hide file tree
Showing 36 changed files with 179 additions and 960 deletions.
41 changes: 9 additions & 32 deletions src/main/java/com/paneedah/weaponlib/CustomArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 withModelSupplier(Function<Integer, ModelBiped> modelFactory) {

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));
return this;
}

Expand Down Expand Up @@ -420,7 +421,7 @@ public CustomArmor buildBoots(boolean isClient) {

//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 @@ public CustomArmor buildBoots(boolean isClient) {
//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,10 +646,6 @@ public boolean hasNightVision() {
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`
Expand Down Expand Up @@ -784,26 +781,6 @@ public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource s
}
}

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
Expand Up @@ -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 @@ public static class Builder {
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 @@ public static class Builder {
long pumpTimeoutMilliseconds;
long burstTimeoutMilliseconds = Weapon.DEFAULT_BURST_TIMEOUT_MILLISECONDS;

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

int pellets = 1;

Expand Down Expand Up @@ -222,7 +223,7 @@ public static class Builder {

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 @@ public Builder hasGUIPositions(int[][] gp) {
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 @@ -1022,24 +1011,24 @@ public Weapon build(ModContext modContext) {

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 CraftingEntry[] getModernRecipe() {
}


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 @@ -1601,10 +1537,6 @@ public float getRecoil() {
return BalancePackManager.shouldChangeWeaponRecoil(this) ? (float) BalancePackManager.getNewWeaponRecoil(this) : builder.recoil;
}

public ModContext getModContext() {
return modContext;
}

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

0 comments on commit e637f05

Please sign in to comment.