Cleanup model registration

This commit is contained in:
Nicholas Ignoffo 2018-03-07 19:43:00 -08:00
parent c4527d157f
commit 554993ea79
60 changed files with 338 additions and 678 deletions

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
// IDocumentedBlock
@Override

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++)
ret.add(Pair.of(i, "inventory"));
return ret;
variants.put(i, "inventory");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
@Override
public ItemBlock getItem() {
return new ItemBlock(this);

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "normal");
}
@Override

View file

@ -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<E extends Enum<E> & IStringSerializable> extends BlockEnumPillar<E> {
public BlockDemonPillarBase(String baseName, Material materialIn, Class<E> enumClass) {
@ -24,16 +23,11 @@ public class BlockDemonPillarBase<E extends Enum<E> & IStringSerializable> exten
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
//This is done to make the ItemBlocks have the proper model
public void gatherVariants(@Nonnull Int2ObjectMap<String> 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]);
}
}

View file

@ -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<E extends Enum<E> & IStringSerializable> extends BlockEnumPillarCap<E> {
public BlockDemonPillarCapBase(String baseName, Material materialIn, Class<E> enumClass) {
@ -24,15 +23,9 @@ public class BlockDemonPillarCapBase<E extends Enum<E> & IStringSerializable> ex
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
//This is done to make the ItemBlocks have the proper model
public void gatherVariants(@Nonnull Int2ObjectMap<String> 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]);
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
}

View file

@ -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<E extends Enum<E> & IStringSerializable> extends BlockEnumStairs<E> {
public BlockDemonStairsBase(String baseName, Material materialIn, Class<E> enumClass) {
@ -23,12 +20,8 @@ public class BlockDemonStairsBase<E extends Enum<E> & IStringSerializable> exten
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
public void gatherVariants(Int2ObjectMap<String> 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]);
}
}

View file

