Highly incomplete code. First work on porting to 1.12. Still need to rework a LOT of things.
This commit is contained in:
@@ -31,6 +31,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
@@ -162,9 +163,8 @@ public final class DisassembleRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 1;
|
||||
public boolean canFit(int i, int i1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -179,4 +179,42 @@ public final class DisassembleRecipe implements IRecipe
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
|
||||
* This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
|
||||
* Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
|
||||
* <p>
|
||||
* The supplied name will be prefixed with the currently active mod's modId.
|
||||
* If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
|
||||
* <p>
|
||||
* If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
|
||||
* <p>
|
||||
* Returns 'this' to allow for chaining.
|
||||
*
|
||||
* @param name Unique registry name
|
||||
* @return This instance
|
||||
*/
|
||||
@Override
|
||||
public IRecipe setRegistryName(ResourceLocation name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for this entry, if this entry is registered already it will return it's official registry name.
|
||||
* Otherwise it will return the name set in setRegistryName().
|
||||
* If neither are valid null is returned.
|
||||
*
|
||||
* @return Unique identifier or null.
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IRecipe> getRegistryType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
@@ -80,9 +81,8 @@ public final class FacadeRecipe implements IRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 9;
|
||||
public boolean canFit(int i, int i1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,4 +97,41 @@ public final class FacadeRecipe implements IRecipe
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
|
||||
* This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
|
||||
* Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
|
||||
* <p>
|
||||
* The supplied name will be prefixed with the currently active mod's modId.
|
||||
* If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
|
||||
* <p>
|
||||
* If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
|
||||
* <p>
|
||||
* Returns 'this' to allow for chaining.
|
||||
*
|
||||
* @param name Unique registry name
|
||||
* @return This instance
|
||||
*/
|
||||
@Override
|
||||
public IRecipe setRegistryName(ResourceLocation name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for this entry, if this entry is registered already it will return it's official registry name.
|
||||
* Otherwise it will return the name set in setRegistryName().
|
||||
* If neither are valid null is returned.
|
||||
*
|
||||
* @return Unique identifier or null.
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IRecipe> getRegistryType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -35,6 +36,7 @@ import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
@@ -176,9 +178,8 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.input.length;
|
||||
public boolean canFit(int i, int i1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -302,7 +303,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public Object[] getIngredients()
|
||||
public Object[] getIIngredients()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
@@ -333,4 +334,41 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
|
||||
* This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
|
||||
* Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
|
||||
* <p>
|
||||
* The supplied name will be prefixed with the currently active mod's modId.
|
||||
* If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
|
||||
* <p>
|
||||
* If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
|
||||
* <p>
|
||||
* Returns 'this' to allow for chaining.
|
||||
*
|
||||
* @param name Unique registry name
|
||||
* @return This instance
|
||||
*/
|
||||
@Override
|
||||
public IRecipe setRegistryName(ResourceLocation name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for this entry, if this entry is registered already it will return it's official registry name.
|
||||
* Otherwise it will return the name set in setRegistryName().
|
||||
* If neither are valid null is returned.
|
||||
*
|
||||
* @return Unique identifier or null.
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IRecipe> getRegistryType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -33,6 +34,8 @@ import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
@@ -135,9 +138,8 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.input.size();
|
||||
public boolean canFit(int i, int i1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,4 +190,41 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
|
||||
* This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
|
||||
* Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
|
||||
* <p>
|
||||
* The supplied name will be prefixed with the currently active mod's modId.
|
||||
* If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
|
||||
* <p>
|
||||
* If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
|
||||
* <p>
|
||||
* Returns 'this' to allow for chaining.
|
||||
*
|
||||
* @param name Unique registry name
|
||||
* @return This instance
|
||||
*/
|
||||
@Override
|
||||
public IRecipe setRegistryName(ResourceLocation name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for this entry, if this entry is registered already it will return it's official registry name.
|
||||
* Otherwise it will return the name set in setRegistryName().
|
||||
* If neither are valid null is returned.
|
||||
*
|
||||
* @return Unique identifier or null.
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IRecipe> getRegistryType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,9 @@ package appeng.recipes.handlers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.core.Registration;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
@@ -113,7 +115,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
|
||||
|
||||
try
|
||||
{
|
||||
GameRegistry.addRecipe( new ShapedRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
|
||||
Registration.addRecipeToRegister( new ShapedRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@ package appeng.recipes.handlers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.core.Registration;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
@@ -76,7 +78,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
|
||||
|
||||
try
|
||||
{
|
||||
GameRegistry.addRecipe( new ShapelessRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
|
||||
Registration.addRecipeToRegister( new ShapelessRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.core.AELog;
|
||||
@@ -78,7 +79,7 @@ public class OreDictionaryHandler
|
||||
{
|
||||
this.enableRebaking = true;
|
||||
|
||||
for( final Object o : CraftingManager.getInstance().getRecipeList() )
|
||||
for( final Object o : ForgeRegistries.RECIPES.getValues() )
|
||||
{
|
||||
if( o instanceof IRecipeBakeable )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user