Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
gamerforEA committed May 2, 2019
1 parent a71c4b0 commit 2758ea5
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
4 changes: 1 addition & 3 deletions src/main/java/appeng/container/AEBaseContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,7 @@ public Object getTarget()
return this.tileEntity;
if (this.part != null)
return this.part;
if (this.obj != null)
return this.obj;
return null;
return this.obj;
}

public InventoryPlayer getPlayerInv()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void sendCPUs()
else if (this.selectedCpu != -1)
this.myName = this.cpus.get(this.selectedCpu).getName();

if (this.selectedCpu == -1 && this.cpus.size() > 0)
if (this.selectedCpu == -1 && !this.cpus.isEmpty())
this.selectedCpu = 0;

if (this.selectedCpu != -1)
Expand All @@ -136,7 +136,7 @@ public void cycleCpu(final boolean next)
else if (this.selectedCpu >= this.cpus.size())
this.selectedCpu = -1;

if (this.selectedCpu == -1 && this.cpus.size() > 0)
if (this.selectedCpu == -1 && !this.cpus.isEmpty())
this.selectedCpu = 0;

if (this.selectedCpu == -1)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/container/slot/SlotCraftingTerm.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ else if (set[x] != null)
}
}

if (drops.size() > 0)
if (!drops.isEmpty())
Platform.spawnDrops(p.worldObj, (int) p.posX, (int) p.posY, (int) p.posZ, drops);
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/appeng/hooks/TickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ public void onChunkLoad(final ChunkEvent.Load load)
@SubscribeEvent
public void onChunkUnload(ChunkEvent.Unload event)
{
// TODO gamerforEA code start
if (!EventConfig.experimentalChunkDupeFix)
return;
// TODO gamerforEA code end

Chunk chunk = event.getChunk();
int chunkX = chunk.xPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void makeUnique()
break;

final List<ItemStack> options = OreDictionary.getOres(name);
if (options != null && options.size() > 0)
if (options != null && !options.isEmpty())
for (final ItemStack is : options)
{
if (is != null && is.getItem() != null)
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/appeng/parts/misc/PartStorageBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -498,7 +497,7 @@ public List<IMEInventoryHandler> getCellArray(final StorageChannel channel)
if (out != null)
return Collections.singletonList(out);
}
return Arrays.asList(new IMEInventoryHandler[] {});
return Collections.emptyList();
}

@Override
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/appeng/tile/AEBaseTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ public boolean canBeRotated()
private List<AETileEventHandler> getHandlerListFor(final TileEventType type)
{
final Map<TileEventType, List<AETileEventHandler>> eventToHandlers = this.getEventToHandlers();
final List<AETileEventHandler> handlers = this.getHandlers(eventToHandlers, type);

return handlers;
return this.getHandlers(eventToHandlers, type);
}

@Nonnull
Expand Down Expand Up @@ -510,7 +508,7 @@ public String getCustomName()
@Override
public boolean hasCustomName()
{
return this.customName != null && this.customName.length() > 0;
return this.customName != null && !this.customName.isEmpty();
}

public void securityBreak()
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/appeng/util/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,14 @@ public static void spawnDrops(final World w, final int x, final int y, final int
if (isServer())
for (final ItemStack i : drops)
{
if (i != null)
if (i.stackSize > 0)
{
final double offset_x = (getRandomInt() % 32 - 16) / 82;
final double offset_y = (getRandomInt() % 32 - 16) / 82;
final double offset_z = (getRandomInt() % 32 - 16) / 82;
final EntityItem ei = new EntityItem(w, 0.5 + offset_x + x, 0.5 + offset_y + y, 0.2 + offset_z + z, i.copy());
w.spawnEntityInWorld(ei);
}
if (i != null && i.stackSize > 0)
{
final double offset_x = (getRandomInt() % 32 - 16) / 82.0;
final double offset_y = (getRandomInt() % 32 - 16) / 82.0;
final double offset_z = (getRandomInt() % 32 - 16) / 82.0;
final EntityItem ei = new EntityItem(w, 0.5 + offset_x + x, 0.5 + offset_y + y, 0.2 + offset_z + z, i.copy());
w.spawnEntityInWorld(ei);
}
}
}

Expand Down

0 comments on commit 2758ea5

Please sign in to comment.