aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authorAlexdoru <57050655+Alexdoru@users.noreply.github.com>2024-10-02 07:31:08 +0200
committerGitHub <noreply@github.com>2024-10-02 05:31:08 +0000
commit3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3 (patch)
tree107d9d2442891990ef1cdef1d8bb2df6bb96952a /src/main/java/gtPlusPlus/core/item
parentbfc7b2b07f72d0903a70791ff96f9c837ddd5ff0 (diff)
downloadGT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.gz
GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.bz2
GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.zip
Cleanup the codebase (#3311)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/item')
-rw-r--r--src/main/java/gtPlusPlus/core/item/ModItems.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java20
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java16
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java3
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java9
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java6
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOld.java4
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java9
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java4
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java17
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java4
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java4
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java37
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java9
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/circuit/GTPPIntegratedCircuitItem.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java6
-rw-r--r--src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java9
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java7
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java15
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java3
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java9
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemMagicFeather.java2
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java111
-rw-r--r--src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java12
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/ItemGregtechPump.java34
33 files changed, 151 insertions, 244 deletions
diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java
index a7fe8ced30..49a22bc8a8 100644
--- a/src/main/java/gtPlusPlus/core/item/ModItems.java
+++ b/src/main/java/gtPlusPlus/core/item/ModItems.java
@@ -582,7 +582,7 @@ public final class ModItems {
// LFTR Control Circuit
itemCircuitLFTR = new CoreItem(
"itemCircuitLFTR",
- "" + EnumChatFormatting.GREEN + "Control Circuit",
+ EnumChatFormatting.GREEN + "Control Circuit",
AddToCreativeTab.tabMisc,
1,
0,
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java
index 3ce461ffab..f79b20ccb9 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java
@@ -16,7 +16,7 @@ public class BaseItemBurnable extends CoreItem {
super(unlocalizedName, creativeTab, stackSize, maxDmg, description);
this.itemName = displayName;
this.meta = meta;
- if (oredictName != null && !oredictName.equals("")) {
+ if (oredictName != null && !oredictName.isEmpty()) {
registerOrdictionary(oredictName);
}
registerFuel(burnTime);
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
index 07744c5c2e..ba98bb25b7 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -231,9 +231,7 @@ public class BaseItemComponent extends Item {
}
}
- if ((this.materialName != null) && (this.materialName != "")
- && !this.materialName.equals("")
- && (this.componentMaterial != null)) {
+ if (this.materialName != null && !this.materialName.isEmpty() && (this.componentMaterial != null)) {
if (this.componentMaterial != null) {
if (!this.componentMaterial.vChemicalFormula.contains("?")) {
@@ -255,10 +253,8 @@ public class BaseItemComponent extends Item {
}
if (this.componentType == ComponentTypes.INGOT || this.componentType == ComponentTypes.HOTINGOT) {
- if ((this.materialName != null) && (this.materialName != "")
- && !this.materialName.equals("")
- && this.unlocalName.toLowerCase()
- .contains("hot")) {
+ if (this.unlocalName.toLowerCase()
+ .contains("hot")) {
list.add(
EnumChatFormatting.GRAY + "Warning: "
+ EnumChatFormatting.RED
@@ -269,7 +265,7 @@ public class BaseItemComponent extends Item {
}
} else {
String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase());
- if (aChemicalFormula != null && aChemicalFormula.length() > 0) {
+ if (aChemicalFormula != null && !aChemicalFormula.isEmpty()) {
list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula));
}
}
@@ -300,7 +296,6 @@ public class BaseItemComponent extends Item {
super.addInformation(stack, aPlayer, list, bool);
}
- @SuppressWarnings("unchecked")
@Override
public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
final boolean p_77663_5_) {
@@ -325,10 +320,9 @@ public class BaseItemComponent extends Item {
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
- return (Configuration.visual.useGregtechTextures ? true : false);
+ return Configuration.visual.useGregtechTextures;
}
- @SuppressWarnings("unchecked")
@Override
public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
@@ -402,7 +396,7 @@ public class BaseItemComponent extends Item {
}
}
- public static enum ComponentTypes {
+ public enum ComponentTypes {
DUST("Dust", "@ Dust", "dust", OrePrefixes.dust),
DUSTSMALL("DustSmall", "Small Pile of @ Dust", "dustSmall", OrePrefixes.dustSmall),
@@ -434,7 +428,7 @@ public class BaseItemComponent extends Item {
private final String OREDICT_NAME;
private final OrePrefixes a_GT_EQUAL;
- private ComponentTypes(final String LocalName, final String DisplayName, final String OreDictName,
+ ComponentTypes(final String LocalName, final String DisplayName, final String OreDictName,
final OrePrefixes aPrefix) {
this.COMPONENT_NAME = LocalName;
this.DISPLAY_NAME = DisplayName;
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java
index 9a4109a1de..fb24fbf2f1 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java
@@ -86,7 +86,7 @@ public class BaseItemDamageable extends Item {
@Override
public String getItemStackDisplayName(final ItemStack tItem) {
- if ((this.itemName == null) || this.itemName.equals("")) {
+ if ((this.itemName == null) || this.itemName.isEmpty()) {
return super.getItemStackDisplayName(tItem);
}
return this.itemName;
@@ -101,7 +101,7 @@ public class BaseItemDamageable extends Item {
return true;
}
- public static final long getItemDamage(final ItemStack aStack) {
+ public static long getItemDamage(final ItemStack aStack) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("Damage");
@@ -114,7 +114,7 @@ public class BaseItemDamageable extends Item {
return 0L;
}
- public static final boolean setItemDamage(final ItemStack aStack, final long aDamage) {
+ public static boolean setItemDamage(final ItemStack aStack, final long aDamage) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("Damage");
@@ -142,11 +142,7 @@ public class BaseItemDamageable extends Item {
@Override
public boolean showDurabilityBar(ItemStack stack) {
int dmg = (int) getItemDamage(stack);
- if (dmg <= 20) {
- return false;
- } else {
- return true;
- }
+ return dmg > 20;
}
public static ItemStack damageItem(ItemStack item) {
@@ -154,10 +150,8 @@ public class BaseItemDamageable extends Item {
long currentUse = BaseItemDamageable.getItemDamage(item);
if (currentUse >= 0 && currentUse <= 250) {
BaseItemDamageable.setItemDamage(item, currentUse + 1);
- return item;
- } else {
- return item;
}
+ return item;
}
return null;
}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java
index 8417eba3d1..8c2473aafe 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java
@@ -285,8 +285,7 @@ public class BaseItemTickable extends CoreItem {
return 0;
}
double currentDamage = getTicks(null, stack);
- double durabilitypercent = currentDamage / getMaxTicks(stack);
- return durabilitypercent;
+ return currentDamage / getMaxTicks(stack);
}
@SuppressWarnings("unchecked")
diff --git a/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
index b564d60424..0d7710e651 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
@@ -10,7 +10,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemMonsterPlacer;
@@ -58,7 +57,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer {
/**
* Callback for item usage. If the item does something special on right clicking,
- *
+ * <p>
* he will have one of those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
@Override
@@ -94,7 +93,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer {
/**
* Called whenever this item is equipped and the right mouse button is pressed.
- *
+ * <p>
* Args: itemStack, world, entityPlayer
*/
@Override
@@ -143,7 +142,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer {
/**
* Spawns the creature specified by the egg's type in the location specified by
- *
+ * <p>
* the last three parameters. Parameters: world, entityID, x, y, z.
*/
public Entity spawnEntity(final World parWorld, final double parX, final double parY, final double parZ) {
@@ -162,7 +161,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer {
0.0F);
parWorld.spawnEntityInWorld(this.entityToSpawn);
- this.entityToSpawn.onSpawnWithEgg((IEntityLivingData) null);
+ this.entityToSpawn.onSpawnWithEgg(null);
this.entityToSpawn.playLivingSound();
} else {
// DEBUG
diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
index 451a5b1290..e9f1d87ede 100644
--- a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
+++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
@@ -23,7 +23,7 @@ public class BaseItemCell extends BaseItemComponent {
public BaseItemCell(final Material material) {
super(material, BaseItemComponent.ComponentTypes.CELL);
- this.fluidColour = (short[]) material.getRGBA();
+ this.fluidColour = material.getRGBA();
}
public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa) {
diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java
index 151f3f3860..5d61f36ce3 100644
--- a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java
+++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java
@@ -26,7 +26,7 @@ public class BaseItemPlasmaCell extends BaseItemComponent {
public BaseItemPlasmaCell(final Material material) {
super(material, ComponentTypes.PLASMACELL);
- this.fluidColour = (short[]) material.getRGBA();
+ this.fluidColour = material.getRGBA();
}
@Override
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
index fd52fe78c4..d230115129 100644
--- a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material;
public class BaseItemDust extends BaseItemComponent {
- private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2];
+ private final BaseItemComponent[] mSizedDusts = new BaseItemComponent[2];
public BaseItemDust(Material aMat) {
this(aMat, true);
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index bcb56795bc..7b3c8cbd28 100644
--- a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -44,7 +44,7 @@ public class BaseItemDustUnique extends Item {
this.setCreativeTab(tabMisc);
this.colour = colour;
this.materialName = materialName;
- if (mChemicalFormula == null || mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")) {
+ if (mChemicalFormula == null || mChemicalFormula.isEmpty() || mChemicalFormula.equals("NullFormula")) {
this.chemicalNotation = StringUtils.subscript(materialName);
} else {
this.chemicalNotation = StringUtils.subscript(mChemicalFormula);
@@ -84,7 +84,7 @@ public class BaseItemDustUnique extends Item {
temp = temp.replace("itemD", "d");
Logger.WARNING("Generating OreDict Name: " + temp);
}
- if ((temp != null) && !temp.equals("")) {
+ if ((temp != null) && !temp.isEmpty()) {
GTOreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
registerComponent();
@@ -144,7 +144,7 @@ public class BaseItemDustUnique extends Item {
if (this.sRadiation > 0) {
list.add(GTPPCore.GT_Tooltip_Radioactive.get());
}
- if (this.chemicalNotation.length() > 0 && !chemicalNotation.equals("")
+ if (!this.chemicalNotation.isEmpty() && !chemicalNotation.isEmpty()
&& !chemicalNotation.equals("NullFormula")) {
list.add(this.chemicalNotation);
}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
index cb227a9423..c9377cba27 100644
--- a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
+++ b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
@@ -26,7 +26,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
public class BaseItemIngotHot extends BaseItemIngot {
private final ItemStack outputIngot;
- private int tickCounter = 0;
+ private final int tickCounter = 0;
private final int tickCounterMax = 200;
private final int mTier;
@@ -66,7 +66,7 @@ public class BaseItemIngotHot extends BaseItemIngot {
public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
final boolean p_77663_5_) {
if (this.componentMaterial != null) {
- if (entityHolding != null && entityHolding instanceof EntityPlayer) {
+ if (entityHolding instanceof EntityPlayer) {
if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode) {
EntityUtils.applyHeatDamageToEntity(1, world, entityHolding);
}
@@ -78,11 +78,7 @@ public class BaseItemIngotHot extends BaseItemIngot {
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
- if (Configuration.visual.useGregtechTextures) {
- return true;
- } else {
- return false;
- }
+ return Configuration.visual.useGregtechTextures;
}
@Override
diff --git a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOld.java b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOld.java
index 28407a4557..827adb9bc3 100644
--- a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOld.java
+++ b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOld.java
@@ -41,7 +41,7 @@ public class BaseItemIngotOld extends Item {
} else if (this.unlocalName.contains("itemHotIngot")) {
temp = this.unlocalName.replace("itemHotIngot", "ingotHot");
}
- if ((temp != null) && !temp.equals("")) {
+ if ((temp != null) && !temp.isEmpty()) {
GTOreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
// this.generateCompressorRecipe();
@@ -80,7 +80,7 @@ public class BaseItemIngotOld extends Item {
}
temp = temp.replace("itemIngot", "block");
Logger.WARNING("Generating OreDict Name: " + temp);
- if ((temp != null) && !temp.equals("")) {
+ if ((temp != null) && !temp.isEmpty()) {
tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
if (tempOutput != null) {
GTValues.RA.stdBuilder()
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
index 240c0851e1..41f3a2bf73 100644
--- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
@@ -13,21 +13,20 @@ import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.api.interfaces.ITileTooltip;
public class ItemBlockMeta extends ItemBlockWithMetadata {
private final Block mBlock;
- private HashMap<Integer, ArrayList<String>> aTooltips = new LinkedHashMap<>();
+ private final HashMap<Integer, ArrayList<String>> aTooltips = new LinkedHashMap<>();
public ItemBlockMeta(final Block aBlock) {
super(aBlock, aBlock);
this.mBlock = aBlock;
this.setMaxDamage(0);
this.setHasSubtypes(true);
- if (aBlock instanceof ITileTooltip aTooltip) {
- // aTooltips.put(aTooltip.getTooltipID(), aTooltip.getTooltipMap());
- }
+ // if (aBlock instanceof ITileTooltip aTooltip) {
+ // aTooltips.put(aTooltip.getTooltipID(), aTooltip.getTooltipMap());
+ // }
}
@SuppressWarnings({ "unchecked", "rawtypes" })
diff --git a/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java
index 6c8e0ce81a..7f6f57223d 100644
--- a/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java
+++ b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java
@@ -119,7 +119,7 @@ public class BaseItemMisc extends Item {
// Nothing Fancy here yet.
}
- public static enum MiscTypes {
+ public enum MiscTypes {
POTION("Potion", " Potion", "potion"),
KEY("Key", " Key", "key"),
@@ -133,7 +133,7 @@ public class BaseItemMisc extends Item {
private final String DISPLAY_NAME_SUFFIX;
private final String OREDICT_PREFIX;
- private MiscTypes(final String LocalName, final String DisplayNameSuffix, final String OreDictPrefix) {
+ MiscTypes(final String LocalName, final String DisplayNameSuffix, final String OreDictPrefix) {
this.TYPE = LocalName;
this.DISPLAY_NAME_SUFFIX = DisplayNameSuffix;
this.OREDICT_PREFIX = OreDictPrefix;
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
index 45ba089f15..01294556f7 100644
--- a/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -112,7 +112,7 @@ public class BaseOreComponent extends Item {
@Override
public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list,
final boolean bool) {
- if (this.materialName != null && !this.materialName.equals("")) {
+ if (this.materialName != null && !this.materialName.isEmpty()) {
if (this.componentMaterial != null) {
if (!this.componentMaterial.vChemicalFormula.contains("?")) {
list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula));
@@ -133,7 +133,7 @@ public class BaseOreComponent extends Item {
}
} else {
String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase());
- if (aChemicalFormula != null && aChemicalFormula.length() > 0) {
+ if (aChemicalFormula != null && !aChemicalFormula.isEmpty()) {
list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula));
}
}
@@ -166,10 +166,7 @@ public class BaseOreComponent extends Item {
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
- if (this.componentType.hasOverlay()) {
- return true;
- }
- return false;
+ return this.componentType.hasOverlay();
}
@Override
@@ -209,7 +206,6 @@ public class BaseOreComponent extends Item {
if (renderPass == 1) {
return Utils.rgbtoHexValue(230, 230, 230);
}
- return this.componentColour;
} else {
if (renderPass == 0 && !Configuration.visual.useGregtechTextures) {
return this.componentColour;
@@ -217,8 +213,8 @@ public class BaseOreComponent extends Item {
if (renderPass == 1 && Configuration.visual.useGregtechTextures) {
return Utils.rgbtoHexValue(230, 230, 230);
}
- return this.componentColour;
}
+ return this.componentColour;
}
@Override
@@ -229,7 +225,7 @@ public class BaseOreComponent extends Item {
return this.overlay;
}
- public static enum ComponentTypes {
+ public enum ComponentTypes {
DUST("dust", "", " Dust", true),
DUSTIMPURE("dustImpure", "Impure ", " Dust", true),
@@ -245,8 +241,7 @@ public class BaseOreComponent extends Item {
private final String DISPLAY_NAME;
private final boolean HAS_OVERLAY;
- private ComponentTypes(final String LocalName, final String prefix, final String DisplayName,
- final boolean overlay) {
+ ComponentTypes(final String LocalName, final String prefix, final String DisplayName, final boolean overlay) {
this.COMPONENT_NAME = LocalName;
this.PREFIX = prefix;
this.DISPLAY_NAME = DisplayName;
diff --git a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java
index 0279a396de..d36207c1d1 100644
--- a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java
+++ b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java
@@ -42,7 +42,7 @@ public class BaseItemPlate_OLD extends Item {
this.setMaxStackSize(64);
this.colour = colour;
this.materialName = materialName;
- if (mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")) {
+ if (mChemicalFormula.isEmpty() || mChemicalFormula.equals("NullFormula")) {
this.chemicalNotation = StringUtils.subscript(materialName);
} else {
this.chemicalNotation = StringUtils.subscript(mChemicalFormula);
@@ -53,7 +53,7 @@ public class BaseItemPlate_OLD extends Item {
if (this.unlocalName.toLowerCase()
.contains("itemplate")) {
temp = this.unlocalName.replace("itemP", "p");
- if ((temp != null) && !temp.equals("")) {
+ if ((temp != null) && !temp.isEmpty()) {
GTOreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java
index f1184fb5bb..658ce1a535 100644
--- a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java
+++ b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java
@@ -29,9 +29,9 @@ public class BaseBauble extends Item implements IBauble {
/**
* Implementation suggestions taken from Botania.
*/
- private BaubleType mThisBauble;
+ private final BaubleType mThisBauble;
- private List<String> damageNegations = new ArrayList<>();
+ private final List<String> damageNegations = new ArrayList<>();
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
public BaseBauble(BaubleType type) {
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java
index 01cd0ec0c1..efe18ed70c 100644
--- a/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java
+++ b/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java
@@ -135,7 +135,7 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble {
try {
if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) {
- // Try Iterate Armour Slots of Player
+ // Try To Iterate Armour Slots of Player
if (aPlayer instanceof EntityPlayer) {
// amour
@@ -145,7 +145,7 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble {
continue;
}
if (ChargingHelper.isItemValid(aInvStack)) {
- double aTransferRate = 0;
+ double aTransferRate;
final IElectricItem electricItem = (IElectricItem) aInvStack.getItem();
if (electricItem != null) {
aTransferRate = electricItem.getTransferLimit(aInvStack);
@@ -166,28 +166,17 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble {
false);
ElectricItem.manager
.discharge(aBaubleStack, d, mTier, false, true, false);
- // Logger.INFO("Charging " + aInvStack.getDisplayName() + "
- // | " + d + " | "+electricItem.getMaxCharge(aInvStack));
}
- } else {
- // Logger.INFO("5");
}
- } else {
- // Logger.INFO("4");
}
- } else {
- // Logger.INFO("3");
}
- } else {
- // Logger.INFO("1");
}
+
}
}
}
- if (this.getCharge(aBaubleStack) > 0) {
- continue;
- } else {
+ if (!(this.getCharge(aBaubleStack) > 0)) {
break;
}
}
@@ -221,36 +210,22 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble {
.charge(aInvStack, aTransferRate, mTier, false, false);
ElectricItem.manager
.discharge(aBaubleStack, d, mTier, false, true, false);
- // Logger.INFO("Charging " + aInvStack.getDisplayName() + "
- // | " + d + " | "+electricItem.getMaxCharge(aInvStack));
}
- } else {
- // Logger.INFO("5");
}
- } else {
- // Logger.INFO("4");
}
- } else {
- // Logger.INFO("3");
}
- } else {
- // Logger.INFO("1");
}
}
}
}
- if (this.getCharge(aBaubleStack) > 0) {
- continue;
- } else {
+ if (!(this.getCharge(aBaubleStack) > 0)) {
break;
}
}
}
}
- } catch (Throwable t) {
-
- }
+ } catch (Throwable ignored) {}
}
}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
index c1a4ae845a..5c587bc4c5 100644
--- a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
@@ -46,10 +46,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
public class AgriculturalChem extends ItemPackage {
- private static boolean aBOP;
- private static boolean aTiCon;
-
- private static ArrayList<FluidStack> mBloodFluids = new ArrayList<>();
+ private static final ArrayList<FluidStack> mBloodFluids = new ArrayList<>();
/**
* Fluids
@@ -294,8 +291,8 @@ public class AgriculturalChem extends ItemPackage {
public AgriculturalChem() {
super();
- aBOP = BiomesOPlenty.isModLoaded();
- aTiCon = TinkerConstruct.isModLoaded();
+ boolean aBOP = BiomesOPlenty.isModLoaded();
+ boolean aTiCon = TinkerConstruct.isModLoaded();
Logger.INFO("Adding Agrochemical content");
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
index 2fc6a2ab88..f89b69ec8b 100644
--- a/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
@@ -668,7 +668,7 @@ public class MilledOreProcessing extends ItemPackage {
public boolean addRecipe(ItemStack aInput, ItemStack aOutput1, int[] aChances, int aTime, int aEU) {
aOutput1 = GTOreDictUnificator.get(true, aOutput1);
- ItemStack aOutputs[] = new ItemStack[4];
+ ItemStack[] aOutputs = new ItemStack[4];
for (int i = 0; i < aChances.length; i++) {
aOutputs[i] = aOutput1;
}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
index 038a1ea8ce..b548192f47 100644
--- a/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
@@ -23,7 +23,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
public class ItemGenericChemBase extends Item {
- protected final IIcon base[];
+ protected final IIcon[] base;
private final int aMetaSize = 34;
@@ -221,14 +221,10 @@ public class ItemGenericChemBase extends Item {
public boolean showDurabilityBar(ItemStack aStack) {
if (ItemUtils.isMillingBall(aStack)) {
int aDam = getMillingBallDamage(aStack);
- if (aDam > 0) {
- return true;
- }
+ return aDam > 0;
} else if (ItemUtils.isCatalyst(aStack)) {
int aDam = getCatalystDamage(aStack);
- if (aDam > 0) {
- return true;
- }
+ return aDam > 0;
}
return false;
}
diff --git a/src/main/java/gtPlusPlus/core/item/circuit/GTPPIntegratedCircuitItem.java b/src/main/java/gtPlusPlus/core/item/circuit/GTPPIntegratedCircuitItem.java
index e616004ec1..ec5548a9a3 100644
--- a/src/main/java/gtPlusPlus/core/item/circuit/GTPPIntegratedCircuitItem.java
+++ b/src/main/java/gtPlusPlus/core/item/circuit/GTPPIntegratedCircuitItem.java
@@ -72,16 +72,11 @@ public class GTPPIntegratedCircuitItem extends Item implements INetworkUpdatable
try {
aList.add("Configuration == " + aStack.getItemDamage());
aList.add(
- GTLanguageManager.addStringLocalization(
- new StringBuilder().append(getUnlocalizedName())
- .append(".tooltip.0")
- .toString(),
- "Right click to reconfigure"));
+ GTLanguageManager
+ .addStringLocalization(getUnlocalizedName() + ".tooltip.0", "Right click to reconfigure"));
aList.add(
GTLanguageManager.addStringLocalization(
- new StringBuilder().append(getUnlocalizedName())
- .append(".tooltip.1")
- .toString(),
+ getUnlocalizedName() + ".tooltip.1",
"Needs a screwdriver or circuit programming tool"));
} catch (Throwable t) {
t.printStackTrace();
diff --git a/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java
index 51bff6f12b..1b95cb7af9 100644
--- a/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java
+++ b/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java
@@ -19,7 +19,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
public class ItemDummyResearch extends ItemGenericToken {
- public static enum ASSEMBLY_LINE_RESEARCH {
+ public enum ASSEMBLY_LINE_RESEARCH {
RESEARCH_1_CONTAINMENT("Containment Fields", "Advanced scientific study"),
RESEARCH_2_BASIC_CHEM("Basic Chemistry", "Time to start at the beginning"),
@@ -36,14 +36,14 @@ public class ItemDummyResearch extends ItemGenericToken {
private final String mName;
private final String mDesc;
- private ASSEMBLY_LINE_RESEARCH(String aName, String aDesc) {
+ ASSEMBLY_LINE_RESEARCH(String aName, String aDesc) {
mName = aName;
mDesc = aDesc;
ModItems.itemDummyResearch.register(mName, mDesc);
}
}
- private static Map<String, Integer> mInternalNameToIdMap = new LinkedHashMap<>();
+ private static final Map<String, Integer> mInternalNameToIdMap = new LinkedHashMap<>();
public static ItemStack getResearchStack(ASSEMBLY_LINE_RESEARCH aResearchName, int aStacksize) {
Integer aMeta = mInternalNameToIdMap.get(Utils.sanitizeString(aResearchName.mName));
diff --git a/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
index 5c38dde63b..72e74b2d2b 100644
--- a/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
+++ b/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
@@ -3,6 +3,7 @@ package gtPlusPlus.core.item.food;
import static gregtech.api.enums.Mods.GTPlusPlus;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -304,7 +305,7 @@ public class BaseItemMetaFood extends ItemFood {
public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
try {
String aTooltip = mTooltipMap.get(getMetaKey(aStack));
- if (aTooltip != null && aTooltip.length() > 0) {
+ if (aTooltip != null && !aTooltip.isEmpty()) {
aList.add(aTooltip);
}
} catch (Throwable t) {
@@ -422,10 +423,8 @@ public class BaseItemMetaFood extends ItemFood {
private static ArrayList<String> getOreDictNamesAsArrayList(String... aOreDictNames) {
ArrayList<String> aPackage = new ArrayList<>();
- if (aOreDictNames != null && aOreDictNames.length > 0) {
- for (String aEffect : aOreDictNames) {
- aPackage.add(aEffect);
- }
+ if (aOreDictNames != null) {
+ aPackage.addAll(Arrays.asList(aOreDictNames));
}
return aPackage;
}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java b/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java
index ee1afdb6bf..2fb6e67cd7 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java
@@ -85,7 +85,7 @@ public class ItemBasicScrubberTurbine extends Item {
return true;
}
- public static final long getFilterDamage(final ItemStack aStack) {
+ public static long getFilterDamage(final ItemStack aStack) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("BasicTurbine");
@@ -98,7 +98,7 @@ public class ItemBasicScrubberTurbine extends Item {
return 0L;
}
- public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ public static boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("BasicTurbine");
@@ -133,8 +133,7 @@ public class ItemBasicScrubberTurbine extends Item {
}
double currentDamage = getFilterDamage(stack);
double meta = getMaxDurability(stack);
- double durabilitypercent = currentDamage / meta;
- return durabilitypercent;
+ return currentDamage / meta;
}
@Override
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java
index c6e0743268..1f1848a90c 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java
@@ -124,12 +124,11 @@ public class ItemBlueprint extends Item implements IItemBlueprint {
}
public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid) {
- final ItemStack[] blueprint = craftingGrid;
if (itemStack.hasTagCompound()) {
final NBTTagCompound nbt = itemStack.getTagCompound();
final NBTTagList list = new NBTTagList();
for (int i = 0; i < INV_SIZE; i++) {
- final ItemStack stack = blueprint[i];
+ final ItemStack stack = craftingGrid[i];
if (stack != null) {
final NBTTagCompound data = new NBTTagCompound();
stack.writeToNBT(data);
@@ -180,7 +179,6 @@ public class ItemBlueprint extends Item implements IItemBlueprint {
if (output != null) {
this.setBlueprintName(stack, output.getDisplayName());
- hasBP = true;
return true;
}
return false;
@@ -227,20 +225,20 @@ public class ItemBlueprint extends Item implements IItemBlueprint {
public boolean createNBT(final ItemStack itemStack) {
if (itemStack.hasTagCompound()) {
if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName")
- .equals("")) {
+ .isEmpty()) {
// No Blueprint and no name Set
Logger.WARNING("No Blueprint and no name Set");
return false;
} else if (itemStack.stackTagCompound.getBoolean("mBlueprint")
&& !itemStack.stackTagCompound.getString("mName")
- .equals("")) {
+ .isEmpty()) {
// Has Blueprint but invalid name set
Logger.WARNING("Has Blueprint but invalid name set");
return false;
} else
if (!itemStack.stackTagCompound.getBoolean("mBlueprint")
&& itemStack.stackTagCompound.getString("mName")
- .equals("")) {
+ .isEmpty()) {
// Has no Blueprint, but strangely has a name
Logger.WARNING("Has no Blueprint, but strangely has a name");
return false;
@@ -289,9 +287,6 @@ public class ItemBlueprint extends Item implements IItemBlueprint {
// o = itemStack.stackTagCompound.getInteger(tagNBT);
break;
}
- if (o != null) {
- return o;
- }
- return null;
+ return o;
}
}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java b/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java
index 7a0cbe3312..5325f33299 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java
@@ -91,11 +91,10 @@ public class ItemGenericToken extends CoreItem {
sizes[1][3] = mRarities.size();
sizes[1][4] = mCustomNameColours.size();
// sizes[1][5] = mIcons.size();
- boolean b = sizes[0][0] > sizes[1][0] && sizes[0][1] > sizes[1][1]
+ return sizes[0][0] > sizes[1][0] && sizes[0][1] > sizes[1][1]
&& sizes[0][2] > sizes[1][2]
&& sizes[0][3] > sizes[1][3]
&& sizes[0][4] > sizes[1][4];
- return b;
}
// Handle Sub items
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java
index ed9bddfd18..42bdd05aa8 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java
@@ -288,9 +288,8 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI
}
}
}
- if (this.getCharge(baubleStack) <= (this.getMaxCharge(baubleStack) - getTransferLimit(baubleStack))) {
- continue;
- } else {
+ if (!(this.getCharge(baubleStack)
+ <= (this.getMaxCharge(baubleStack) - getTransferLimit(baubleStack)))) {
break;
}
}
@@ -357,7 +356,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI
return true;
}
- public static final boolean getShowMessages(final ItemStack aStack) {
+ public static boolean getShowMessages(final ItemStack aStack) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT == null) {
if (!createNBT(aStack)) {
@@ -369,7 +368,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI
return aNBT.getBoolean("ShowMSG");
}
- public static final boolean setShowMessages(final ItemStack aStack, final boolean aShow) {
+ public static boolean setShowMessages(final ItemStack aStack, final boolean aShow) {
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT == null) {
if (!createNBT(aStack)) {
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java b/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java
index 2b5dd8883f..ac3255251e 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java
@@ -36,7 +36,7 @@ public class ItemLavaFilter extends CoreItem {
private boolean setGregtechItemList() {
ItemList.Component_LavaFilter.set(this);
- return ItemList.Component_LavaFilter.get(1) != null ? true : false;
+ return ItemList.Component_LavaFilter.get(1) != null;
}
@Override
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemMagicFeather.java b/src/main/java/gtPlusPlus/core/item/general/ItemMagicFeather.java
index 9b4dd86525..2972acd719 100644
--- a/src/main/java/gtPlusPlus/core/item/general/ItemMagicFeather.java
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemMagicFeather.java
@@ -91,7 +91,7 @@ public class ItemMagicFeather extends CoreItem {
aBeaconData);
}
}
- return aBeaconData.size() > 0;
+ return !aBeaconData.isEmpty();
}
private static void findSuitableBeacon(EntityPlayer player, Collection<TileEntity> tileEntities,
diff --git a/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java b/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java
index c186fccd4b..bb2b98de47 100644
--- a/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java
+++ b/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java
@@ -14,7 +14,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
@@ -58,7 +57,7 @@ public class ItemCustomSpawnEgg extends ItemMonsterPlacer {
aPrimaryColor,
aSecondaryColor,
EnumRarity.common,
- new ArrayList<String>());
+ new ArrayList<>());
}
public static void registerEntityForSpawnEgg(final int aMetaID, String parEntityToSpawnName, int aPrimaryColor,
@@ -84,7 +83,7 @@ public class ItemCustomSpawnEgg extends ItemMonsterPlacer {
/**
* Callback for item usage. If the item does something special on right clicking,
- *
+ * <p>
* he will have one of those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
@Override
@@ -92,91 +91,87 @@ public class ItemCustomSpawnEgg extends ItemMonsterPlacer {
int par5, int par6, int par7, float par8, float par9, float par10) {
if (par3World.isRemote) {
return true;
- } else {
- Block block = par3World.getBlock(par4, par5, par6);
- par4 += Facing.offsetsXForSide[par7];
- par5 += Facing.offsetsYForSide[par7];
- par6 += Facing.offsetsZForSide[par7];
- double d0 = 0.0D;
-
- if (par7 == 1 && block.getRenderType() == 11) {
- d0 = 0.5D;
- }
-
- Entity entity = spawnEntity(par1ItemStack, par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D);
+ }
+ Block block = par3World.getBlock(par4, par5, par6);
+ par4 += Facing.offsetsXForSide[par7];
+ par5 += Facing.offsetsYForSide[par7];
+ par6 += Facing.offsetsZForSide[par7];
+ double d0 = 0.0D;
+
+ if (par7 == 1 && block.getRenderType() == 11) {
+ d0 = 0.5D;
+ }
- if (entity != null) {
- if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
- ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
- }
+ Entity entity = spawnEntity(par1ItemStack, par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D);
- if (!par2EntityPlayer.capabilities.isCreativeMode) {
- --par1ItemStack.stackSize;
- }
+ if (entity != null) {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
+ ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
}
- return true;
+ if (!par2EntityPlayer.capabilities.isCreativeMode) {
+ --par1ItemStack.stackSize;
+ }
}
+
+ return true;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed.
- *
+ * <p>
* Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par2World.isRemote) {
return par1ItemStack;
- } else {
- MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(
- par2World,
- par3EntityPlayer,
- true);
-
- if (movingobjectposition == null) {
- return par1ItemStack;
- } else {
- if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
- int i = movingobjectposition.blockX;
- int j = movingobjectposition.blockY;
- int k = movingobjectposition.blockZ;
-
- if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) {
- return par1ItemStack;
- }
+ }
+ MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(
+ par2World,
+ par3EntityPlayer,
+ true);
+
+ if (movingobjectposition != null) {
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ int i = movingobjectposition.blockX;
+ int j = movingobjectposition.blockY;
+ int k = movingobjectposition.blockZ;
+
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) {
+ return par1ItemStack;
+ }
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) {
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) {
- return par1ItemStack;
- }
+ return par1ItemStack;
+ }
- if (par2World.getBlock(i, j, k) instanceof BlockLiquid) {
- Entity entity = spawnEntity(par1ItemStack, par2World, i, j, k);
+ if (par2World.getBlock(i, j, k) instanceof BlockLiquid) {
+ Entity entity = spawnEntity(par1ItemStack, par2World, i, j, k);
- if (entity != null) {
- if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
+ if (entity != null) {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
- ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
- }
+ ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
+ }
- if (!par3EntityPlayer.capabilities.isCreativeMode) {
- --par1ItemStack.stackSize;
- }
+ if (!par3EntityPlayer.capabilities.isCreativeMode) {
+ --par1ItemStack.stackSize;
}
}
}
-
- return par1ItemStack;
}
+
}
+ return par1ItemStack;
}
/**
* Spawns the creature specified by the egg's type in the location specified by
- *
+ * <p>
* the last three parameters. Parameters: world, entityID, x, y, z.
- *
+ *
* @param par1ItemStack
*/
public Entity spawnEntity(ItemStack par1ItemStack, World parWorld, double parX, double parY, double parZ) {
@@ -196,7 +191,7 @@ public class ItemCustomSpawnEgg extends ItemMonsterPlacer {
MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() * 360.0F),
0.0F);
parWorld.spawnEntityInWorld(entityToSpawn);
- entityToSpawn.onSpawnWithEgg((IEntityLivingData) null);
+ entityToSpawn.onSpawnWithEgg(null);
entityToSpawn.playLivingSound();
} else {
// DEBUG
diff --git a/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java
index 1524418038..5aa0072122 100644
--- a/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java
+++ b/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java
@@ -71,20 +71,20 @@ public class DustDecayable extends BaseItemTickable {
if (!a1 && !a2) {
if (entityHolding instanceof EntityPlayer) {
- ItemStack replacement = ItemUtils.getSimpleStack(getDecayResult());
// Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+".");
- final ItemStack tempTransform = replacement;
if (iStack.stackSize > 1) {
int u = iStack.stackSize;
- tempTransform.stackSize = u;
- ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ItemUtils.getSimpleStack(getDecayResult()).stackSize = u;
+ ((EntityPlayer) entityHolding).inventory
+ .addItemStackToInventory((ItemUtils.getSimpleStack(getDecayResult())));
for (int l = 0; l < u; l++) {
((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
}
} else {
- tempTransform.stackSize = 1;
- ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ItemUtils.getSimpleStack(getDecayResult()).stackSize = 1;
+ ((EntityPlayer) entityHolding).inventory
+ .addItemStackToInventory((ItemUtils.getSimpleStack(getDecayResult())));
((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
}
}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/ItemGregtechPump.java b/src/main/java/gtPlusPlus/core/item/tool/misc/ItemGregtechPump.java
index a8173571dc..f6533dad8e 100644
--- a/src/main/java/gtPlusPlus/core/item/tool/misc/ItemGregtechPump.java
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/ItemGregtechPump.java
@@ -72,12 +72,7 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
if (aStack == null || aPlayer == null || aWorld == null || aWorld.isRemote) {
return false;
}
- if (!aWorld.isRemote && tryDrainTile(aStack, aWorld, aPlayer, aX, aY, aZ)) {
- return true;
- } else {
- // return super.onItemUse(aStack, aPlayer, aWorld, aX, aY, aZ, a4, p_77648_8_, p_77648_9_, p_77648_10_);
- return false;
- }
+ return tryDrainTile(aStack, aWorld, aPlayer, aX, aY, aZ);
}
@Override
@@ -604,11 +599,8 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) {
return this;
}
- ArrayList<IItemBehaviour<ItemGregtechPump>> tList = this.mItemBehaviors.get((short) aMetaValue);
- if (tList == null) {
- tList = new ArrayList<>(1);
- this.mItemBehaviors.put((short) aMetaValue, tList);
- }
+ ArrayList<IItemBehaviour<ItemGregtechPump>> tList = this.mItemBehaviors
+ .computeIfAbsent((short) aMetaValue, k -> new ArrayList<>(1));
tList.add(aBehavior);
return this;
}
@@ -648,7 +640,6 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
}
if (tRandomData == SubTag.NO_UNIFICATION) {
GTOreDictUnificator.addToBlacklist(rStack);
- continue;
}
}
}
@@ -681,7 +672,6 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
}
if (tUseOreDict) {
GTOreDictUnificator.registerOre(tRandomData, rStack);
- continue;
}
}
}
@@ -733,7 +723,7 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
String fluidname = aFluid.getFluid()
.getName();
int amount = aFluid.amount;
- if (fluidname != null && fluidname.length() > 0 && amount > 0) {
+ if (fluidname != null && !fluidname.isEmpty() && amount > 0) {
NBTUtils.setString(aStack, "mFluid", fluidname);
NBTUtils.setInteger(aStack, "mFluidAmount", amount);
}
@@ -777,8 +767,7 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
.getInteger("mCapacity");
}
int aMeta = this.getCorrectMetaForItemstack(container);
- int aCapacity = (aMeta == 0 ? 2000 : (aMeta == 1 ? 8000 : (aMeta == 2 ? 32000 : 128000)));
- return aCapacity;
+ return aMeta == 0 ? 2000 : aMeta == 1 ? 8000 : aMeta == 2 ? 32000 : 128000;
}
public int fill(ItemStack container, FluidStack resource) {
@@ -815,12 +804,7 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
if (aStoredFluid == null) {
Logger.INFO("Pump is empty, filling with tank fluids.");
FluidStack toConsume;
- int amountToConsume = 0;
- if (resource.amount >= aCapacity) {
- amountToConsume = aCapacity;
- } else {
- amountToConsume = resource.amount;
- }
+ int amountToConsume = Math.min(resource.amount, aCapacity);
toConsume = FluidUtils.getFluidStack(resource, amountToConsume);
if (toConsume != null && amountToConsume > 0) {
storeFluid(container, toConsume);
@@ -982,10 +966,8 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
if (discharge(aStack, removal, aTier, true, true, false) > 0) {
didDrain = true;
}
- } else if (aTier == 0) {
- didDrain = true;
} else {
- didDrain = false;
+ didDrain = aTier == 0;
}
if (didDrain) {
@@ -1181,7 +1163,7 @@ public class ItemGregtechPump extends Item implements ISpecialElectricItem, IEle
} else {
// Rewrite Fluid handling for Vanilla type tanks
- if (!IFluidHandler.class.isInstance(aTileEntity)) {
+ if (!(aTileEntity instanceof IFluidHandler)) {
Logger.INFO("Tile Was not an instance of IFluidHandler.");
return false;
}