Some additional fixes from other branch.
This commit is contained in:
@@ -175,7 +175,7 @@ public class AEItemResolver implements ISubItemResolver
|
||||
}
|
||||
|
||||
final ItemStack is = partType.stack( col, 1 );
|
||||
return new ResolverResult( "paint_ball", ( lumen ? 20 : 0 ) + is.getItemDamage() );
|
||||
return new ResolverResult( "paint_ball", ( lumen ? 20 : 0 ) + is.getDamage() );
|
||||
}
|
||||
|
||||
private Object cableItem( final AEColoredItemDefinition partType, final String substring )
|
||||
@@ -192,6 +192,6 @@ public class AEItemResolver implements ISubItemResolver
|
||||
}
|
||||
|
||||
final ItemStack is = partType.stack( col, 1 );
|
||||
return new ResolverResult( "part", is.getItemDamage() );
|
||||
return new ResolverResult( "part", is.getDamage() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
@@ -74,8 +74,8 @@ public class AERecipeLoader
|
||||
try
|
||||
{
|
||||
reader = Files.newBufferedReader( file );
|
||||
JsonObject json = JsonUtils.fromJson( GSON, reader, JsonObject.class );
|
||||
if( json.has( "conditions" ) && !CraftingHelper.processConditions( JsonUtils.getJsonArray( json, "conditions" ), this.ctx ) )
|
||||
JsonObject json = JSONUtils.fromJson( GSON, reader, JsonObject.class );
|
||||
if( json.has( "conditions" ) && !CraftingHelper.processConditions( JSONUtils.getJsonArray( json, "conditions" ), this.ctx ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class AERecipeLoader
|
||||
throw new JsonSyntaxException( "Json cannot be null" );
|
||||
}
|
||||
|
||||
String type = this.ctx.appendModId( JsonUtils.getString( json, "type" ) );
|
||||
String type = this.ctx.appendModId( JSONUtils.getString( json, "type" ) );
|
||||
if( type.isEmpty() )
|
||||
{
|
||||
throw new JsonSyntaxException( "Recipe type can not be an empty string" );
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.stream.Stream;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.IConditionFactory;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
|
||||
@@ -43,16 +43,16 @@ public class Features implements IConditionFactory
|
||||
{
|
||||
final boolean result;
|
||||
|
||||
if( JsonUtils.isJsonArray( jsonObject, JSON_FEATURES_KEY ) )
|
||||
if( JSONUtils.isJsonArray( jsonObject, JSON_FEATURES_KEY ) )
|
||||
{
|
||||
final JsonArray features = JsonUtils.getJsonArray( jsonObject, JSON_FEATURES_KEY );
|
||||
final JsonArray features = JSONUtils.getJsonArray( jsonObject, JSON_FEATURES_KEY );
|
||||
|
||||
result = Stream.of( features )
|
||||
.allMatch( p -> AEConfig.instance().isFeatureEnabled( AEFeature.valueOf( p.getAsString().toUpperCase( Locale.ENGLISH ) ) ) );
|
||||
}
|
||||
else if( JsonUtils.isString( jsonObject, JSON_FEATURES_KEY ) )
|
||||
else if( JSONUtils.isString( jsonObject, JSON_FEATURES_KEY ) )
|
||||
{
|
||||
final String featureName = JsonUtils.getString( jsonObject, JSON_FEATURES_KEY ).toUpperCase( Locale.ENGLISH );
|
||||
final String featureName = JSONUtils.getString( jsonObject, JSON_FEATURES_KEY ).toUpperCase( Locale.ENGLISH );
|
||||
final AEFeature feature = AEFeature.valueOf( featureName );
|
||||
|
||||
result = AEConfig.instance().isFeatureEnabled( feature );
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.function.BooleanSupplier;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.IConditionFactory;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
|
||||
@@ -40,9 +40,9 @@ public class MaterialExists implements IConditionFactory
|
||||
{
|
||||
final boolean result;
|
||||
|
||||
if( JsonUtils.isString( jsonObject, JSON_MATERIAL_KEY ) )
|
||||
if( JSONUtils.isString( jsonObject, JSON_MATERIAL_KEY ) )
|
||||
{
|
||||
final String material = JsonUtils.getString( jsonObject, JSON_MATERIAL_KEY );
|
||||
final String material = JSONUtils.getString( jsonObject, JSON_MATERIAL_KEY );
|
||||
final Object item = Api.INSTANCE.registries().recipes().resolveItem( AppEng.MOD_ID, material );
|
||||
|
||||
result = item != null;
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
@@ -57,7 +57,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
@Override
|
||||
public IRecipe parse( JsonContext context, JsonObject json )
|
||||
{
|
||||
String type = JsonUtils.getString( json, "type" );
|
||||
String type = JSONUtils.getString( json, "type" );
|
||||
if( type.contains( "shaped" ) )
|
||||
{
|
||||
return shapedFactory( context, json );
|
||||
@@ -79,7 +79,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
|
||||
public static ItemStack getResult( JsonObject json, JsonContext context, String name )
|
||||
{
|
||||
JsonObject resultObject = JsonUtils.getJsonObject( json, name );
|
||||
JsonObject resultObject = JSONUtils.getJsonObject( json, name );
|
||||
|
||||
if( resultObject.has( "part" ) )
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
|
||||
private static ItemStack getPart( JsonObject resultObject )
|
||||
{
|
||||
String ingredient = JsonUtils.getString( resultObject, "part" );
|
||||
String ingredient = JSONUtils.getString( resultObject, "part" );
|
||||
Object result = AEApi.instance().registries().recipes().resolveItem( AppEng.MOD_ID, ingredient );
|
||||
if( result instanceof ResolverResult )
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
throw new JsonSyntaxException( "Got a null item for " + resolverResult.itemName + " ( " + ingredient + " ). This should never happen!" );
|
||||
}
|
||||
|
||||
return new ItemStack( item, JsonUtils.getInt( resultObject, "count", 1 ), resolverResult.damageValue, resolverResult.compound );
|
||||
return new ItemStack( item, JSONUtils.getInt( resultObject, "count", 1 ), resolverResult.damageValue, resolverResult.compound );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -122,10 +122,10 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
// Copied from ShapedOreRecipe.java, modified a bit.
|
||||
private static ShapedOreRecipe shapedFactory( JsonContext context, JsonObject json )
|
||||
{
|
||||
String group = JsonUtils.getString( json, "group", "" );
|
||||
String group = JSONUtils.getString( json, "group", "" );
|
||||
|
||||
Map<Character, Ingredient> ingMap = Maps.newHashMap();
|
||||
for( Map.Entry<String, JsonElement> entry : JsonUtils.getJsonObject( json, "key" ).entrySet() )
|
||||
for( Map.Entry<String, JsonElement> entry : JSONUtils.getJsonObject( json, "key" ).entrySet() )
|
||||
{
|
||||
if( entry.getKey().length() != 1 )
|
||||
{
|
||||
@@ -141,7 +141,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
|
||||
ingMap.put( ' ', net.minecraft.item.crafting.Ingredient.EMPTY );
|
||||
|
||||
JsonArray patternJ = JsonUtils.getJsonArray( json, "pattern" );
|
||||
JsonArray patternJ = JSONUtils.getJsonArray( json, "pattern" );
|
||||
|
||||
if( patternJ.size() == 0 )
|
||||
{
|
||||
@@ -151,7 +151,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
String[] pattern = new String[patternJ.size()];
|
||||
for( int x = 0; x < pattern.length; ++x )
|
||||
{
|
||||
String line = JsonUtils.getString( patternJ.get( x ), "pattern[" + x + "]" );
|
||||
String line = JSONUtils.getString( patternJ.get( x ), "pattern[" + x + "]" );
|
||||
if( x > 0 && pattern[0].length() != line.length() )
|
||||
{
|
||||
throw new JsonSyntaxException( "Invalid pattern: each row must be the same width" );
|
||||
@@ -162,7 +162,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
CraftingHelper.ShapedPrimer primer = new CraftingHelper.ShapedPrimer();
|
||||
primer.width = pattern[0].length();
|
||||
primer.height = pattern.length;
|
||||
primer.mirrored = JsonUtils.getBoolean( json, "mirrored", true );
|
||||
primer.mirrored = JSONUtils.getBoolean( json, "mirrored", true );
|
||||
primer.input = NonNullList.withSize( primer.width * primer.height, net.minecraft.item.crafting.Ingredient.EMPTY );
|
||||
|
||||
Set<Character> keys = Sets.newHashSet( ingMap.keySet() );
|
||||
@@ -194,10 +194,10 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
// Copied from ShapelessOreRecipe.java, modified a bit.
|
||||
private static ShapelessOreRecipe shapelessFactory( JsonContext context, JsonObject json )
|
||||
{
|
||||
String group = JsonUtils.getString( json, "group", "" );
|
||||
String group = JSONUtils.getString( json, "group", "" );
|
||||
|
||||
NonNullList<Ingredient> ings = NonNullList.create();
|
||||
for( JsonElement ele : JsonUtils.getJsonArray( json, "ingredients" ) )
|
||||
for( JsonElement ele : JSONUtils.getJsonArray( json, "ingredients" ) )
|
||||
{
|
||||
ings.add( CraftingHelper.getIngredient( ele, context ) );
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -76,7 +76,7 @@ public final class DisassembleRecipe extends net.minecraftforge.registries.IForg
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
public boolean matches(final CraftingInventory inv, final World w )
|
||||
{
|
||||
return !this.getOutput( inv ).isEmpty();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public final class DisassembleRecipe extends net.minecraftforge.registries.IForg
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getCraftingResult( final InventoryCrafting inv )
|
||||
public ItemStack getCraftingResult( final CraftingInventory inv )
|
||||
{
|
||||
return this.getOutput( inv );
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public final class DisassembleRecipe extends net.minecraftforge.registries.IForg
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getRemainingItems( final InventoryCrafting inv )
|
||||
public NonNullList<ItemStack> getRemainingItems( final CraftingInventory inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.recipes.game;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -49,7 +49,7 @@ public final class FacadeRecipe extends net.minecraftforge.registries.IForgeRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
public boolean matches(final CraftingInventory inv, final World w )
|
||||
{
|
||||
return !this.getOutput( inv, false ).isEmpty();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public final class FacadeRecipe extends net.minecraftforge.registries.IForgeRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult( final InventoryCrafting inv )
|
||||
public ItemStack getCraftingResult( final CraftingInventory inv )
|
||||
{
|
||||
return this.getOutput( inv, true );
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public final class FacadeRecipe extends net.minecraftforge.registries.IForgeRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getRemainingItems( final InventoryCrafting inv )
|
||||
public NonNullList<ItemStack> getRemainingItems( final CraftingInventory inv )
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems( inv );
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package appeng.recipes.handlers;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
|
||||
@@ -24,14 +24,14 @@ public class GrinderHandler implements IAERecipeFactory
|
||||
{
|
||||
// TODO only primary for now
|
||||
|
||||
JsonObject result = JsonUtils.getJsonObject( json, "result" );
|
||||
JsonObject result = JSONUtils.getJsonObject( json, "result" );
|
||||
ItemStack primary = PartRecipeFactory.getResult( result, ctx, "primary" );
|
||||
ItemStack[] input = CraftingHelper.getIngredient( json.get( "input" ), ctx ).getMatchingStacks();
|
||||
|
||||
int turns = 5;
|
||||
if( json.has( "turns" ) )
|
||||
{
|
||||
turns = JsonUtils.getInt( json, "turns" );
|
||||
turns = JSONUtils.getInt( json, "turns" );
|
||||
}
|
||||
|
||||
final IGrinderRegistry reg = AEApi.instance().registries().grinder();
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
|
||||
@@ -27,21 +27,21 @@ public class InscriberHandler implements IAERecipeFactory
|
||||
public void register( JsonObject json, JsonContext ctx )
|
||||
{
|
||||
ItemStack result = PartRecipeFactory.getResult( json, ctx );
|
||||
String mode = JsonUtils.getString( json, "mode" );
|
||||
String mode = JSONUtils.getString( json, "mode" );
|
||||
|
||||
JsonObject ingredients = JsonUtils.getJsonObject( json, "ingredients" );
|
||||
JsonObject ingredients = JSONUtils.getJsonObject( json, "ingredients" );
|
||||
|
||||
List<ItemStack> middle = Arrays.asList( CraftingHelper.getIngredient( ingredients.get( "middle" ), ctx ).getMatchingStacks() );
|
||||
ItemStack[] top = new ItemStack[] { null };
|
||||
if( ingredients.has( "top" ) )
|
||||
{
|
||||
top = CraftingHelper.getIngredient( JsonUtils.getJsonObject( ingredients, "top" ), ctx ).getMatchingStacks();
|
||||
top = CraftingHelper.getIngredient( JSONUtils.getJsonObject( ingredients, "top" ), ctx ).getMatchingStacks();
|
||||
}
|
||||
|
||||
ItemStack[] bottom = new ItemStack[] { null };
|
||||
if( ingredients.has( "bottom" ) )
|
||||
{
|
||||
bottom = CraftingHelper.getIngredient( JsonUtils.getJsonObject( ingredients, "bottom" ), ctx ).getMatchingStacks();
|
||||
bottom = CraftingHelper.getIngredient( JSONUtils.getJsonObject( ingredients, "bottom" ), ctx ).getMatchingStacks();
|
||||
}
|
||||
|
||||
final IInscriberRegistry reg = AEApi.instance().registries().inscriber();
|
||||
|
||||
@@ -5,7 +5,7 @@ package appeng.recipes.handlers;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.JsonContext;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
@@ -24,7 +24,7 @@ public class SmeltingHandler implements IAERecipeFactory
|
||||
float xp = 0.0f;
|
||||
if( json.has( "xp" ) )
|
||||
{
|
||||
xp = JsonUtils.getFloat( json, "xp" );
|
||||
xp = JSONUtils.getFloat( json, "xp" );
|
||||
}
|
||||
|
||||
for( int i = 0; i < input.length; ++i )
|
||||
|
||||
Reference in New Issue
Block a user