mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-10-26 14:23:55 +00:00
Cleaned up a few IDE warning
This commit is contained in:
1 parent
fed6530d9d
commit
eadf3f76fc
4 files changed
+38
-38
No files matched your search
@@ -10,11 +10,11 @@ import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
|
||||
|
||||
public KeyHandler keyHandler;
|
||||
|
||||
|
||||
public void registerHandlers() {}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
@@ -23,17 +23,17 @@ public class CommonProxy implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
switch (ID) {
|
||||
case Baubles.GUI: return new ContainerPlayerExpanded(player.inventory, !world.isRemote, player);
|
||||
}
|
||||
if(ID == Baubles.GUI) {
|
||||
return new ContainerPlayerExpanded(player.inventory, !world.isRemote, player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public World getClientWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void registerKeyBindings() {}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class InventoryBaubles implements IInventory {
|
||||
|
||||
public InventoryBaubles(EntityPlayer player) {
|
||||
stackList = new ItemStack[BaubleExpandedSlots.slotLimit];
|
||||
this.player = new WeakReference<EntityPlayer>(player);
|
||||
this.player = new WeakReference<>(player);
|
||||
}
|
||||
|
||||
public Container getEventHandler() {
|
||||
@@ -38,7 +38,7 @@ public class InventoryBaubles implements IInventory {
|
||||
}
|
||||
|
||||
public void setEventHandler(Container eventHandler) {
|
||||
eventHandler = eventHandler;
|
||||
this.eventHandler = eventHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ public class InventoryBaubles implements IInventory {
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
if (stackList[slot] != null) {
|
||||
if(stackList[slot] != null) {
|
||||
ItemStack itemstack = this.stackList[slot];
|
||||
stackList[slot] = null;
|
||||
return itemstack;
|
||||
@@ -94,31 +94,31 @@ public class InventoryBaubles implements IInventory {
|
||||
* (second arg) of items and returns them in a new stack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int decrBy) {
|
||||
if (stackList[slot] != null) {
|
||||
public ItemStack decrStackSize(int slot, int decrementBy) {
|
||||
if(stackList[slot] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (stackList[slot].stackSize <= decrBy) {
|
||||
if(stackList[slot].stackSize <= decrementBy) {
|
||||
itemstack = stackList[slot];
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof IBauble) {
|
||||
if(itemstack != null && itemstack.getItem() instanceof IBauble) {
|
||||
((IBauble) itemstack.getItem()).onUnequipped(itemstack, player.get());
|
||||
}
|
||||
|
||||
|
||||
stackList[slot] = null;
|
||||
} else {
|
||||
itemstack = stackList[slot].splitStack(decrBy);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof IBauble) {
|
||||
((IBauble) itemstack.getItem()).onUnequipped(itemstack, player.get());
|
||||
itemstack = stackList[slot].splitStack(decrementBy);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof IBauble) {
|
||||
((IBauble)itemstack.getItem()).onUnequipped(itemstack, player.get());
|
||||
}
|
||||
|
||||
if (stackList[slot].stackSize == 0) {
|
||||
|
||||
if(stackList[slot].stackSize == 0) {
|
||||
stackList[slot] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (eventHandler != null)
|
||||
if(eventHandler != null)
|
||||
eventHandler.onCraftMatrixChanged(this);
|
||||
syncSlotToClients(slot);
|
||||
return itemstack;
|
||||
@@ -137,19 +137,19 @@ public class InventoryBaubles implements IInventory {
|
||||
((IBauble)stackList[slot].getItem()).onUnequipped(stackList[slot], player.get());
|
||||
}
|
||||
stackList[slot] = stack;
|
||||
if (!blockEvents && stack != null && stack.getItem() instanceof IBauble) {
|
||||
if (player.get()!=null) {
|
||||
if(!blockEvents && stack != null && stack.getItem() instanceof IBauble) {
|
||||
if(player.get()!=null) {
|
||||
((IBauble) stack.getItem()).onEquipped(stack, player.get());
|
||||
}
|
||||
}
|
||||
if (eventHandler != null) {
|
||||
if(eventHandler != null) {
|
||||
eventHandler.onCraftMatrixChanged(this);
|
||||
}
|
||||
syncSlotToClients(slot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a inventory slot.
|
||||
* Returns the maximum stack size for an inventory slot.
|
||||
*/
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
@@ -164,7 +164,7 @@ public class InventoryBaubles implements IInventory {
|
||||
public void markDirty() {
|
||||
try {
|
||||
player.get().inventory.markDirty();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class InventoryBaubles implements IInventory {
|
||||
if (stack == null || slotType == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Item item = stack.getItem();
|
||||
if(!(item instanceof IBauble) || !((IBauble) item).canEquip(stack, player.get())) {
|
||||
return false;
|
||||
@@ -208,7 +208,7 @@ public class InventoryBaubles implements IInventory {
|
||||
BaubleType legacyType = ((IBauble)item).getBaubleType(stack);
|
||||
types = new String[] {BaubleExpandedSlots.getTypeFromBaubleType(legacyType)};
|
||||
}
|
||||
|
||||
|
||||
for(String type : types) {
|
||||
if(type.equals(slotType)) {
|
||||
return true;
|
||||
@@ -264,8 +264,8 @@ public class InventoryBaubles implements IInventory {
|
||||
item.delayBeforeCanPickup = 40;
|
||||
float f1 = player.get().worldObj.rand.nextFloat() * 0.5F;
|
||||
float f2 = player.get().worldObj.rand.nextFloat() * (float) Math.PI * 2.0F;
|
||||
item.motionX = (double) (-MathHelper.sin(f2) * f1);
|
||||
item.motionZ = (double) (MathHelper.cos(f2) * f1);
|
||||
item.motionX = (-MathHelper.sin(f2) * f1);
|
||||
item.motionZ = (MathHelper.cos(f2) * f1);
|
||||
item.motionY = 0.20000000298023224D;
|
||||
drops.add(item);
|
||||
stackList[slot] = null;
|
||||
@@ -283,8 +283,8 @@ public class InventoryBaubles implements IInventory {
|
||||
item.delayBeforeCanPickup = 40;
|
||||
float f1 = entity.worldObj.rand.nextFloat() * 0.5F;
|
||||
float f2 = entity.worldObj.rand.nextFloat() * (float) Math.PI * 2.0F;
|
||||
item.motionX = (double) (-MathHelper.sin(f2) * f1);
|
||||
item.motionZ = (double) (MathHelper.cos(f2) * f1);
|
||||
item.motionX = (-MathHelper.sin(f2) * f1);
|
||||
item.motionZ = (MathHelper.cos(f2) * f1);
|
||||
item.motionY = 0.20000000298023224D;
|
||||
drops.add(item);
|
||||
stackList[slot] = null;
|
||||
|
||||
@@ -11,9 +11,9 @@ public class ItemStackHelper {
|
||||
NBTTagList enchantments = itemStack.getEnchantmentTagList();
|
||||
if(enchantments != null) {
|
||||
for(int i = 0; i < enchantments.tagCount(); i++) {
|
||||
int itemEnchID = enchantments.getCompoundTagAt(i).getInteger("id");
|
||||
int itemEnchantID = enchantments.getCompoundTagAt(i).getInteger("id");
|
||||
for(int soulBoundID : BaublesConfig.soulBoundEnchantments) {
|
||||
if(itemEnchID == soulBoundID) {
|
||||
if(itemEnchantID == soulBoundID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class PlayerHandler {
|
||||
|
||||
private static HashMap<String, InventoryBaubles> playerBaubles = new HashMap<String, InventoryBaubles>();
|
||||
private static HashMap<String, InventoryBaubles> playerBaubles = new HashMap<>();
|
||||
|
||||
public static void clearPlayerBaubles(EntityPlayer player) {
|
||||
playerBaubles.remove(player.getCommandSenderName());
|
||||
@@ -107,7 +107,7 @@ public class PlayerHandler {
|
||||
if (mainFile.exists()) {
|
||||
try {
|
||||
mainFile.delete();
|
||||
} catch (Exception deleteException) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user