Update mappings

This commit is contained in:
Shadows_of_Fire 2018-08-03 22:22:20 -04:00
parent 5564bd63ef
commit 08d0e8b7fb
56 changed files with 189 additions and 293 deletions

View file

@ -23,12 +23,12 @@ if(hasProperty('buildnumber')){
}
minecraft {
version = "1.12.2-14.23.1.2599"
version = "1.12.2-14.23.4.2739"
runDir = "run"
mappings = "snapshot_20180119"
mappings = "snapshot_20180720"
makeObfSourceJar = false
replaceIn "ActuallyAdditions.java"
replace "@VERSION@", project.version.toString()
makeObfSourceJar = false
}
repositories {

View file

@ -147,7 +147,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override
@ -184,8 +184,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
public String getTranslationKey(ItemStack stack){
return this.getTranslationKey();
}
@Override

View file

@ -82,7 +82,7 @@ public class BlockBreaker extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -98,7 +98,7 @@ public class BlockCoalGenerator extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -108,7 +108,7 @@ public class BlockCoffeeMachine extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -163,8 +163,8 @@ public class BlockColoredLamp extends BlockBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return InitBlocks.blockColoredLamp.getUnlocalizedName()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName;
public String getTranslationKey(ItemStack stack){
return InitBlocks.blockColoredLamp.getTranslationKey()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName;
}
}
}

View file

@ -71,6 +71,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
}
@Override
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);

View file

@ -96,8 +96,8 @@ public class BlockCrystal extends BlockBase{
}
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_CRYSTALS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_CRYSTALS[stack.getItemDamage()].name;
}
@Override

View file

@ -79,7 +79,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override
@ -114,8 +114,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer(){
public BlockRenderLayer getRenderLayer(){
return BlockRenderLayer.TRANSLUCENT;
}

View file

@ -78,7 +78,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -77,7 +77,7 @@ public class BlockDropper extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -1,78 +0,0 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFakeAir extends Block
{
public BlockFakeAir(String name){
super(Material.AIR);
setRegistryName(name);
setUnlocalizedName("stop");
RegistryHandler.BLOCKS_TO_REGISTER.add(this);
}
/**
* The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
* LIQUID for vanilla liquids, INVISIBLE to skip all rendering
*/
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.INVISIBLE;
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return NULL_AABB;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
{
return false;
}
/**
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
}
/**
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
*/
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
{
return true;
}
public boolean isFullCube(IBlockState state)
{
return false;
}
public BlockFaceShape getBlockFaceShape(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
}
}

View file

@ -73,7 +73,7 @@ public class BlockFarmer extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -84,7 +84,7 @@ public class BlockFluidCollector extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -101,7 +101,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
boolean isOn = meta >= 4;
EnumFacing facing = EnumFacing.getHorizontal(isOn ? meta-4 : meta);
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta-4 : meta);
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
}

View file

@ -63,8 +63,7 @@ public class BlockGreenhouseGlass extends BlockBase {
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

View file

@ -92,8 +92,8 @@ public class BlockInputter extends BlockContainerBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
public String getTranslationKey(ItemStack stack){
return this.getTranslationKey();
}
@Override
@ -112,7 +112,7 @@ public class BlockInputter extends BlockContainerBase{
this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1;
}
return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ActuallyAdditions.MODID+".block_inputter.add."+this.toPick+".name")+")";
return StringUtil.localize(this.getTranslationKey()+".name")+" ("+StringUtil.localize("tile."+ActuallyAdditions.MODID+".block_inputter.add."+this.toPick+".name")+")";
}
else return super.getItemStackDisplayName(stack);
}

View file

