replace some Integer maps with IntHashMaps
This commit is contained in:
parent
b53a1ec0a9
commit
51fdd8f38a
2 changed files with 9 additions and 7 deletions
|
@ -16,6 +16,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IntHashMap;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -319,14 +320,14 @@ public class TravelingItem {
|
|||
|
||||
public static class TravelingItemCache {
|
||||
|
||||
private final Map<Integer, TravelingItem> itemCache = new MapMaker().weakValues().makeMap();
|
||||
private final IntHashMap itemCache = new IntHashMap();
|
||||
|
||||
public void cache(TravelingItem item) {
|
||||
itemCache.put(item.id, item);
|
||||
itemCache.addKey(item.id, item);
|
||||
}
|
||||
|
||||
public TravelingItem get(int id) {
|
||||
return itemCache.get(id);
|
||||
return (TravelingItem) itemCache.lookup(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.IntHashMap;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -62,7 +63,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
public int[] displayPowerList = new int[POWER_STAGES];
|
||||
public int[] displayPowerListOverload = new int[POWER_STAGES];
|
||||
|
||||
private final HashMap<Integer, DisplayFluidList> displayFluidLists = Maps.newHashMap();
|
||||
private final IntHashMap displayFluidLists = new IntHashMap();
|
||||
private final int[] angleY = {0, 0, 270, 90, 0, 180};
|
||||
private final int[] angleZ = {90, 270, 0, 0, 0, 0};
|
||||
|
||||
|
@ -94,8 +95,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
}
|
||||
|
||||
private DisplayFluidList getDisplayFluidLists(int liquidId, World world) {
|
||||
if (displayFluidLists.containsKey(liquidId)) {
|
||||
return displayFluidLists.get(liquidId);
|
||||
if (displayFluidLists.containsItem(liquidId)) {
|
||||
return (DisplayFluidList) displayFluidLists.lookup(liquidId);
|
||||
}
|
||||
|
||||
Fluid fluid = FluidRegistry.getFluid(liquidId);
|
||||
|
@ -105,7 +106,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
}
|
||||
|
||||
DisplayFluidList d = new DisplayFluidList();
|
||||
displayFluidLists.put(liquidId, d);
|
||||
displayFluidLists.addKey(liquidId, d);
|
||||
|
||||
RenderInfo block = new RenderInfo();
|
||||
|
||||
|
|
Loading…
Reference in a new issue