@ -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<E extends Enum<E> & IStringSerializable> extends BlockEnumWall<E> {
public BlockDemonWallBase(String baseName, Material materialIn, Class<E> enumClass) {
@ -23,12 +20,8 @@ public class BlockDemonWallBase<E extends Enum<E> & IStringSerializable> extends
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
public void gatherVariants(Int2ObjectMap<String> 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");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
@Override
public ItemBlock getItem() {
return new ItemBlock(this);

View file

@ -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<EnumSubWillType> {
public BlockInversionPillar() {
@ -73,11 +70,9 @@ public class BlockInversionPillar extends BlockEnum<EnumSubWillType> {
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
public void gatherVariants(Int2ObjectMap<String> 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

View file

@ -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<EnumInversionCap> implements IVariantProvider {
public BlockInversionPillarEnd() {
@ -54,10 +50,8 @@ public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> impleme
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
public void gatherVariants(Int2ObjectMap<String> 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]);
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
return Lists.newArrayList(Pair.of(0, "inventory"));
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "inventory");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
@Override
public ItemBlock getItem() {
return new ItemBlock(this);

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "normal"));
return ret;
}
@Override
public ItemBlock getItem() {
return new ItemBlock(this);

View file

@ -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<E extends Enum<E> & IStringSerializable> extends Block implements IBMBlock, IVariantProvider {
private final E[] types;
@ -77,15 +76,12 @@ public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block im
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> variants = Lists.newArrayList();
public void gatherVariants(@Nonnull Int2ObjectMap<String> 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() {

View file

@ -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<String> getVariants();
void gatherVariants(Consumer<String> variants);
/**
* If a custom ResourceLocation is required, return it here.

View file

@ -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<Pair<Integer, String>> getVariants();
default void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, this instanceof Block ? "normal" : "inventory");
}
}

View file

@ -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<Integer, String> variant : variantProvider.getVariants())
ModelLoader.setCustomModelResourceLocation(i, variant.getLeft(), new ModelResourceLocation(i.getRegistryName(), variant.getRight()));
Int2ObjectMap<String> variants = new Int2ObjectOpenHashMap<>();
((IVariantProvider) i).gatherVariants(variants);
for (Int2ObjectMap.Entry<String> 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<String> 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<Integer, String> variant : variantProvider.getVariants())
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), variant.getLeft(), new ModelResourceLocation(b.getRegistryName(), variant.getRight()));
Int2ObjectMap<String> variants = new Int2ObjectOpenHashMap<>();
((IVariantProvider) b).gatherVariants(variants);
for (Int2ObjectMap.Entry<String> variant : variants.int2ObjectEntrySet())
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), variant.getIntKey(), new ModelResourceLocation(b.getRegistryName(), variant.getValue()));
});
final ResourceLocation holdingLoc = SIGIL_HOLDING.getRegistryName();

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=altarmaker"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=altarmaker"); // FIXME
}
public void setTierToBuild(EnumAltarTier tierToBuild) {

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=arcaneashes"));
return ret;
public void gatherVariants(Int2ObjectMap<String> variants) {
variants.put(0, "type=arcaneashes");
}
}

View file

@ -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<Block> 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<String> getVariants() {
List<String> ret = new ArrayList<>();
ret.add("active=true");
ret.add("active=false");
return ret;
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=true");
variants.accept("active=false");
}
}

View file

@ -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<Block> 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<String> getVariants() {
List<String> ret = new ArrayList<>();
ret.add("active=true");
ret.add("active=false");
return ret;
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=true");
variants.accept("active=false");
}
}

View file

@ -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<Block> 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<String> getVariants() {
List<String> ret = new ArrayList<>();
ret.add("active=true");
ret.add("active=false");
return ret;
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=true");
variants.accept("active=false");
}
}

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
ret.add("active=true");
ret.add("active=false");
return ret;
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=true");
variants.accept("active=false");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
ret.add(Pair.of(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=willgauge"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=willgauge");
}
@Override

View file

@ -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<T extends Enum<T> & ISubItem> extends Item {
@ -55,12 +52,9 @@ public class ItemEnum<T extends Enum<T> & ISubItem> extends Item {
}
@Override
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> variants = Lists.newArrayList();
public void gatherVariants(Int2ObjectMap<String> 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());
}
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=experiencetome"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=experiencetome");
}
public void giveOneLevelExpToPlayer(ItemStack stack, EntityPlayer player) {

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = Lists.newArrayList();
ret.add(Pair.of(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
}

View file

@ -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<String> getVariants() {
return Lists.newArrayList("full=true", "full=false");
public void gatherVariants(Consumer<String> variants) {
variants.accept("full=true");
variants.accept("full=false");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> 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<String> variants) {
variants.put(0, "type=basic");
variants.put(1, "type=dusk");
variants.put(2, "type=dawn");
}
public void cycleDirection(ItemStack stack, EntityPlayer player) {

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
}

View file

@ -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<ItemSacrificialDagger.DaggerType> implements IMeshProvider {
@ -165,12 +165,10 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
}
@Override
public List<String> getVariants() {
List<String> variants = new ArrayList<>();
variants.add("type=normal");
variants.add("type=creative");
variants.add("type=ceremonial");
return variants;
public void gatherVariants(Consumer<String> variants) {
variants.accept("type=normal");
variants.accept("type=creative");
variants.accept("type=ceremonial");
}
public enum DaggerType implements ISubItem {

View file

@ -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<Pair<Integer, String>> getVariants() {
return Collections.singletonList(Pair.of(0, "type=normal"));
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=upgradetome"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=upgradetome");
}
@Override

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=upgradetrainer"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=upgradetrainer");
}
}

View file

@ -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<String> getVariants() {
List<String> 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<String> 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) {

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
public void gatherVariants(Consumer<String> 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

View file

@ -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<Pair<Integer, String>> getVariants() {
return Lists.newArrayList(Pair.of(0, "inventory"));
public void gatherVariants(Int2ObjectMap<String> variants) {
variants.put(0, "inventory");
}
}

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
// IFillable

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
// IFillable

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=exact"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=exact");
}
@Override

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
public BlockPos getBlockPos(ItemStack stack) {

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> 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<String> variants) {
variants.put(0, "type=exact");
variants.put(1, "type=ignorenbt");
variants.put(2, "type=moditems");
variants.put(3, "type=oredict");
}
@Override

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(Pair.of(0, "type=normal"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=normal");
}
public String getName() {

View file

@ -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<Pair<Integer, String>> getVariants() {
return Collections.emptyList();
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
}
public static int next(int mode) {

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
ret.add("active=false");
ret.add("active=true");
return ret;
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=false");
variants.accept("active=true");
}
}

View file

@ -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<String> getVariants() {
return Lists.newArrayList("type=activated", "type=deactivated");
}
@Nullable
@Override
public ResourceLocation getCustomLocation() {
return null;
public void gatherVariants(Consumer<String> variants) {
variants.accept("type=activated");
variants.accept("type=deactivated");
}
}

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
ret.add("type=" + type.getName().toLowerCase());
}
return ret;
public void gatherVariants(Consumer<String> variants) {
for (EnumDemonWillType type : EnumDemonWillType.values())
variants.accept("type=" + type.getName().toLowerCase());
}
@Override

View file

@ -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<Pair<Integer, String>> getVariants() {
return Lists.newArrayList(Pair.of(0, "inventory"));
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "inventory");
}
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity) {

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
ret.add("type=" + type.getName().toLowerCase());
}
return ret;
public void gatherVariants(Consumer<String> variants) {
for (EnumDemonWillType type : EnumDemonWillType.values())
variants.accept("type=" + type.getName().toLowerCase());
}
@Override

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
ret.add("type=" + type.getName().toLowerCase());
}
return ret;
public void gatherVariants(Consumer<String> variants) {
for (EnumDemonWillType type : EnumDemonWillType.values())
variants.accept("type=" + type.getName().toLowerCase());
}
@Override

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
ret.add("type=" + type.getName().toLowerCase());
}
return ret;
public void gatherVariants(Consumer<String> variants) {
for (EnumDemonWillType type : EnumDemonWillType.values())
variants.accept("type=" + type.getName().toLowerCase());
}
@Override

View file

@ -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<String> getVariants() {
List<String> ret = new ArrayList<>();
public void gatherVariants(Consumer<String> 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

View file

@ -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<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<>();
ret.add(new ImmutablePair<>(0, "type=soulsnare"));
return ret;
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=soulsnare");
}
}

View file

@ -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<Integer, String> 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<Integer, String> 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 {

View file

@ -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<String, ITimeValue> parameters) {
return null;
}