@ -57,6 +57,7 @@ public class BlockItemViewerHopping extends BlockItemViewer{
}
@Override
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool){
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
@ -98,14 +99,13 @@ public class BlockItemViewerHopping extends BlockItemViewer{
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer(){
public BlockRenderLayer getRenderLayer(){
return BlockRenderLayer.CUTOUT_MIPPED;
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -63,7 +63,7 @@ public class BlockLampPowerer extends BlockBase{
if(!world.isRemote){
IBlockState state = world.getBlockState(pos);
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
this.updateLampsAtPos(world, coords, world.isBlockIndirectlyGettingPowered(pos) > 0, new ArrayList<BlockPos>());
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
}
}
@ -104,7 +104,7 @@ public class BlockLampPowerer extends BlockBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override

View file

@ -136,7 +136,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta));
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
}
@Override
@ -265,7 +265,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
expl = relay.getCompassDisplayString();
}
else{
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getUnlocalizedName()+".name"));
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getTranslationKey()+".name"));
}
StringUtil.drawSplitString(minecraft.fontRenderer, expl, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);

View file

@ -91,8 +91,8 @@ public class BlockMisc extends BlockBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_MISC_BLOCKS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_MISC_BLOCKS[stack.getItemDamage()].name;
}
@Override

View file

@ -100,7 +100,7 @@ public class BlockOilGenerator extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -176,8 +176,8 @@ public class BlockSlabs extends BlockBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
public String getTranslationKey(ItemStack stack){
return this.getTranslationKey();
}
}
}

View file

@ -99,7 +99,7 @@ public class BlockSmileyCloud extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -195,8 +195,8 @@ public class BlockTinyTorch extends BlockBase{
if(enumfacing.getAxis().isHorizontal()){
EnumFacing enumfacing1 = enumfacing.getOpposite();
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*(double)enumfacing1.getFrontOffsetX(), d1+0.22D, d2+0.35D*(double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*(double)enumfacing1.getFrontOffsetX(), d1+0.22D, d2+0.35D*(double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*(double)enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*(double)enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*(double)enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*(double)enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
}
else{
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
@ -231,8 +231,7 @@ public class BlockTinyTorch extends BlockBase{
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer(){
public BlockRenderLayer getRenderLayer(){
return BlockRenderLayer.CUTOUT;
}

View file

@ -118,7 +118,7 @@ public class BlockTreasureChest extends BlockBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -34,8 +34,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockWildPlant extends BlockBushBase{
@ -63,7 +61,6 @@ public class BlockWildPlant extends BlockBushBase{
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
for(int j = 0; j < ALL_WILD_PLANTS.length; j++){
list.add(new ItemStack(this, 1, j));
@ -127,8 +124,8 @@ public class BlockWildPlant extends BlockBushBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].name;
}
}
}

View file

@ -74,7 +74,7 @@ public class BlockXPSolidifier extends BlockContainerBase{
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta));
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
}
@Override

View file

@ -172,7 +172,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityBase){
TileEntityBase base = (TileEntityBase)tile;
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0;
boolean wasPowered = base.isRedstonePowered;
if(powered && !wasPowered){
if(base.respondsToPulses()){
@ -262,7 +262,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
}
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
if(!data.hasNoTags()){
if(!data.isEmpty()){
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setTag("Data", data);
}

View file

@ -26,8 +26,8 @@ public class ItemBlockBase extends ItemBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
public String getTranslationKey(ItemStack stack){
return this.getTranslationKey();
}
@Override

View file

@ -63,7 +63,7 @@ public class ItemDisplay{
for(int k = 0; k < list.size(); ++k){
if(k == 0){
list.set(k, this.stack.getRarity().rarityColor+list.get(k));
list.set(k, this.stack.getRarity().color+list.get(k));
}
else{
list.set(k, TextFormatting.GRAY+list.get(k));

View file

@ -20,6 +20,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.fml.common.registry.GameRegistry;
public final class FoodCrafting{
@ -44,7 +45,7 @@ public final class FoodCrafting{
public static void init(){
ItemStack knifeStack = new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD);
Ingredient knife = Ingredient.fromItem(InitItems.itemKnife);
//Rice Bread
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RICE_DOUGH.ordinal()),
@ -52,7 +53,7 @@ public final class FoodCrafting{
//Bacon
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 3, TheFoods.BACON.ordinal()),
knifeStack.copy(), new ItemStack(Items.COOKED_PORKCHOP));
knife, new ItemStack(Items.COOKED_PORKCHOP));
recipeBacon = RecipeUtil.lastIRecipe();
//Baguette
@ -66,7 +67,7 @@ public final class FoodCrafting{
'M', new ItemStack(Blocks.BROWN_MUSHROOM),
'C', "cropCarrot",
'F', new ItemStack(Items.COOKED_FISH, 1, Util.WILDCARD),
'K', knifeStack.copy(),
'K', knife,
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()));
recipePizza = RecipeUtil.lastIRecipe();
@ -75,7 +76,7 @@ public final class FoodCrafting{
"KT ", "CB ", " T ",
'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'K', knifeStack.copy(),
'K', knife,
'B', new ItemStack(Items.COOKED_BEEF));
recipeHamburger = RecipeUtil.lastIRecipe();
@ -93,13 +94,13 @@ public final class FoodCrafting{
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'F', new ItemStack(Items.COOKED_BEEF, 1, Util.WILDCARD),
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()),
'K', knifeStack.copy());
'K', knife);
recipeSubSandwich = RecipeUtil.lastIRecipe();
//French Fry
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()),
new ItemStack(Items.BAKED_POTATO),
knifeStack.copy());
knife);
recipeFrenchFry = RecipeUtil.lastIRecipe();
//French Fries
@ -131,7 +132,7 @@ public final class FoodCrafting{
//Carrot Juice
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()),
new ItemStack(Items.GLASS_BOTTLE), "cropCarrot", knifeStack.copy());
new ItemStack(Items.GLASS_BOTTLE), "cropCarrot", knife);
recipeCarrotJuice = RecipeUtil.lastIRecipe();
//Spaghetti
@ -143,7 +144,7 @@ public final class FoodCrafting{
//Noodle
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
"cropWheat", knifeStack.copy());
"cropWheat", knife);
recipeNoodle = RecipeUtil.lastIRecipe();
//Chocolate

