diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java b/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java index 679ae793..a99dadea 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java @@ -5,17 +5,17 @@ import WayofTime.bloodmagic.altar.BloodAltar; import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.IAltarManipulator; import WayofTime.bloodmagic.altar.IBloodAltar; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.data.Binding; +import WayofTime.bloodmagic.core.data.SoulNetwork; import WayofTime.bloodmagic.iface.IAltarReader; import WayofTime.bloodmagic.iface.IBindable; import WayofTime.bloodmagic.iface.IDocumentedBlock; import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.IBloodOrb; -import WayofTime.bloodmagic.core.data.SoulNetwork; -import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.Utils; +import WayofTime.bloodmagic.util.helper.NetworkHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -31,7 +31,6 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; @@ -160,15 +159,6 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl return new TileAltar(); } - // IVariantProvider - - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } - // IDocumentedBlock @Override diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java b/src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java index 6637e06d..b9dfe15d 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java @@ -6,6 +6,7 @@ import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.item.block.ItemBlockBloodTank; import WayofTime.bloodmagic.tile.TileBloodTank; import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -28,8 +29,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; @@ -195,11 +196,8 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB // IVariantProvider @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++) - ret.add(Pair.of(i, "inventory")); - - return ret; + variants.put(i, "inventory"); } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrucible.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrucible.java index 1bcbbc80..5627ce9d 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrucible.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrucible.java @@ -1,9 +1,9 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.soul.IDemonWillGem; import WayofTime.bloodmagic.soul.IDiscreteDemonWill; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileDemonCrucible; import WayofTime.bloodmagic.util.Utils; import net.minecraft.block.Block; @@ -19,12 +19,8 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBlock { public BlockDemonCrucible() { @@ -99,13 +95,6 @@ public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBl return new TileDemonCrucible(); } - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } - @Override public ItemBlock getItem() { return new ItemBlock(this); diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystallizer.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystallizer.java index 8ed12395..26ecfb88 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystallizer.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystallizer.java @@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileDemonCrystallizer; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -13,11 +14,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; -import java.util.List; +import javax.annotation.Nonnull; public class BlockDemonCrystallizer extends BlockContainer implements IVariantProvider, IBMBlock { public BlockDemonCrystallizer() { @@ -68,10 +66,8 @@ public class BlockDemonCrystallizer extends BlockContainer implements IVariantPr } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "normal"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarBase.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarBase.java index 44c7f95f..5db379bb 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarBase.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarBase.java @@ -2,14 +2,13 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnumPillar; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; public class BlockDemonPillarBase & IStringSerializable> extends BlockEnumPillar { public BlockDemonPillarBase(String baseName, Material materialIn, Class enumClass) { @@ -24,16 +23,11 @@ public class BlockDemonPillarBase & IStringSerializable> exten } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - - //This is done to make the ItemBlocks have the proper model + public void gatherVariants(@Nonnull Int2ObjectMap variants) { EnumFacing.Axis[] axis = new EnumFacing.Axis[]{EnumFacing.Axis.Y, EnumFacing.Axis.X, EnumFacing.Axis.Z}; for (int i = 0; i < 3; i++) for (int j = 0; j < this.getTypes().length; j++) - ret.add(Pair.of(i * 5 + j, "axis=" + axis[i] + ",type=" + this.getTypes()[j])); - - return ret; + variants.put(i * 5 + j, "axis=" + axis[i] + ",type=" + this.getTypes()[j]); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarCapBase.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarCapBase.java index 51ef6dbb..b31b09b1 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarCapBase.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPillarCapBase.java @@ -2,14 +2,13 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnumPillarCap; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; public class BlockDemonPillarCapBase & IStringSerializable> extends BlockEnumPillarCap { public BlockDemonPillarCapBase(String baseName, Material materialIn, Class enumClass) { @@ -24,15 +23,9 @@ public class BlockDemonPillarCapBase & IStringSerializable> ex } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - - //This is done to make the ItemBlocks have the proper model - + public void gatherVariants(@Nonnull Int2ObjectMap variants) { for (int i = 0; i < EnumFacing.values().length; i++) for (int j = 0; j < this.getTypes().length; j++) - ret.add(Pair.of(i * 2 + j, "facing=" + EnumFacing.values()[i] + ",type=" + this.getTypes()[j])); - - return ret; + variants.put(i * 2 + j, "facing=" + EnumFacing.values()[i] + ",type=" + this.getTypes()[j]); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPylon.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPylon.java index a761816b..e24869fd 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonPylon.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonPylon.java @@ -11,11 +11,6 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.ArrayList; -import java.util.List; public class BlockDemonPylon extends BlockContainer implements IVariantProvider { public BlockDemonPylon() { @@ -59,11 +54,4 @@ public class BlockDemonPylon extends BlockContainer implements IVariantProvider public TileEntity createNewTileEntity(World world, int meta) { return new TileDemonPylon(); } - - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonStairsBase.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonStairsBase.java index 30166d16..05bd1d75 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonStairsBase.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonStairsBase.java @@ -2,13 +2,10 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnumStairs; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class BlockDemonStairsBase & IStringSerializable> extends BlockEnumStairs { public BlockDemonStairsBase(String baseName, Material materialIn, Class enumClass) { @@ -23,12 +20,8 @@ public class BlockDemonStairsBase & IStringSerializable> exten } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - + public void gatherVariants(Int2ObjectMap variants) { for (int i = 0; i < this.getTypes().length; i++) - ret.add(Pair.of(i, "facing=south,half=bottom,shape=straight,type=" + this.getTypes()[i])); - - return ret; + variants.put(i, "facing=south,half=bottom,shape=straight,type=" + this.getTypes()[i]); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonWallBase.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonWallBase.java index 2ad6bfe1..ba6699fa 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonWallBase.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonWallBase.java @@ -2,13 +2,10 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnumWall; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class BlockDemonWallBase & IStringSerializable> extends BlockEnumWall { public BlockDemonWallBase(String baseName, Material materialIn, Class enumClass) { @@ -23,12 +20,8 @@ public class BlockDemonWallBase & IStringSerializable> extends } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - + public void gatherVariants(Int2ObjectMap variants) { for (int i = 0; i < this.getTypes().length; i++) - ret.add(Pair.of(i, "east=true,north=false,south=false,type=" + this.getTypes()[i] + ",up=true,west=true")); - - return ret; + variants.put(i, "east=true,north=false,south=false,type=" + this.getTypes()[i] + ",up=true,west=true"); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockIncenseAltar.java b/src/main/java/WayofTime/bloodmagic/block/BlockIncenseAltar.java index 87048b65..e77d0982 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockIncenseAltar.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockIncenseAltar.java @@ -13,12 +13,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlock { protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.3F, 0F, 0.3F, 0.72F, 1F, 0.72F); @@ -83,13 +79,6 @@ public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlo return new TileIncenseAltar(); } - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } - @Override public ItemBlock getItem() { return new ItemBlock(this); diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java index e5b3b04d..f9c17e29 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java @@ -4,6 +4,7 @@ import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnum; import WayofTime.bloodmagic.block.enums.EnumSubWillType; import WayofTime.bloodmagic.tile.TileInversionPillar; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; @@ -14,10 +15,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.Properties; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.ArrayList; -import java.util.List; public class BlockInversionPillar extends BlockEnum { public BlockInversionPillar() { @@ -73,11 +70,9 @@ public class BlockInversionPillar extends BlockEnum { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); + public void gatherVariants(Int2ObjectMap variants) { for (int i = 0; i < this.getTypes().length; i++) - ret.add(Pair.of(i, "static=false,type=" + this.getTypes()[i])); - return ret; + variants.put(i, "static=false,type=" + this.getTypes()[i]); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillarEnd.java b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillarEnd.java index 7fb5b5d5..54193ee9 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillarEnd.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillarEnd.java @@ -4,17 +4,13 @@ import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.block.base.BlockEnum; import WayofTime.bloodmagic.block.enums.EnumInversionCap; import WayofTime.bloodmagic.client.IVariantProvider; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.ArrayList; -import java.util.List; public class BlockInversionPillarEnd extends BlockEnum implements IVariantProvider { public BlockInversionPillarEnd() { @@ -54,10 +50,8 @@ public class BlockInversionPillarEnd extends BlockEnum impleme } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); + public void gatherVariants(Int2ObjectMap variants) { for (int i = 0; i < this.getTypes().length; i++) - ret.add(new ImmutablePair<>(i, "type=" + this.getTypes()[i])); - return ret; + variants.put(i, "type=" + this.getTypes()[i]); } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java b/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java index 6744b025..bb6ad64a 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java @@ -15,12 +15,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; import java.util.Random; public class BlockPhantom extends Block implements IVariantProvider { @@ -83,11 +79,4 @@ public class BlockPhantom extends Block implements IVariantProvider { public TileEntity createTileEntity(World world, IBlockState state) { return new TilePhantomBlock(100); } - - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java b/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java index 773d98b9..bb26cf20 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java @@ -4,7 +4,7 @@ import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode; import WayofTime.bloodmagic.tile.routing.TileRoutingNode; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; @@ -19,9 +19,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; public class BlockRoutingNode extends Block implements IBMBlock, IVariantProvider { public static final PropertyBool UP = PropertyBool.create("up"); @@ -132,7 +131,7 @@ public class BlockRoutingNode extends Block implements IBMBlock, IVariantProvide } @Override - public List> getVariants() { - return Lists.newArrayList(Pair.of(0, "inventory")); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "inventory"); } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java b/src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java index e4a0a271..4f93536b 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockSoulForge.java @@ -1,9 +1,9 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileSoulForge; +import WayofTime.bloodmagic.util.Constants; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -18,12 +18,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock { protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.06F, 0.0F, 0.06F, 0.94F, 0.75F, 0.94F); @@ -97,13 +93,6 @@ public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock return new TileSoulForge(); } - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } - @Override public ItemBlock getItem() { return new ItemBlock(this); diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java b/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java index 2aa70bea..6802804b 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java @@ -2,7 +2,6 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.ConfigHandler; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileSpectralBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,15 +17,12 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Random; -public class BlockSpectral extends Block implements IVariantProvider { +public class BlockSpectral extends Block { protected static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0); public BlockSpectral() { @@ -106,11 +102,4 @@ public class BlockSpectral extends Block implements IVariantProvider { public TileEntity createTileEntity(World world, IBlockState state) { return new TileSpectralBlock(); } - - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockTeleposer.java b/src/main/java/WayofTime/bloodmagic/block/BlockTeleposer.java index 5ac1eaf1..22fb0307 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockTeleposer.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockTeleposer.java @@ -1,10 +1,10 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.item.ItemTelepositionFocus; import WayofTime.bloodmagic.tile.TileTeleposer; +import WayofTime.bloodmagic.util.Constants; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -17,11 +17,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.ArrayList; -import java.util.List; public class BlockTeleposer extends BlockContainer implements IVariantProvider, IBMBlock { public BlockTeleposer() { @@ -64,13 +59,6 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider, return new TileTeleposer(); } - @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "normal")); - return ret; - } - @Override public ItemBlock getItem() { return new ItemBlock(this); diff --git a/src/main/java/WayofTime/bloodmagic/block/base/BlockEnum.java b/src/main/java/WayofTime/bloodmagic/block/base/BlockEnum.java index 2691f724..0734740e 100644 --- a/src/main/java/WayofTime/bloodmagic/block/base/BlockEnum.java +++ b/src/main/java/WayofTime/bloodmagic/block/base/BlockEnum.java @@ -3,7 +3,7 @@ package WayofTime.bloodmagic.block.base; import WayofTime.bloodmagic.block.IBMBlock; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.item.block.base.ItemBlockEnum; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; @@ -14,9 +14,8 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; public class BlockEnum & IStringSerializable> extends Block implements IBMBlock, IVariantProvider { private final E[] types; @@ -77,15 +76,12 @@ public class BlockEnum & IStringSerializable> extends Block im } @Override - public List> getVariants() { - List> variants = Lists.newArrayList(); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { if (getItem() == null) - return variants; + return; for (int i = 0; i < types.length; i++) - variants.add(Pair.of(i, getProperty().getName() + "=" + types[i].name())); - - return variants; + variants.put(i, getProperty().getName() + "=" + types[i].name()); } public E[] getTypes() { diff --git a/src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java b/src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java index 6706e2c6..fb8ec3c2 100644 --- a/src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java +++ b/src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java @@ -6,7 +6,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; -import java.util.List; +import java.util.function.Consumer; /** * Provides a custom {@link ItemMeshDefinition} for automatic registration of @@ -22,11 +22,9 @@ public interface IMeshProvider { ItemMeshDefinition getMeshDefinition(); /** - * Gets all possible variants for this item - * - * @return - All possible variants for this item + * Gathers all possible variants for this item */ - List getVariants(); + void gatherVariants(Consumer variants); /** * If a custom ResourceLocation is required, return it here. diff --git a/src/main/java/WayofTime/bloodmagic/client/IVariantProvider.java b/src/main/java/WayofTime/bloodmagic/client/IVariantProvider.java index c37d9958..cffbd900 100644 --- a/src/main/java/WayofTime/bloodmagic/client/IVariantProvider.java +++ b/src/main/java/WayofTime/bloodmagic/client/IVariantProvider.java @@ -1,9 +1,13 @@ package WayofTime.bloodmagic.client; -import org.apache.commons.lang3.tuple.Pair; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import net.minecraft.block.Block; -import java.util.List; +import javax.annotation.Nonnull; public interface IVariantProvider { - List> getVariants(); + + default void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, this instanceof Block ? "normal" : "inventory"); + } } diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java index 0d7544ad..76d5da2c 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java @@ -19,6 +19,9 @@ import WayofTime.bloodmagic.item.soul.*; import WayofTime.bloodmagic.item.types.ComponentTypes; import WayofTime.bloodmagic.item.types.ShardType; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; @@ -33,14 +36,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; import java.util.List; +import java.util.Set; @Mod.EventBusSubscriber(modid = BloodMagic.MODID) @GameRegistry.ObjectHolder(BloodMagic.MODID) @SuppressWarnings("unchecked") public class RegistrarBloodMagicItems { + public static final Item BLOOD_ORB = Items.AIR; public static final Item ACTIVATION_CRYSTAL = Items.AIR; public static final Item SLATE = Items.AIR; @@ -210,9 +214,10 @@ public class RegistrarBloodMagicItems { @SubscribeEvent public static void registerRenders(ModelRegistryEvent event) { items.stream().filter(i -> i instanceof IVariantProvider).forEach(i -> { - IVariantProvider variantProvider = (IVariantProvider) i; - for (Pair variant : variantProvider.getVariants()) - ModelLoader.setCustomModelResourceLocation(i, variant.getLeft(), new ModelResourceLocation(i.getRegistryName(), variant.getRight())); + Int2ObjectMap variants = new Int2ObjectOpenHashMap<>(); + ((IVariantProvider) i).gatherVariants(variants); + for (Int2ObjectMap.Entry variant : variants.int2ObjectEntrySet()) + ModelLoader.setCustomModelResourceLocation(i, variant.getIntKey(), new ModelResourceLocation(i.getRegistryName(), variant.getValue())); }); items.stream().filter(i -> i instanceof IMeshProvider).forEach(i -> { @@ -220,16 +225,20 @@ public class RegistrarBloodMagicItems { ResourceLocation loc = mesh.getCustomLocation(); if (loc == null) loc = i.getRegistryName(); - for (String variant : mesh.getVariants()) + + Set variants = Sets.newHashSet(); + mesh.gatherVariants(variants::add); + for (String variant : variants) ModelLoader.registerItemVariants(i, new ModelResourceLocation(loc, variant)); ModelLoader.setCustomMeshDefinition(i, mesh.getMeshDefinition()); }); RegistrarBloodMagicBlocks.blocks.stream().filter(b -> b instanceof IVariantProvider).forEach(b -> { - IVariantProvider variantProvider = (IVariantProvider) b; - for (Pair variant : variantProvider.getVariants()) - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), variant.getLeft(), new ModelResourceLocation(b.getRegistryName(), variant.getRight())); + Int2ObjectMap variants = new Int2ObjectOpenHashMap<>(); + ((IVariantProvider) b).gatherVariants(variants); + for (Int2ObjectMap.Entry variant : variants.int2ObjectEntrySet()) + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), variant.getIntKey(), new ModelResourceLocation(b.getRegistryName(), variant.getValue())); }); final ResourceLocation holdingLoc = SIGIL_HOLDING.getRegistryName(); diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java index efa445e2..83ca8822 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java @@ -3,13 +3,14 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.altar.*; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.block.BlockAltar; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -23,10 +24,8 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantProvider { @@ -88,10 +87,8 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=altarmaker")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=altarmaker"); // FIXME } public void setTierToBuild(EnumAltarTier tierToBuild) { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemArcaneAshes.java b/src/main/java/WayofTime/bloodmagic/item/ItemArcaneAshes.java index ff20254d..41ebf298 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemArcaneAshes.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemArcaneAshes.java @@ -5,6 +5,7 @@ import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; import WayofTime.bloodmagic.tile.TileAlchemyArray; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -17,10 +18,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; import java.util.List; public class ItemArcaneAshes extends Item implements IVariantProvider { @@ -61,9 +59,7 @@ public class ItemArcaneAshes extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=arcaneashes")); - return ret; + public void gatherVariants(Int2ObjectMap variants) { + variants.put(0, "type=arcaneashes"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java index 589e91ee..f4b092e0 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java @@ -1,10 +1,10 @@ package WayofTime.bloodmagic.item; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import WayofTime.bloodmagic.util.BlockStack; import WayofTime.bloodmagic.util.ItemStackWrapper; import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; @@ -22,7 +22,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -31,10 +30,9 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.function.Consumer; public class ItemBoundAxe extends ItemBoundTool implements IMeshProvider { private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER); @@ -123,17 +121,9 @@ public class ItemBoundAxe extends ItemBoundTool implements IMeshProvider { return new CustomMeshDefinitionActivatable("bound_axe"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("active=true"); - ret.add("active=false"); - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("active=true"); + variants.accept("active=false"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java index f54d39a7..8e7da20c 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java @@ -1,10 +1,10 @@ package WayofTime.bloodmagic.item; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import WayofTime.bloodmagic.util.BlockStack; import WayofTime.bloodmagic.util.ItemStackWrapper; import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; @@ -21,7 +21,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -30,10 +29,9 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.function.Consumer; public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider { private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB); @@ -136,17 +134,9 @@ public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider { return new CustomMeshDefinitionActivatable("bound_pickaxe"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("active=true"); - ret.add("active=false"); - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("active=true"); + variants.accept("active=false"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java index 910a4658..a1426e9e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java @@ -1,10 +1,10 @@ package WayofTime.bloodmagic.item; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import WayofTime.bloodmagic.util.BlockStack; import WayofTime.bloodmagic.util.ItemStackWrapper; import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; @@ -21,7 +21,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -30,10 +29,9 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.function.Consumer; public class ItemBoundShovel extends ItemBoundTool implements IMeshProvider { private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND); @@ -122,17 +120,9 @@ public class ItemBoundShovel extends ItemBoundTool implements IMeshProvider { return new CustomMeshDefinitionActivatable("bound_shovel"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("active=true"); - ret.add("active=false"); - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("active=true"); + variants.accept("active=false"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundSword.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundSword.java index c7d49cfc..1c67b320 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundSword.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundSword.java @@ -1,14 +1,14 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.core.data.Binding; -import WayofTime.bloodmagic.iface.IActivatable; -import WayofTime.bloodmagic.iface.IBindable; -import WayofTime.bloodmagic.util.helper.NetworkHelper; import WayofTime.bloodmagic.client.IMeshProvider; import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.core.data.Binding; +import WayofTime.bloodmagic.iface.IActivatable; +import WayofTime.bloodmagic.iface.IBindable; import WayofTime.bloodmagic.util.Utils; +import WayofTime.bloodmagic.util.helper.NetworkHelper; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -27,15 +27,13 @@ import net.minecraft.item.ItemSword; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; public class ItemBoundSword extends ItemSword implements IBindable, IActivatable, IMeshProvider { public ItemBoundSword() { @@ -132,17 +130,9 @@ public class ItemBoundSword extends ItemSword implements IBindable, IActivatable return new CustomMeshDefinitionActivatable("bound_sword"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("active=true"); - ret.add("active=false"); - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("active=true"); + variants.accept("active=false"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java index 15140d9c..3b5203a9 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java @@ -2,11 +2,11 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.PleaseStopUsingMe; import WayofTime.bloodmagic.util.helper.PlayerSacrificeHelper; import WayofTime.bloodmagic.util.helper.PurificationHelper; -import WayofTime.bloodmagic.client.IVariantProvider; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.EntityAnimal; @@ -19,9 +19,8 @@ import net.minecraft.util.SoundCategory; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityRegistry; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; public class ItemDaggerOfSacrifice extends Item implements IVariantProvider { public ItemDaggerOfSacrifice() { @@ -79,9 +78,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - ret.add(Pair.of(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemDemonWillGauge.java b/src/main/java/WayofTime/bloodmagic/item/ItemDemonWillGauge.java index 3a0a86ad..bc8448ea 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemDemonWillGauge.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemDemonWillGauge.java @@ -1,9 +1,10 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.iface.IDemonWillViewer; import WayofTime.bloodmagic.client.IVariantProvider; +import WayofTime.bloodmagic.iface.IDemonWillViewer; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -11,10 +12,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; @@ -32,10 +31,8 @@ public class ItemDemonWillGauge extends Item implements IVariantProvider, IDemon } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=willgauge")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=willgauge"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemEnum.java b/src/main/java/WayofTime/bloodmagic/item/ItemEnum.java index c4def10f..e949e446 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemEnum.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemEnum.java @@ -3,7 +3,7 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.item.types.ISubItem; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,9 +11,6 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class ItemEnum & ISubItem> extends Item { @@ -55,12 +52,9 @@ public class ItemEnum & ISubItem> extends Item { } @Override - public List> getVariants() { - List> variants = Lists.newArrayList(); + public void gatherVariants(Int2ObjectMap variants) { for (int i = 0; i < types.length; i++) - variants.add(Pair.of(i, "type=" + types[i].getInternalName())); - - return variants; + variants.put(i, "type=" + types[i].getInternalName()); } } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemExperienceBook.java b/src/main/java/WayofTime/bloodmagic/item/ItemExperienceBook.java index 24474e87..5d8bc69e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemExperienceBook.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemExperienceBook.java @@ -1,10 +1,11 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; @@ -17,10 +18,8 @@ import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; public class ItemExperienceBook extends Item implements IVariantProvider { @@ -64,10 +63,8 @@ public class ItemExperienceBook extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=experiencetome")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=experiencetome"); } public void giveOneLevelExpToPlayer(ItemStack stack, EntityPlayer player) { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java index 52a3e3c4..cebbe121 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java @@ -1,19 +1,18 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.util.helper.NetworkHelper; import WayofTime.bloodmagic.util.helper.PlayerHelper; -import WayofTime.bloodmagic.client.IVariantProvider; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvider { @@ -62,9 +61,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvide } @Override - public List> getVariants() { - List> ret = Lists.newArrayList(); - ret.add(Pair.of(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemPotionFlask.java b/src/main/java/WayofTime/bloodmagic/item/ItemPotionFlask.java index ef73018c..0d7f9e01 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemPotionFlask.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemPotionFlask.java @@ -1,10 +1,9 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.TextHelper; -import com.google.common.collect.Lists; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -24,8 +23,8 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.List; +import java.util.function.Consumer; public class ItemPotionFlask extends Item implements IMeshProvider { public ItemPotionFlask() { @@ -131,14 +130,9 @@ public class ItemPotionFlask extends Item implements IMeshProvider { }; } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - return Lists.newArrayList("full=true", "full=false"); + public void gatherVariants(Consumer variants) { + variants.accept("full=true"); + variants.accept("full=false"); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java index d39fc897..1de11784 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java @@ -1,22 +1,23 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.ritual.RitualRegistry; +import WayofTime.bloodmagic.client.IVariantProvider; +import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; import WayofTime.bloodmagic.ritual.EnumRuneType; import WayofTime.bloodmagic.ritual.Ritual; import WayofTime.bloodmagic.ritual.RitualComponent; +import WayofTime.bloodmagic.ritual.RitualRegistry; import WayofTime.bloodmagic.soul.EnumDemonWillType; -import WayofTime.bloodmagic.util.helper.RitualHelper; -import WayofTime.bloodmagic.client.IVariantProvider; -import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; import WayofTime.bloodmagic.tile.TileMasterRitualStone; import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.handler.event.ClientHandler; +import WayofTime.bloodmagic.util.helper.RitualHelper; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.base.Strings; import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; @@ -35,11 +36,9 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.input.Keyboard; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; @@ -336,12 +335,10 @@ public class ItemRitualDiviner extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=basic")); - ret.add(new ImmutablePair<>(1, "type=dusk")); - ret.add(new ImmutablePair<>(2, "type=dawn")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=basic"); + variants.put(1, "type=dusk"); + variants.put(2, "type=dawn"); } public void cycleDirection(ItemStack stack, EntityPlayer player) { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java index 0b203dd9..9cc9c6df 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java @@ -1,15 +1,16 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.ritual.EnumRitualReaderState; import WayofTime.bloodmagic.ritual.IMasterRitualStone; import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDiscreteDemonWill; -import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -23,10 +24,9 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.input.Keyboard; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -233,9 +233,7 @@ public class ItemRitualReader extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java index 3ffdf74d..11a6381d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java @@ -1,16 +1,16 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.ConfigHandler; -import WayofTime.bloodmagic.util.PleaseStopUsingMe; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent; +import WayofTime.bloodmagic.item.types.ISubItem; +import WayofTime.bloodmagic.tile.TileAltar; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.PleaseStopUsingMe; import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.PlayerHelper; import WayofTime.bloodmagic.util.helper.PlayerSacrificeHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.item.types.ISubItem; -import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -30,10 +30,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nonnull; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; +import java.util.function.Consumer; public class ItemSacrificialDagger extends ItemEnum implements IMeshProvider { @@ -165,12 +165,10 @@ public class ItemSacrificialDagger extends ItemEnum getVariants() { - List variants = new ArrayList<>(); - variants.add("type=normal"); - variants.add("type=creative"); - variants.add("type=ceremonial"); - return variants; + public void gatherVariants(Consumer variants) { + variants.accept("type=normal"); + variants.accept("type=creative"); + variants.accept("type=ceremonial"); } public enum DaggerType implements ISubItem { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java index 85fd255a..377c401e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java @@ -1,16 +1,17 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.IAltarManipulator; -import WayofTime.bloodmagic.iface.IDocumentedBlock; -import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.client.IVariantProvider; +import WayofTime.bloodmagic.iface.IDocumentedBlock; import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -28,9 +29,8 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; -import java.util.Collections; +import javax.annotation.Nonnull; import java.util.List; public class ItemSanguineBook extends Item implements IVariantProvider, IAltarManipulator { @@ -109,7 +109,7 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa // IVariantProvider @Override - public List> getVariants() { - return Collections.singletonList(Pair.of(0, "type=normal")); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTome.java b/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTome.java index a6bfe3b2..dc7d64b3 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTome.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTome.java @@ -1,13 +1,14 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.livingArmour.LivingArmourHandler; -import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; -import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.item.armour.ItemLivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour; +import WayofTime.bloodmagic.livingArmour.LivingArmourHandler; +import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; +import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -20,10 +21,8 @@ import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; import java.util.Map.Entry; @@ -96,10 +95,8 @@ public class ItemUpgradeTome extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=upgradetome")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=upgradetome"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java b/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java index 1f6b9e6d..cef99437 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java @@ -1,12 +1,13 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.iface.IUpgradeTrainer; import WayofTime.bloodmagic.livingArmour.LivingArmourHandler; import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -15,9 +16,8 @@ import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; @@ -82,9 +82,7 @@ public class ItemUpgradeTrainer extends Item implements IUpgradeTrainer, IVarian } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=upgradetrainer")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=upgradetrainer"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 8f4a5409..b976cb04 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -1,21 +1,21 @@ package WayofTime.bloodmagic.item.armour; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; -import WayofTime.bloodmagic.livingArmour.StatTracker; -import WayofTime.bloodmagic.core.data.SoulNetwork; -import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.util.helper.NetworkHelper; import WayofTime.bloodmagic.client.IMeshProvider; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.core.data.SoulNetwork; import WayofTime.bloodmagic.item.types.ComponentTypes; import WayofTime.bloodmagic.livingArmour.LivingArmour; +import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; +import WayofTime.bloodmagic.livingArmour.StatTracker; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerRepairing; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeElytra; import WayofTime.bloodmagic.network.BloodMagicPacketHandler; import WayofTime.bloodmagic.network.PlayerFallDistancePacketProcessor; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Utils; +import WayofTime.bloodmagic.util.helper.NBTHelper; +import WayofTime.bloodmagic.util.helper.NetworkHelper; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -44,8 +44,12 @@ import org.lwjgl.input.Keyboard; import javax.annotation.Nullable; import java.lang.reflect.Field; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.UUID; +import java.util.function.Consumer; public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider { public static final boolean useSpecialArmourCalculation = true; @@ -364,13 +368,11 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP } @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("armour=head"); - ret.add("armour=body"); - ret.add("armour=leg"); - ret.add("armour=feet"); - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("armour=head"); + variants.accept("armour=body"); + variants.accept("armour=leg"); + variants.accept("armour=feet"); } public void setLivingArmour(ItemStack stack, LivingArmour armour, boolean forceWrite) { diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java index b2151097..5b043282 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java @@ -1,13 +1,13 @@ package WayofTime.bloodmagic.item.armour; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.minecraft.client.renderer.ItemMeshDefinition; @@ -33,7 +33,10 @@ import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.*; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; +import java.util.function.Consumer; public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMeshProvider, IMultiWillTool { public static String[] names = {"helmet", "chest", "legs", "boots"}; @@ -297,18 +300,15 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes } @Override - public List getVariants() { - List ret = new ArrayList<>(); + public void gatherVariants(Consumer variants) { for (EnumDemonWillType type : EnumDemonWillType.values()) { String additional = "_" + type.getName().toLowerCase(); - ret.add("armour=head" + additional); - ret.add("armour=body" + additional); - ret.add("armour=leg" + additional); - ret.add("armour=feet" + additional); + variants.accept("armour=head" + additional); + variants.accept("armour=body" + additional); + variants.accept("armour=leg" + additional); + variants.accept("armour=feet" + additional); } - - return ret; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockAlchemyTable.java b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockAlchemyTable.java index 6f082408..3a42a40e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockAlchemyTable.java +++ b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockAlchemyTable.java @@ -2,7 +2,7 @@ package WayofTime.bloodmagic.item.block; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileAlchemyTable; -import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -12,9 +12,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class ItemBlockAlchemyTable extends ItemBlock implements IVariantProvider { public ItemBlockAlchemyTable(Block block) { @@ -64,7 +61,7 @@ public class ItemBlockAlchemyTable extends ItemBlock implements IVariantProvider } @Override - public List> getVariants() { - return Lists.newArrayList(Pair.of(0, "inventory")); + public void gatherVariants(Int2ObjectMap variants) { + variants.put(0, "inventory"); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java index a726b800..31dfe5b2 100644 --- a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java @@ -1,14 +1,15 @@ package WayofTime.bloodmagic.item.gear; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.altar.IAltarManipulator; import WayofTime.bloodmagic.altar.IBloodAltar; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.iface.IItemLPContainer; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.ItemHelper.LPContainer; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -20,10 +21,8 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, IItemLPContainer, IVariantProvider { @@ -76,10 +75,8 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } // IFillable diff --git a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java index 492dd868..a0c08a87 100644 --- a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java @@ -1,15 +1,16 @@ package WayofTime.bloodmagic.item.gear; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.altar.IAltarManipulator; import WayofTime.bloodmagic.altar.IBloodAltar; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.iface.IItemLPContainer; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.ItemHelper.LPContainer; import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -21,10 +22,8 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulator, IItemLPContainer, IVariantProvider { @@ -101,10 +100,8 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } // IFillable diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/ItemFluidRouterFilter.java b/src/main/java/WayofTime/bloodmagic/item/routing/ItemFluidRouterFilter.java index 94fbf3ec..1437dbd1 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/ItemFluidRouterFilter.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/ItemFluidRouterFilter.java @@ -7,6 +7,7 @@ import WayofTime.bloodmagic.routing.IFluidFilter; import WayofTime.bloodmagic.routing.RoutingFluidFilter; import WayofTime.bloodmagic.util.GhostItemHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -17,9 +18,8 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -121,10 +121,8 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=exact")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=exact"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java b/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java index d8fb3a56..7994c36b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java @@ -1,13 +1,14 @@ package WayofTime.bloodmagic.item.routing; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.iface.INodeRenderer; -import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.client.IVariantProvider; +import WayofTime.bloodmagic.iface.INodeRenderer; import WayofTime.bloodmagic.routing.IMasterRoutingNode; import WayofTime.bloodmagic.routing.IRoutingNode; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -22,10 +23,8 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.LinkedList; import java.util.List; @@ -176,10 +175,8 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } public BlockPos getBlockPos(ItemStack stack) { diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java b/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java index a7c1d197..840f1c27 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java @@ -6,6 +6,7 @@ import WayofTime.bloodmagic.item.inventory.ItemInventory; import WayofTime.bloodmagic.routing.*; import WayofTime.bloodmagic.util.GhostItemHelper; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -16,9 +17,8 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandler; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -138,13 +138,11 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=exact")); - ret.add(new ImmutablePair<>(1, "type=ignorenbt")); - ret.add(new ImmutablePair<>(2, "type=moditems")); - ret.add(new ImmutablePair<>(3, "type=oredict")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=exact"); + variants.put(1, "type=ignorenbt"); + variants.put(2, "type=moditems"); + variants.put(3, "type=oredict"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBase.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBase.java index 39d5689d..c9f5747b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBase.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBase.java @@ -1,18 +1,18 @@ package WayofTime.bloodmagic.item.sigil; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.item.ItemSigil; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; @@ -52,10 +52,8 @@ public class ItemSigilBase extends ItemSigil implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(Pair.of(0, "type=normal")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=normal"); } public String getName() { diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHolding.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHolding.java index 32fa6957..76a2b19b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHolding.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHolding.java @@ -1,16 +1,17 @@ package WayofTime.bloodmagic.item.sigil; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.key.IKeybindable; +import WayofTime.bloodmagic.client.key.KeyBindings; import WayofTime.bloodmagic.iface.IAltarReader; import WayofTime.bloodmagic.iface.IBindable; import WayofTime.bloodmagic.iface.ISigil; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.PlayerHelper; -import WayofTime.bloodmagic.client.key.IKeybindable; -import WayofTime.bloodmagic.client.key.KeyBindings; -import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -23,10 +24,8 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; -import java.util.Collections; import java.util.List; public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAltarReader, ISigil.Holding { @@ -166,8 +165,8 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl } @Override - public List> getVariants() { - return Collections.emptyList(); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + } public static int next(int mode) { diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilToggleableBase.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilToggleableBase.java index 952a8712..6aa74856 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilToggleableBase.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilToggleableBase.java @@ -1,23 +1,21 @@ package WayofTime.bloodmagic.item.sigil; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.core.data.Binding; -import WayofTime.bloodmagic.item.ItemSigilToggleable; import WayofTime.bloodmagic.client.IMeshProvider; import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable; +import WayofTime.bloodmagic.core.data.Binding; +import WayofTime.bloodmagic.item.ItemSigilToggleable; import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.function.Consumer; public class ItemSigilToggleableBase extends ItemSigilToggleable implements IMeshProvider { @@ -54,18 +52,9 @@ public class ItemSigilToggleableBase extends ItemSigilToggleable implements IMes return new CustomMeshDefinitionActivatable("sigil_" + name.toLowerCase(Locale.ROOT)); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - ret.add("active=false"); - ret.add("active=true"); - - return ret; + public void gatherVariants(Consumer variants) { + variants.accept("active=false"); + variants.accept("active=true"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java index 604826b0..9cb62f6d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java @@ -1,24 +1,25 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.soul.EnumDemonWillType; -import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.client.IMeshProvider; import WayofTime.bloodmagic.item.armour.ItemSentientArmour; -import com.google.common.collect.Lists; +import WayofTime.bloodmagic.soul.EnumDemonWillType; +import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.*; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.List; +import java.util.function.Consumer; public class ItemSentientArmourGem extends Item implements IMeshProvider { public ItemSentientArmourGem() { @@ -73,13 +74,8 @@ public class ItemSentientArmourGem extends Item implements IMeshProvider { } @Override - public List getVariants() { - return Lists.newArrayList("type=activated", "type=deactivated"); - } - - @Nullable - @Override - public ResourceLocation getCustomLocation() { - return null; + public void gatherVariants(Consumer variants) { + variants.accept("type=activated"); + variants.accept("type=deactivated"); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java index ca4a4558..9f9bb426 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java @@ -1,7 +1,10 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.iface.ISentientSwordEffectProvider; import WayofTime.bloodmagic.iface.ISentientTool; @@ -9,11 +12,8 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWill; import WayofTime.bloodmagic.soul.IDemonWillWeapon; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -36,14 +36,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.*; +import java.util.function.Consumer; public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool { public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000}; @@ -300,20 +299,10 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP return new CustomMeshDefinitionMultiWill("sentient_axe"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - for (EnumDemonWillType type : EnumDemonWillType.values()) { - ret.add("type=" + type.getName().toLowerCase()); - } - - return ret; + public void gatherVariants(Consumer variants) { + for (EnumDemonWillType type : EnumDemonWillType.values()) + variants.accept("type=" + type.getName().toLowerCase()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java index 57314155..b4b104bc 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java @@ -1,17 +1,17 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.iface.IMultiWillTool; -import WayofTime.bloodmagic.iface.ISentientTool; -import WayofTime.bloodmagic.soul.EnumDemonWillType; -import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; -import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow; -import com.google.common.collect.Lists; +import WayofTime.bloodmagic.iface.IMultiWillTool; +import WayofTime.bloodmagic.iface.ISentientTool; +import WayofTime.bloodmagic.soul.EnumDemonWillType; +import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NBTHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -34,9 +34,8 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.Pair; -import java.util.List; +import javax.annotation.Nonnull; import java.util.Locale; public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool, IVariantProvider//, IMeshProvider @@ -253,8 +252,8 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien } @Override - public List> getVariants() { - return Lists.newArrayList(Pair.of(0, "inventory")); + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "inventory"); } public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity) { diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java index a1ffaaac..f939b4e3 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java @@ -1,7 +1,10 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.iface.ISentientSwordEffectProvider; import WayofTime.bloodmagic.iface.ISentientTool; @@ -9,11 +12,8 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWill; import WayofTime.bloodmagic.soul.IDemonWillWeapon; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -36,14 +36,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.*; +import java.util.function.Consumer; public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool { public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000}; @@ -299,20 +298,10 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon return new CustomMeshDefinitionMultiWill("sentient_pickaxe"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - for (EnumDemonWillType type : EnumDemonWillType.values()) { - ret.add("type=" + type.getName().toLowerCase()); - } - - return ret; + public void gatherVariants(Consumer variants) { + for (EnumDemonWillType type : EnumDemonWillType.values()) + variants.accept("type=" + type.getName().toLowerCase()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java index deb5056c..995f80ac 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java @@ -1,7 +1,10 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.iface.ISentientSwordEffectProvider; import WayofTime.bloodmagic.iface.ISentientTool; @@ -9,11 +12,8 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWill; import WayofTime.bloodmagic.soul.IDemonWillWeapon; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -36,14 +36,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.*; +import java.util.function.Consumer; public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool { public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000}; @@ -300,20 +299,10 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I return new CustomMeshDefinitionMultiWill("sentient_shovel"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - for (EnumDemonWillType type : EnumDemonWillType.values()) { - ret.add("type=" + type.getName().toLowerCase()); - } - - return ret; + public void gatherVariants(Consumer variants) { + for (EnumDemonWillType type : EnumDemonWillType.values()) + variants.accept("type=" + type.getName().toLowerCase()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientSword.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientSword.java index 13206057..d97cab1c 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientSword.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientSword.java @@ -1,7 +1,10 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; +import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.iface.ISentientSwordEffectProvider; import WayofTime.bloodmagic.iface.ISentientTool; @@ -9,11 +12,8 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWill; import WayofTime.bloodmagic.soul.IDemonWillWeapon; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill; -import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -34,14 +34,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.*; +import java.util.function.Consumer; public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool { public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000, 2000, 4000}; @@ -275,20 +274,10 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM return new CustomMeshDefinitionMultiWill("sentient_sword"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); - for (EnumDemonWillType type : EnumDemonWillType.values()) { - ret.add("type=" + type.getName().toLowerCase()); - } - - return ret; + public void gatherVariants(Consumer variants) { + for (EnumDemonWillType type : EnumDemonWillType.values()) + variants.accept("type=" + type.getName().toLowerCase()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java index d55aa834..aa678159 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java @@ -1,15 +1,15 @@ package WayofTime.bloodmagic.item.soul; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.client.IMeshProvider; +import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionWillGem; import WayofTime.bloodmagic.iface.IMultiWillTool; import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWill; import WayofTime.bloodmagic.soul.IDemonWillGem; import WayofTime.bloodmagic.soul.PlayerDemonWillHandler; +import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionWillGem; import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.util.ITooltipFlag; @@ -18,16 +18,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.function.Consumer; public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, IMultiWillTool { public static String[] names = {"petty", "lesser", "common", "greater", "grand"}; @@ -64,24 +66,15 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I return new CustomMeshDefinitionWillGem("soul_gem"); } - @Nullable @Override - public ResourceLocation getCustomLocation() { - return null; - } - - @Override - public List getVariants() { - List ret = new ArrayList<>(); + public void gatherVariants(Consumer variants) { for (EnumDemonWillType type : EnumDemonWillType.values()) { - ret.add("type=petty_" + type.getName().toLowerCase()); - ret.add("type=lesser_" + type.getName().toLowerCase()); - ret.add("type=common_" + type.getName().toLowerCase()); - ret.add("type=greater_" + type.getName().toLowerCase()); - ret.add("type=grand_" + type.getName().toLowerCase()); + variants.accept("type=petty_" + type.getName().toLowerCase()); + variants.accept("type=lesser_" + type.getName().toLowerCase()); + variants.accept("type=common_" + type.getName().toLowerCase()); + variants.accept("type=greater_" + type.getName().toLowerCase()); + variants.accept("type=grand_" + type.getName().toLowerCase()); } - - return ret; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java index 15e42172..50971b17 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java @@ -4,6 +4,7 @@ import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare; import WayofTime.bloodmagic.util.helper.TextHelper; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -14,10 +15,8 @@ import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; @@ -75,9 +74,7 @@ public class ItemSoulSnare extends Item implements IVariantProvider { } @Override - public List> getVariants() { - List> ret = new ArrayList<>(); - ret.add(new ImmutablePair<>(0, "type=soulsnare")); - return ret; + public void gatherVariants(@Nonnull Int2ObjectMap variants) { + variants.put(0, "type=soulsnare"); } } diff --git a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java index 04ace93a..d24ce3b8 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java @@ -1,12 +1,8 @@ package WayofTime.bloodmagic.proxy; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.client.hud.Elements; -import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.soul.DemonWillHolder; -import WayofTime.bloodmagic.client.IMeshProvider; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.helper.ShaderHelper; +import WayofTime.bloodmagic.client.hud.Elements; import WayofTime.bloodmagic.client.key.KeyBindings; import WayofTime.bloodmagic.client.render.LayerBloodElytra; import WayofTime.bloodmagic.client.render.block.*; @@ -17,18 +13,16 @@ import WayofTime.bloodmagic.entity.projectile.EntityBloodLight; import WayofTime.bloodmagic.entity.projectile.EntityMeteor; import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow; import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare; +import WayofTime.bloodmagic.soul.DemonWillHolder; import WayofTime.bloodmagic.tile.*; import WayofTime.bloodmagic.tile.routing.TileRoutingNode; +import WayofTime.bloodmagic.util.Constants; import com.google.common.collect.ImmutableMap; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.item.Item; import net.minecraft.potion.PotionUtils; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.animation.AnimationTESR; import net.minecraftforge.client.model.obj.OBJLoader; @@ -38,7 +32,6 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import org.apache.commons.lang3.tuple.Pair; import java.awt.Color; import java.util.Map; @@ -118,32 +111,6 @@ public class ClientProxy extends CommonProxy { Elements.createHUDElements(); } - @Override - public void tryHandleBlockModel(Block block, String name) { - if (block instanceof IVariantProvider) { - IVariantProvider variantProvider = (IVariantProvider) block; - for (Pair variant : variantProvider.getVariants()) - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), variant.getLeft(), new ModelResourceLocation(new ResourceLocation(BloodMagic.MODID, name), variant.getRight())); - } - } - - @Override - public void tryHandleItemModel(Item item, String name) { - if (item instanceof IMeshProvider) { - IMeshProvider meshProvider = (IMeshProvider) item; - ModelLoader.setCustomMeshDefinition(item, meshProvider.getMeshDefinition()); - ResourceLocation resourceLocation = meshProvider.getCustomLocation(); - if (resourceLocation == null) - resourceLocation = new ResourceLocation(BloodMagic.MODID, "item/" + name); - for (String variant : meshProvider.getVariants()) - ModelLoader.registerItemVariants(item, new ModelResourceLocation(resourceLocation, variant)); - } else if (item instanceof IVariantProvider) { - IVariantProvider variantProvider = (IVariantProvider) item; - for (Pair variant : variantProvider.getVariants()) - ModelLoader.setCustomModelResourceLocation(item, variant.getLeft(), new ModelResourceLocation(new ResourceLocation(BloodMagic.MODID, "item/" + name), variant.getRight())); - } - } - private void addElytraLayer() { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); try { diff --git a/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java index 6eab4d82..d63dc5a5 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/CommonProxy.java @@ -4,8 +4,6 @@ import WayofTime.bloodmagic.ritual.CapabilityRuneType; import WayofTime.bloodmagic.ritual.IRitualStone; import WayofTime.bloodmagic.teleport.TeleportQueue; import com.google.common.collect.ImmutableMap; -import net.minecraft.block.Block; -import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -36,14 +34,6 @@ public class CommonProxy { return null; } - public void tryHandleBlockModel(Block block, String name) { - // NO-OP - } - - public void tryHandleItemModel(Item item, String name) { - // NO-OP - } - public IAnimationStateMachine load(ResourceLocation location, ImmutableMap parameters) { return null; }