Skip to content

Commit

Permalink
Weapon + ItemMagazine
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Nov 5, 2024
1 parent e6aedce commit 71ae8f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
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
18 changes: 3 additions & 15 deletions src/main/java/com/paneedah/weaponlib/Weapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,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 @@ -150,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 @@ -223,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 @@ -257,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
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public void setupForWeapon(PlayerWeaponInstance pwi) {
hasBeenSetup = true;


int[][] guiPositions = pwi.getWeapon().builder.getGUIPositions();
int[][] guiPositions = pwi.getWeapon().builder.getGuiPositions();
for (ModificationTab tab : tabList) {
// Update custom GUI positionings
tab.setPos(guiPositions[tab.id][0], guiPositions[tab.id][1]);
Expand Down

0 comments on commit 71ae8f9

Please sign in to comment.