View file

@ -29,7 +29,7 @@ import net.minecraftforge.registries.IForgeRegistryEntry;
public class RecipeBioMash extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe{
public RecipeBioMash(ResourceLocation location){
RecipeHelper.addRecipe(location.getResourcePath(), this);
RecipeHelper.addRecipe(location.getPath(), this);
}
@Override

View file

@ -26,7 +26,7 @@ public class RecipeKeepDataShaped extends ShapedOreRecipe{
super(group, result, recipe);
this.nbtCopyStack = nbtCopyStack;
RecipeHelper.addRecipe(group.getResourcePath(), this);
RecipeHelper.addRecipe(group.getPath(), this);
}
@Override

View file

@ -26,7 +26,7 @@ public class RecipeKeepDataShapeless extends ShapelessOreRecipe{
super(group, result, recipe);
this.nbtCopyStack = nbtCopyStack;
RecipeHelper.addRecipe(group.getResourcePath(), this);
RecipeHelper.addRecipe(group.getPath(), this);
}
@Override

View file

@ -26,7 +26,7 @@ import net.minecraftforge.registries.IForgeRegistryEntry;
public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe{
public RecipePotionRingCharging(ResourceLocation location){
RecipeHelper.addRecipe(location.getResourcePath(), this);
RecipeHelper.addRecipe(location.getPath(), this);
}
@Override

View file

@ -47,7 +47,7 @@ public class CreativeTab extends CreativeTabs{
}
@Override
public ItemStack getTabIconItem(){
public ItemStack createIcon(){
return new ItemStack(InitItems.itemBooklet);
}

View file

@ -116,7 +116,7 @@ public class ClientEvents{
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+Item.REGISTRY.getNameForObject(event.getItemStack().getItem()));
//Base Item's Unlocalized Name
String baseName = event.getItemStack().getItem().getUnlocalizedName();
String baseName = event.getItemStack().getItem().getTranslationKey();
if(baseName != null){
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".baseUnlocName.desc")+":");
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+baseName);
@ -129,7 +129,7 @@ public class ClientEvents{
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+meta+(max > 0 ? "/"+max : ""));
//Unlocalized Name
String metaName = event.getItemStack().getItem().getUnlocalizedName(event.getItemStack());
String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack());
if(metaName != null && baseName != null && !metaName.equals(baseName)){
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".unlocName.desc")+":");
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+metaName);
@ -137,7 +137,7 @@ public class ClientEvents{
//NBT
NBTTagCompound compound = event.getItemStack().getTagCompound();
if(compound != null && !compound.hasNoTags()){
if(compound != null && !compound.isEmpty()){
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".nbt.desc")+":");
if(GuiScreen.isShiftKeyDown()){
int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue();
@ -205,7 +205,7 @@ public class ClientEvents{
expl = TextFormatting.GREEN+StringUtil.localize("info."+ActuallyAdditions.MODID+".redstoneMode.validItem");
}
else{
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getUnlocalizedName()+".name"));
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getTranslationKey()+".name"));
}
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
}

