mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Some probably useless optimizations
This commit is contained in:
6 files changed
+20
-17
No files matched your search
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import gnu.trove.map.hash.TIntIntHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
@@ -175,7 +176,7 @@ public class LightningHandler {
|
||||
public Vector3 start;
|
||||
public Vector3 end;
|
||||
BlockPos target;
|
||||
HashMap<Integer, Integer> splitparents = new HashMap<>();
|
||||
TIntIntHashMap splitparents = new TIntIntHashMap();
|
||||
|
||||
public double length;
|
||||
public int numsegments0;
|
||||
@@ -416,7 +417,7 @@ public class LightningHandler {
|
||||
}
|
||||
|
||||
private void calculateCollisionAndDiffs() {
|
||||
HashMap<Integer, Integer> lastactivesegment = new HashMap<>();
|
||||
TIntIntHashMap lastactivesegment = new TIntIntHashMap();
|
||||
|
||||
Collections.sort(segments, SEGMENT_SORTER);
|
||||
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockStateMatcher;
|
||||
@@ -76,7 +77,7 @@ public class SubTileMarimorphosis extends SubTileFunctional {
|
||||
public ItemStack getStoneToPut(BlockPos coords) {
|
||||
List<Type> types = Arrays.asList(BiomeDictionary.getTypesForBiome(supertile.getWorld().getBiomeGenForCoords(coords)));
|
||||
|
||||
List<Integer> values = new ArrayList<>();
|
||||
TIntArrayList values = new TIntArrayList();
|
||||
for(int i = 0; i < 8; i++) {
|
||||
int times = 1;
|
||||
if(types.contains(TYPES[i]))
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -97,7 +98,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
case DISPERSIVE : {
|
||||
List<EntityPlayer> players = SparkHelper.getEntitiesAround(EntityPlayer.class, worldObj, posX, posY, posZ);
|
||||
|
||||
Map<EntityPlayer, Map<ItemStack, Integer>> receivingPlayers = new HashMap<>();
|
||||
Map<EntityPlayer, TObjectIntHashMap<ItemStack>> receivingPlayers = new HashMap<>();
|
||||
|
||||
ItemStack input = new ItemStack(ModItems.spark);
|
||||
for(EntityPlayer player : players) {
|
||||
@@ -112,11 +113,11 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
|
||||
IManaItem manaItem = (IManaItem) stack.getItem();
|
||||
if(manaItem.canReceiveManaFromItem(stack, input)) {
|
||||
Map<ItemStack, Integer> receivingStacks;
|
||||
TObjectIntHashMap<ItemStack> receivingStacks;
|
||||
boolean add = false;
|
||||
if(!receivingPlayers.containsKey(player)) {
|
||||
add = true;
|
||||
receivingStacks = new HashMap<>();
|
||||
receivingStacks = new TObjectIntHashMap<>();
|
||||
} else receivingStacks = receivingPlayers.get(player);
|
||||
|
||||
int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(TRANSFER_RATE, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
|
||||
@@ -134,7 +135,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
Collections.shuffle(keys);
|
||||
EntityPlayer player = keys.iterator().next();
|
||||
|
||||
Map<ItemStack, Integer> items = receivingPlayers.get(player);
|
||||
TObjectIntHashMap<ItemStack> items = receivingPlayers.get(player);
|
||||
ItemStack stack = items.keySet().iterator().next();
|
||||
int cost = items.get(stack);
|
||||
int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -49,7 +50,7 @@ public class ItemGrassSeeds extends ItemMod implements IFloatingFlowerVariant {
|
||||
* Represents a map of dimension IDs to a set of all block swappers
|
||||
* active in that dimension.
|
||||
*/
|
||||
private static Map<Integer, Set<BlockSwapper>> blockSwappers = new HashMap<>();
|
||||
private static final TIntObjectHashMap<Set<BlockSwapper>> blockSwappers = new TIntObjectHashMap<>();
|
||||
|
||||
private static final IslandType[] ISLAND_TYPES = {
|
||||
IslandType.GRASS, IslandType.PODZOL, IslandType.MYCEL,
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.tool.terrasteel;
|
||||
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -71,7 +72,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
* Represents a map of dimension IDs to a set of all block swappers
|
||||
* active in that dimension.
|
||||
*/
|
||||
private static Map<Integer, Set<BlockSwapper>> blockSwappers = new HashMap<>();
|
||||
private static TIntObjectHashMap<Set<BlockSwapper>> blockSwappers = new TIntObjectHashMap<>();
|
||||
|
||||
public ItemTerraAxe() {
|
||||
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_AXE);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
@@ -33,9 +34,7 @@ import java.util.List;
|
||||
|
||||
public class ItemDice extends ItemRelic {
|
||||
|
||||
private static final int[] SIDES_FOR_MOON_PHASES = new int[] {
|
||||
-1, 0, 1, 2, -1, 2, 3, 4
|
||||
};
|
||||
private static final int[] SIDES_FOR_MOON_PHASES = { -1, 0, 1, 2, -1, 2, 3, 4 };
|
||||
|
||||
public static ItemStack[] relicStacks;
|
||||
|
||||
@@ -56,11 +55,10 @@ public class ItemDice extends ItemRelic {
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||
if(isRightPlayer(player, stack) && !player.worldObj.isRemote) {
|
||||
int moonPhase = world.provider.getMoonPhase(world.getWorldTime());
|
||||
int side = SIDES_FOR_MOON_PHASES[moonPhase];
|
||||
int relic = side;
|
||||
int relic = SIDES_FOR_MOON_PHASES[moonPhase];
|
||||
if(hasRelicAlready(player, relic)) {
|
||||
List<Integer> possible = new ArrayList<>();
|
||||
List<Integer> alreadyHas = new ArrayList<>();
|
||||
TIntArrayList possible = new TIntArrayList();
|
||||
TIntArrayList alreadyHas = new TIntArrayList();
|
||||
for(int i = 0; i < 6; i++)
|
||||
if(hasRelicAlready(player, i))
|
||||
alreadyHas.add(i);
|
||||
@@ -91,7 +89,7 @@ public class ItemDice extends ItemRelic {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasRelicAlready(EntityPlayer player, int relic) {
|
||||
private boolean hasRelicAlready(EntityPlayer player, int relic) {
|
||||
if(relic < 0 || relic > 5 || !(player instanceof EntityPlayerMP))
|
||||
return true;
|
||||
|
||||
|
||||
Reference in new issue
Block a user