View file

@ -118,14 +118,14 @@ public class OreGen implements IWorldGenerator{
//Generate Treasure Chests
if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
if(event.getRand().nextInt(40) == 0){
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8);
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
if(event.getWorld().getBiome(randomPos) instanceof BiomeOcean){
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
if(event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()){
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(event.getRand().nextInt(4))), 2);
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(event.getRand().nextInt(4))), 2);
}
}
}
@ -140,7 +140,7 @@ public class OreGen implements IWorldGenerator{
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
if(event.getRand().nextInt(3) == 0){
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8);
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
ArrayList<Material> blocksAroundBottom = WorldUtil.getMaterialsAround(event.getWorld(), randomPos);
@ -161,7 +161,7 @@ public class OreGen implements IWorldGenerator{
if(doIt){
for(int i = 0; i < amount; i++){
if(event.getRand().nextInt(100) == 0){
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8);
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
if(event.getWorld().getBlockState(randomPos.down()).getMaterial() == blockBelow){

View file

@ -78,7 +78,7 @@ public class FluidDisplay extends Gui{
this.oldFluid = fluid;
if(fluid != null && fluid.getStill() != null){
this.resLoc = new ResourceLocation(fluid.getStill().getResourceDomain(), "textures/"+fluid.getStill().getResourcePath()+".png");
this.resLoc = new ResourceLocation(fluid.getStill().getNamespace(), "textures/"+fluid.getStill().getPath()+".png");
}
}

View file

@ -44,8 +44,8 @@ public class ItemCrystal extends ItemBase{
}
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
}

View file

@ -37,8 +37,8 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem{
}
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
}

View file

@ -39,8 +39,8 @@ public class ItemDust extends ItemBase implements IColorProvidingItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_DUSTS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_DUSTS[stack.getItemDamage()].name;
}

View file

@ -82,8 +82,8 @@ public class ItemFoods extends ItemFoodBase{
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_FOODS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_FOODS[stack.getItemDamage()].name;
}

View file

@ -48,8 +48,8 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_JAMS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_JAMS[stack.getItemDamage()].name;
}

View file

@ -44,8 +44,8 @@ public class ItemMisc extends ItemBase{
}
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_MISC_ITEMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_MISC_ITEMS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_MISC_ITEMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_MISC_ITEMS[stack.getItemDamage()].name;
}

View file

@ -91,8 +91,8 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
}
@Override
public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_RINGS[stack.getItemDamage()].name;
public String getTranslationKey(ItemStack stack){
return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+ALL_RINGS[stack.getItemDamage()].name;
}
@Override
@ -131,14 +131,14 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
@Override
public String getItemStackDisplayName(ItemStack stack){
if(Util.isClient()) {
String standardName = StringUtil.localize(this.getUnlocalizedName()+".name");
String standardName = StringUtil.localize(this.getTranslationKey()+".name");
if(stack.getItemDamage() < ALL_RINGS.length){
String effect = StringUtil.localize(ALL_RINGS[stack.getItemDamage()].name);
return standardName+" "+effect;
}
return standardName;
}
String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getUnlocalizedName()+".name");
String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getTranslationKey()+".name");
if(stack.getItemDamage() < ALL_RINGS.length){
String effect = StringUtil.localizeIllegallyOnTheServerDontUseMePls(ALL_RINGS[stack.getItemDamage()].name);
return standardName+" "+effect;

View file

@ -90,8 +90,8 @@ public class FilterSettings{
ResourceLocation firstReg = firstItem.getRegistryName();
ResourceLocation secondReg = secondItem.getRegistryName();
if(firstReg != null && secondReg != null){
String firstDomain = firstReg.getResourceDomain();
String secondDomain = secondReg.getResourceDomain();
String firstDomain = firstReg.getNamespace();
String secondDomain = secondReg.getNamespace();
if(firstDomain != null && secondDomain != null){
if(!firstDomain.equals(secondDomain)){
return false;

View file

@ -23,6 +23,7 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
@ -116,7 +117,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
private static void register(Class<? extends TileEntityBase> tileClass){
try{
//This is hacky and dirty but it works so whatever
String name = ActuallyAdditions.MODID+":"+tileClass.newInstance().name;
ResourceLocation name = new ResourceLocation(ActuallyAdditions.MODID, tileClass.newInstance().name);
GameRegistry.registerTileEntity(tileClass, name);
}
catch(Exception e){

View file

@ -82,7 +82,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
IBlockState state = this.world.getBlockState(this.pos);
int meta = state.getBlock().getMetaFromState(state);
BlockPos center = this.pos.offset(EnumFacing.getHorizontal(meta), radiusAroundCenter + 1);
BlockPos center = this.pos.offset(EnumFacing.byHorizontalIndex(meta), radiusAroundCenter + 1);
BlockPos query = center.add(this.checkX, 0, this.checkY);
this.checkBehaviors(query);

View file

@ -94,7 +94,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{
if(input.hasTagCompound()){
//TiCon un-break tools
if("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getResourceDomain())){
if("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getNamespace())){
NBTTagCompound stats = input.getTagCompound().getCompoundTag("Stats");
stats.removeTag("Broken");
}

View file

@ -52,7 +52,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase{
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.world);
NBTTagList list = compound.getTagList("Connections", 10);
if(!list.hasNoTags()){
if(!list.isEmpty()){
for(int i = 0; i < list.tagCount(); i++){
ConnectionPair pair = new ConnectionPair();
pair.readFromNBT(list.getCompoundTagAt(i));

View file

@ -271,7 +271,7 @@ public final class AssetUtil{
double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x*combinedVec.x+combinedVec.z*combinedVec.z));
double yaw = Math.atan2(-combinedVec.z, combinedVec.x);
double length = combinedVec.lengthVector();
double length = combinedVec.length();
GlStateManager.pushMatrix();

View file

@ -36,7 +36,7 @@ public final class ItemUtil{
}
public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab){
block.setUnlocalizedName(ActuallyAdditions.MODID+"."+name);
block.setTranslationKey(ActuallyAdditions.MODID+"."+name);
block.setRegistryName(ActuallyAdditions.MODID, name);
RegistryHandler.BLOCKS_TO_REGISTER.add(block);
@ -54,7 +54,7 @@ public final class ItemUtil{
}
public static void registerItem(Item item, String name, boolean addTab){
item.setUnlocalizedName(ActuallyAdditions.MODID+"."+name);
item.setTranslationKey(ActuallyAdditions.MODID+"."+name);
item.setRegistryName(ActuallyAdditions.MODID, name);
RegistryHandler.ITEMS_TO_REGISTER.add(item);
@ -126,7 +126,7 @@ public final class ItemUtil{
ench.removeTag(i);
}
}
if(ench.hasNoTags() && stack.hasTagCompound()){
if(ench.isEmpty() && stack.hasTagCompound()){
stack.getTagCompound().removeTag("ench");
}
}

View file

@ -264,7 +264,7 @@ public final class WorldUtil {
float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = f3 * f4;
float f7 = f2 * f4;
Vec3d vec31 = vec3.addVector((double) f6 * distance, (double) f5 * distance, (double) f7 * distance);
Vec3d vec31 = vec3.add((double) f6 * distance, (double) f5 * distance, (double) f7 * distance);
return world.rayTraceBlocks(vec3, vec31, p1, p2, p3);
}
@ -310,7 +310,7 @@ public final class WorldUtil {
if (player.capabilities.isCreativeMode) {
if (block.removedByPlayer(state, world, pos, player, false)) {
block.onBlockDestroyedByPlayer(world, pos, state);
block.onPlayerDestroy(world, pos, state);
}
// send update to client
@ -331,7 +331,7 @@ public final class WorldUtil {
TileEntity tileEntity = world.getTileEntity(pos);
if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above
block.onBlockDestroyedByPlayer(world, pos, state);
block.onPlayerDestroy(world, pos, state);
block.harvestBlock(world, player, pos, state, tileEntity, stack);
block.dropXpOnBlockBreak(world, pos, xp);
}
@ -348,7 +348,7 @@ public final class WorldUtil {
// following code can be found in PlayerControllerMP.onPlayerDestroyBlock
world.playEvent(2001, pos, Block.getStateId(state));
if (block.removedByPlayer(state, world, pos, player, true)) {
block.onBlockDestroyedByPlayer(world, pos, state);
block.onPlayerDestroy(world, pos, state);
}
// callback to the tool
stack.onBlockDestroyed(world, state, pos, player);

View file

@ -20,7 +20,7 @@ import java.util.List;
//This class created by Shadows_of_Fire
//MIT License
public final class RecipeHelper{
public final class RecipeHelper {
private static int j = 0;
private static final String MODID = ActuallyAdditions.MODID;
@ -30,20 +30,19 @@ public final class RecipeHelper{
/*
* This adds the recipe to the list of crafting recipes. Since who cares about names, it adds it as recipesX, where X is the current recipe you are adding.
*/
public static void addRecipe(int j, IRecipe rec){
addRecipe("recipes"+j, rec);
public static void addRecipe(int j, IRecipe rec) {
addRecipe("recipes" + j, rec);
}
/*
* This adds the recipe to the list of crafting recipes. Cares about names.
*/
public static void addRecipe(String name, IRecipe rec){
Item i = rec.getRecipeOutput().getItem();
if(i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe();
if(rec.getRegistryName() == null){
public static void addRecipe(String name, IRecipe rec) {
Item i = rec.getRecipeOutput().getItem();
if (i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe();
if (rec.getRegistryName() == null) {
RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name)));
}
else{
} else {
RECIPE_LIST.add(rec);
}
RecipeHandler.lastRecipe = rec;
@ -52,77 +51,72 @@ public final class RecipeHelper{
/*
* This adds a shaped recipe to the list of crafting recipes, using the forge format.
*/
public static void addOldShaped(ItemStack output, Object... input){
public static void addOldShaped(ItemStack output, Object... input) {
ShapedPrimer primer = CraftingHelper.parseShaped(input);
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes"+j).toString(), primer.width,
primer.height, primer.input, output));
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), primer.width, primer.height, primer.input, output));
}
/*
* This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
*/
public static void addOldShaped(String group, ItemStack output, Object... input){
public static void addOldShaped(String group, ItemStack output, Object... input) {
ShapedPrimer primer = CraftingHelper.parseShaped(input);
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height,
primer.input, output));
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output));
}
/*
* This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
*/
public static void addOldShaped(String name, String group, ItemStack output, Object... input){
public static void addOldShaped(String name, String group, ItemStack output, Object... input) {
ShapedPrimer primer = CraftingHelper.parseShaped(input);
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height,
primer.input, output).setRegistryName(MODID, name));
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output).setRegistryName(MODID, name));
}
/*
* This adds a shapeless recipe to the list of crafting recipes, using the forge format.
*/
public static void addOldShapeless(ItemStack output, Object... input){
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes"+j).toString(), output,
createInput(input)));
public static void addOldShapeless(ItemStack output, Object... input) {
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), output, createInput(input)));
}
/*
* This adds a shapeless recipe to the list of crafting recipes, using the forge format, with a custom group.
*/
public static void addOldShapeless(String group, ItemStack output, Object... input){
public static void addOldShapeless(String group, ItemStack output, Object... input) {
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)));
}
public static void addOldShapeless(String name, String group, ItemStack output, Object... input){
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input))
.setRegistryName(MODID, name));
public static void addOldShapeless(String name, String group, ItemStack output, Object... input) {
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)).setRegistryName(MODID, name));
}
/*
* Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered.
*/
public static void addShapeless(ItemStack output, Object... inputs){
addRecipe(j++, new ShapelessRecipes(MODID+":"+j, output, createInput(inputs)));
public static void addShapeless(ItemStack output, Object... inputs) {
addRecipe(j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs)));
}
public static void addShapeless(Item output, Object... inputs){
public static void addShapeless(Item output, Object... inputs) {
addShapeless(new ItemStack(output), inputs);
}
public static void addShapeless(Block output, Object... inputs){
public static void addShapeless(Block output, Object... inputs) {
addShapeless(new ItemStack(output), inputs);
}
/*
* Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. This has a custom group.
*/
public static void addShapeless(String group, ItemStack output, Object... inputs){
addRecipe(j++, new ShapelessRecipes(MODID+":"+group, output, createInput(inputs)));
public static void addShapeless(String group, ItemStack output, Object... inputs) {
addRecipe(j++, new ShapelessRecipes(MODID + ":" + group, output, createInput(inputs)));
}
public static void addShapeless(String group, Item output, Object... inputs){
public static void addShapeless(String group, Item output, Object... inputs) {
addShapeless(group, new ItemStack(output), inputs);
}
public static void addShapeless(String group, Block output, Object... inputs){
public static void addShapeless(String group, Block output, Object... inputs) {
addShapeless(group, new ItemStack(output), inputs);
}
@ -130,15 +124,15 @@ public final class RecipeHelper{
* Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
* This array is ordered, and items must follow from left to right, top to bottom of the crafting grid.
*/
public static void addShaped(ItemStack output, int width, int height, Object... input){
public static void addShaped(ItemStack output, int width, int height, Object... input) {
addRecipe(j++, genShaped(output, width, height, input));
}
public static void addShaped(Item output, int width, int height, Object... input){
public static void addShaped(Item output, int width, int height, Object... input) {
addShaped(new ItemStack(output), width, height, input);
}
public static void addShaped(Block output, int width, int height, Object... input){
public static void addShaped(Block output, int width, int height, Object... input) {
addShaped(new ItemStack(output), width, height, input);
}
@ -146,76 +140,63 @@ public final class RecipeHelper{
* Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
* This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. This has a custom group.
*/
public static void addShaped(String group, ItemStack output, int width, int height, Object... input){
addRecipe(j++, genShaped(MODID+":"+group, output, width, height, input));
public static void addShaped(String group, ItemStack output, int width, int height, Object... input) {
addRecipe(j++, genShaped(MODID + ":" + group, output, width, height, input));
}
public static void addShaped(String group, Item output, int width, int height, Object... input){
public static void addShaped(String group, Item output, int width, int height, Object... input) {
addShaped(group, new ItemStack(output), width, height, input);
}
public static void addShaped(String group, Block output, int width, int height, Object... input){
public static void addShaped(String group, Block output, int width, int height, Object... input) {
addShaped(group, new ItemStack(output), width, height, input);
}
public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input){
if(input[0] instanceof Object[]){
input = (Object[])input[0];
}
if(l*w != input.length){
throw new UnsupportedOperationException(
"Attempted to add invalid shaped recipe. Complain to the author of "+MODNAME);
public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input) {
if (input[0] instanceof Object[]) {
input = (Object[]) input[0];
}
if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
NonNullList<Ingredient> inputL = NonNullList.create();
for(int i = 0; i < input.length; i++){
for (int i = 0; i < input.length; i++) {
Object k = input[i];
if(k instanceof String){
inputL.add(i, new OreIngredient((String)k));
}
else if(k instanceof ItemStack && !((ItemStack)k).isEmpty()){
inputL.add(i, Ingredient.fromStacks((ItemStack)k));
}
else if(k instanceof Item){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k)));
}
else if(k instanceof Block){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k)));
}
else{
if (k instanceof String) {
inputL.add(i, new OreIngredient((String) k));
} else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
} else if (k instanceof Item) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
} else if (k instanceof Block) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
} else {
inputL.add(i, Ingredient.EMPTY);
}
}
return new ShapedRecipes(MODID+":"+j, l, w, inputL, output);
return new ShapedRecipes(MODID + ":" + j, l, w, inputL, output);
}
public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input){
if(input[0] instanceof List){
input = ((List<?>)input[0]).toArray();
}
else if(input[0] instanceof Object[]){
input = (Object[])input[0];
}
if(l*w != input.length){
throw new UnsupportedOperationException(
"Attempted to add invalid shaped recipe. Complain to the author of "+MODNAME);
public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input) {
if (input[0] instanceof List) {
input = ((List<?>) input[0]).toArray();
} else if (input[0] instanceof Object[]) {
input = (Object[]) input[0];
}
if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
NonNullList<Ingredient> inputL = NonNullList.create();
for(int i = 0; i < input.length; i++){
for (int i = 0; i < input.length; i++) {
Object k = input[i];
if(k instanceof String){
inputL.add(i, new OreIngredient((String)k));
}
else if(k instanceof ItemStack && !((ItemStack)k).isEmpty()){
inputL.add(i, Ingredient.fromStacks((ItemStack)k));
}
else if(k instanceof Item){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k)));
}
else if(k instanceof Block){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k)));
}
else{
if (k instanceof String) {
inputL.add(i, new OreIngredient((String) k));
} else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
} else if (k instanceof Item) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
} else if (k instanceof Block) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
} else if (k instanceof Ingredient) {
inputL.add(i, (Ingredient) k);
} else {
inputL.add(i, Ingredient.EMPTY);
}
}
@ -223,31 +204,27 @@ public final class RecipeHelper{
return new ShapedRecipes(group, l, w, inputL, output);
}
public static NonNullList<Ingredient> createInput(Object[] input){
if(input[0] instanceof List){
input = ((List<?>)input[0]).toArray();
}
else if(input[0] instanceof Object[]){
input = (Object[])input[0];
public static NonNullList<Ingredient> createInput(Object[] input) {
if (input[0] instanceof List) {
input = ((List<?>) input[0]).toArray();
} else if (input[0] instanceof Object[]) {
input = (Object[]) input[0];
}
NonNullList<Ingredient> inputL = NonNullList.create();
for(int i = 0; i < input.length; i++){
for (int i = 0; i < input.length; i++) {
Object k = input[i];
if(k instanceof String){
inputL.add(i, new OreIngredient((String)k));
}
else if(k instanceof ItemStack){
inputL.add(i, Ingredient.fromStacks((ItemStack)k));
}
else if(k instanceof Item){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k)));
}
else if(k instanceof Block){
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k)));
}
else{
throw new UnsupportedOperationException(
"Attempted to add invalid shapeless recipe. Complain to the author of "+MODNAME);
if (k instanceof String) {
inputL.add(i, new OreIngredient((String) k));
} else if (k instanceof ItemStack) {
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
} else if (k instanceof Item) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
} else if (k instanceof Block) {
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
} else if (k instanceof Ingredient) {
inputL.add(i, (Ingredient) k);
} else {
throw new UnsupportedOperationException("Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME);
}
}
return inputL;