mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
More major updating
Migrates the rest of the recipe system to Ingredient inputs, Migrates the compost to an IBakedModel instead of a TESR
This commit is contained in:
parent
5bbca0ee30
commit
5c149648da
40 changed files with 980 additions and 467 deletions
|
@ -34,6 +34,7 @@ import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
@ -200,9 +201,22 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param output The itemstack to be output from the compost once conversion finishes
|
* @param output The itemstack to be output from the compost once conversion finishes
|
||||||
* @param outputDisplay The block to display when there is output in the compost
|
* @param outputDisplay The block to display when there is output in the compost
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
|
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new conversion recipe to the compost.
|
||||||
|
*
|
||||||
|
* @param input The ingredient to be input into the compost
|
||||||
|
* @param inputDisplay The state to display when there is input in the compost
|
||||||
|
* @param output The itemstack to be output from the compost once conversion finishes
|
||||||
|
* @param outputDisplay The state to display when there is output in the compost
|
||||||
|
*/
|
||||||
|
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay){
|
||||||
|
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur
|
* Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur
|
||||||
|
@ -226,9 +240,14 @@ public final class ActuallyAdditionsAPI{
|
||||||
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor){
|
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor){
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor){
|
||||||
|
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||||
|
@ -240,13 +259,33 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
|
||||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||||
|
* StackSizes can only be 1 and greater ones will be ignored
|
||||||
|
*
|
||||||
|
* @param input The input as an ItemStack
|
||||||
|
* @param output The output as an ItemStack
|
||||||
|
* @param energyUse The amount of RF used per conversion
|
||||||
|
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||||
|
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||||
|
*/
|
||||||
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type){
|
||||||
|
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse){
|
||||||
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an item and the way it is modified to the Atomic Reconstructor's color lens.
|
* Adds an item and the way it is modified to the Atomic Reconstructor's color lens.
|
||||||
|
|
|
@ -12,29 +12,47 @@ package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
|
||||||
public class CoffeeIngredient{
|
public class CoffeeIngredient {
|
||||||
|
|
||||||
public final ItemStack ingredient;
|
protected final Ingredient input;
|
||||||
public final int maxAmplifier;
|
protected final int maxAmplifier;
|
||||||
protected PotionEffect[] effects;
|
protected PotionEffect[] effects;
|
||||||
|
|
||||||
public CoffeeIngredient(ItemStack ingredient, PotionEffect[] effects, int maxAmplifier){
|
@Deprecated
|
||||||
this.ingredient = ingredient.copy();
|
public CoffeeIngredient(ItemStack input, PotionEffect[] effects, int maxAmplifier) {
|
||||||
|
this(Ingredient.fromStacks(input), maxAmplifier, effects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoffeeIngredient(Ingredient input, int maxAmplifier, PotionEffect... effects) {
|
||||||
|
this.input = input;
|
||||||
this.effects = effects;
|
this.effects = effects;
|
||||||
this.maxAmplifier = maxAmplifier;
|
this.maxAmplifier = maxAmplifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean matches(ItemStack stack) {
|
||||||
|
return input.apply(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getInput() {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
public PotionEffect[] getEffects(){
|
public PotionEffect[] getEffects() {
|
||||||
return this.effects;
|
return this.effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean effect(ItemStack stack){
|
public boolean effect(ItemStack stack) {
|
||||||
return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtraText(){
|
public String getExtraText() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxAmplifier() {
|
||||||
|
return maxAmplifier;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,20 +11,47 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public class CompostRecipe{
|
public class CompostRecipe{
|
||||||
|
|
||||||
public final ItemStack input;
|
protected final Ingredient input;
|
||||||
public final ItemStack output;
|
protected final ItemStack output;
|
||||||
public final Block inputDisplay;
|
protected final IBlockState inputDisplay;
|
||||||
public final Block outputDisplay;
|
protected final IBlockState outputDisplay;
|
||||||
|
|
||||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
|
@Deprecated
|
||||||
|
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||||
|
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay){
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.inputDisplay = inputDisplay;
|
this.inputDisplay = inputDisplay;
|
||||||
this.outputDisplay = outputDisplay;
|
this.outputDisplay = outputDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean matches(ItemStack stack) {
|
||||||
|
return input.apply(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getInput() {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getOutput() {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBlockState getInputDisplay() {
|
||||||
|
return inputDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBlockState getOutputDisplay() {
|
||||||
|
return outputDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,25 +15,21 @@ import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public class CrusherRecipe {
|
public class CrusherRecipe {
|
||||||
|
|
||||||
@Deprecated //ModTweaker compat, will be removed soon.
|
protected Ingredient input;
|
||||||
public ItemStack outputOneStack;
|
protected ItemStack outputOne;
|
||||||
|
protected ItemStack outputTwo;
|
||||||
private Ingredient input;
|
protected int outputChance;
|
||||||
private ItemStack outputOne;
|
|
||||||
private ItemStack outputTwo;
|
|
||||||
private int outputChance;
|
|
||||||
|
|
||||||
@Deprecated //ModTweaker compat, will be removed soon.
|
@Deprecated
|
||||||
public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
||||||
this(Ingredient.fromStacks(input), outputOne, outputTwo, outputChance);
|
this(Ingredient.fromStacks(input), outputOne, outputTwo, outputChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.outputOne = outputOne;
|
this.outputOne = outputOne;
|
||||||
this.outputTwo = outputTwo;
|
this.outputTwo = outputTwo;
|
||||||
this.outputChance = outputChance;
|
this.outputChance = outputChance;
|
||||||
outputOneStack = outputOne;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
public boolean matches(ItemStack stack) {
|
||||||
|
|
|
@ -11,22 +11,28 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public class EmpowererRecipe{
|
public class EmpowererRecipe {
|
||||||
|
|
||||||
public ItemStack input;
|
protected final Ingredient input;
|
||||||
public ItemStack output;
|
protected final ItemStack output;
|
||||||
|
|
||||||
public ItemStack modifier1;
|
protected final Ingredient modifier1;
|
||||||
public ItemStack modifier2;
|
protected final Ingredient modifier2;
|
||||||
public ItemStack modifier3;
|
protected final Ingredient modifier3;
|
||||||
public ItemStack modifier4;
|
protected final Ingredient modifier4;
|
||||||
|
|
||||||
public int energyPerStand;
|
protected final int energyPerStand;
|
||||||
public float[] particleColor;
|
protected final float[] particleColor;
|
||||||
public int time;
|
protected final int time;
|
||||||
|
|
||||||
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor){
|
@Deprecated
|
||||||
|
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||||
|
this(Ingredient.fromStacks(input), output, Ingredient.fromStacks(modifier1), Ingredient.fromStacks(modifier2), Ingredient.fromStacks(modifier3), Ingredient.fromStacks(modifier4), energyPerStand, time, particleColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.modifier1 = modifier1;
|
this.modifier1 = modifier1;
|
||||||
|
@ -37,4 +43,44 @@ public class EmpowererRecipe{
|
||||||
this.particleColor = particleColor;
|
this.particleColor = particleColor;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||||
|
return input.apply(base) && modifier1.apply(stand1) && modifier2.apply(stand2) && modifier3.apply(stand3) && modifier4.apply(stand4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getInput() {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getOutput() {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getStandOne() {
|
||||||
|
return modifier1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getStandTwo() {
|
||||||
|
return modifier2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getStandThree() {
|
||||||
|
return modifier3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getStandFour() {
|
||||||
|
return modifier4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnergyPerStand() {
|
||||||
|
return energyPerStand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] getParticleColors() {
|
||||||
|
return particleColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,24 +11,51 @@
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class LensConversionRecipe{
|
public class LensConversionRecipe {
|
||||||
|
|
||||||
public final int energyUse;
|
protected final Ingredient input;
|
||||||
public final LensConversion type;
|
protected final ItemStack output;
|
||||||
public ItemStack inputStack;
|
protected final int energy;
|
||||||
public ItemStack outputStack;
|
protected final Lens type;
|
||||||
|
|
||||||
public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
|
@Deprecated
|
||||||
this.inputStack = input;
|
public LensConversionRecipe(ItemStack input, ItemStack output, int energy, Lens type) {
|
||||||
this.outputStack = output;
|
this(Ingredient.fromStacks(input), output, energy, type);
|
||||||
this.energyUse = energyUse;
|
}
|
||||||
|
|
||||||
|
public LensConversionRecipe(Ingredient input, ItemStack output, int energy, Lens type) {
|
||||||
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
|
this.energy = energy;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) {}
|
public boolean matches(ItemStack input, Lens lens) {
|
||||||
|
return this.input.apply(input) && this.type == lens;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ingredient getInput() {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getOutput() {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnergyUsed() {
|
||||||
|
return energy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lens getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.render.ActualCompostModel;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
||||||
|
@ -7,6 +9,8 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
@ -48,4 +52,11 @@ public class ClientRegistryHandler{
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onModelBake(ModelBakeEvent e) {
|
||||||
|
ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal");
|
||||||
|
CompostModel.compostBase = e.getModelRegistry().getObject(mrl);
|
||||||
|
e.getModelRegistry().putObject(mrl, new ActualCompostModel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||||
|
@ -19,6 +23,8 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
@ -27,6 +33,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -35,21 +42,22 @@ import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
|
||||||
|
|
||||||
protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
|
protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
|
||||||
protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
||||||
protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
||||||
protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||||
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 11*0.0625, 1-0.0625);
|
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 11 * 0.0625, 1 - 0.0625);
|
||||||
|
|
||||||
public BlockCompost(String name){
|
public BlockCompost(String name) {
|
||||||
super(Material.WOOD, name);
|
super(Material.WOOD, name);
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel("axe", 0);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
@ -58,12 +66,12 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool){
|
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_LEGS);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
||||||
|
@ -72,41 +80,40 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||||
ItemStack stackPlayer = player.getHeldItem(hand);
|
ItemStack stackPlayer = player.getHeldItem(hand);
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityCompost){
|
if (tile instanceof TileEntityCompost) {
|
||||||
TileEntityCompost compost = (TileEntityCompost)tile;
|
TileEntityCompost compost = (TileEntityCompost) tile;
|
||||||
ItemStack slot = compost.inv.getStackInSlot(0);
|
ItemStack slot = compost.inv.getStackInSlot(0);
|
||||||
CompostRecipe recipeIn = TileEntityCompost.getRecipeForInput(slot);
|
CompostRecipe recipeIn = TileEntityCompost.getRecipeForInput(slot);
|
||||||
if(!StackUtil.isValid(slot) || recipeIn != null){
|
if (!StackUtil.isValid(slot) || recipeIn != null) {
|
||||||
if(StackUtil.isValid(stackPlayer)){
|
if (StackUtil.isValid(stackPlayer)) {
|
||||||
CompostRecipe recipeHand = TileEntityCompost.getRecipeForInput(stackPlayer);
|
CompostRecipe recipeHand = TileEntityCompost.getRecipeForInput(stackPlayer);
|
||||||
if(recipeHand != null && (recipeIn == null || recipeIn == recipeHand)){
|
if (recipeHand != null && (recipeIn == null || recipeIn == recipeHand)) {
|
||||||
int maxAdd = stackPlayer.getCount();
|
int maxAdd = stackPlayer.getCount();
|
||||||
|
|
||||||
if(!StackUtil.isValid(slot)){
|
if (!StackUtil.isValid(slot)) {
|
||||||
ItemStack stackToAdd = stackPlayer.copy();
|
ItemStack stackToAdd = stackPlayer.copy();
|
||||||
stackToAdd.setCount(maxAdd);
|
stackToAdd.setCount(maxAdd);
|
||||||
compost.inv.setStackInSlot(0, stackToAdd);
|
compost.inv.setStackInSlot(0, stackToAdd);
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, maxAdd);
|
player.inventory.decrStackSize(player.inventory.currentItem, maxAdd);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
ItemStack stackIn = slot.copy();
|
ItemStack stackIn = slot.copy();
|
||||||
if(stackIn.getCount() < recipeHand.input.getMaxStackSize()){
|
if (stackIn.getCount() < slot.getMaxStackSize()) {
|
||||||
int sizeAdded = Math.min(maxAdd, recipeHand.input.getMaxStackSize()-stackIn.getCount());
|
int sizeAdded = Math.min(maxAdd, slot.getMaxStackSize() - stackIn.getCount());
|
||||||
stackIn.grow(sizeAdded);
|
stackIn.grow(sizeAdded);
|
||||||
compost.inv.setStackInSlot(0, stackIn);
|
compost.inv.setStackInSlot(0, stackIn);
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, sizeAdded);
|
player.inventory.decrStackSize(player.inventory.currentItem, sizeAdded);
|
||||||
|
@ -115,15 +122,13 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
if (!StackUtil.isValid(stackPlayer)) {
|
||||||
if(!StackUtil.isValid(stackPlayer)){
|
|
||||||
player.setHeldItem(hand, slot.copy());
|
player.setHeldItem(hand, slot.copy());
|
||||||
compost.inv.setStackInSlot(0, StackUtil.getEmpty());
|
compost.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (ItemUtil.canBeStacked(stackPlayer, slot)) {
|
||||||
else if(ItemUtil.canBeStacked(stackPlayer, slot)){
|
int addedStackSize = Math.min(slot.getCount(), stackPlayer.getMaxStackSize() - stackPlayer.getCount());
|
||||||
int addedStackSize = Math.min(slot.getCount(), stackPlayer.getMaxStackSize()-stackPlayer.getCount());
|
|
||||||
ItemStack stackToAdd = stackPlayer.copy();
|
ItemStack stackToAdd = stackPlayer.copy();
|
||||||
stackToAdd.grow(addedStackSize);
|
stackToAdd.grow(addedStackSize);
|
||||||
player.setHeldItem(hand, stackToAdd);
|
player.setHeldItem(hand, stackToAdd);
|
||||||
|
@ -132,41 +137,86 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tile.markDirty();
|
||||||
|
world.notifyBlockUpdate(pos, getDefaultState(), getDefaultState(), 3);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta){
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCompost();
|
return new TileEntityCompost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile instanceof TileEntityCompost){
|
if (tile instanceof TileEntityCompost) {
|
||||||
ItemStack slot = ((TileEntityCompost)tile).inv.getStackInSlot(0);
|
ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
||||||
String strg;
|
String strg;
|
||||||
if(!StackUtil.isValid(slot)){
|
if (!StackUtil.isValid(slot)) {
|
||||||
strg = "Empty";
|
strg = "Empty";
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
strg = slot.getDisplayName();
|
strg = slot.getDisplayName();
|
||||||
|
|
||||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
|
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth() / 2 + 15, resolution.getScaledHeight() / 2 - 29, 1F);
|
||||||
}
|
}
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState() {
|
||||||
|
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { COMPOST_PROP });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
||||||
|
TileEntityCompost compost = (TileEntityCompost) te;
|
||||||
|
return ((IExtendedBlockState) state).withProperty(COMPOST_PROP, Pair.of(compost.getCurrentDisplay(), compost.getHeight()));
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockRenderLayer getBlockLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CompostProperty COMPOST_PROP = new CompostProperty();
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private static class CompostProperty implements IUnlistedProperty<Pair> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "compost";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(Pair value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Pair> getType() {
|
||||||
|
return Pair.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String valueToString(Pair value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class BlockEmpowerer extends BlockContainerBase{
|
||||||
if(empowerer != null){
|
if(empowerer != null){
|
||||||
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(heldItem)){
|
if(StackUtil.isValid(heldItem)){
|
||||||
if(!StackUtil.isValid(stackThere) && !TileEntityEmpowerer.getRecipesForInput(heldItem).isEmpty()){
|
if(!StackUtil.isValid(stackThere) && TileEntityEmpowerer.isPossibleInput(heldItem)){
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.grow(1);
|
toPut.grow(1);
|
||||||
empowerer.inv.setStackInSlot(0, toPut);
|
empowerer.inv.setStackInSlot(0, toPut);
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
|
public class ActualCompostModel implements IBakedModel {
|
||||||
|
|
||||||
|
public static final Map<Pair<IBlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||||
|
if (state instanceof IExtendedBlockState) {
|
||||||
|
Pair<IBlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
||||||
|
if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
|
IBakedModel model = MODELS.get(data);
|
||||||
|
if (model == null) {
|
||||||
|
model = new CompostModel(data.getLeft(), data.getRight());
|
||||||
|
MODELS.put(data, model);
|
||||||
|
}
|
||||||
|
return model.getQuads(state, side, rand);
|
||||||
|
}
|
||||||
|
return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion() {
|
||||||
|
return CompostModel.compostBase.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture() {
|
||||||
|
return CompostModel.compostBase.getParticleTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides() {
|
||||||
|
return ItemOverrideList.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.vecmath.Vector3f;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
|
public class CompostModel implements IBakedModel {
|
||||||
|
public static IBakedModel compostBase;
|
||||||
|
private final IBakedModel display;
|
||||||
|
private final ImmutableList<BakedQuad> general;
|
||||||
|
private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
||||||
|
|
||||||
|
public CompostModel(IBlockState flowerState, float height) {
|
||||||
|
this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState);
|
||||||
|
|
||||||
|
TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
||||||
|
|
||||||
|
ImmutableList.Builder<BakedQuad> builder;
|
||||||
|
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
||||||
|
|
||||||
|
for (EnumFacing face : EnumFacing.values()) {
|
||||||
|
builder = ImmutableList.builder();
|
||||||
|
if (!display.isBuiltInRenderer()) {
|
||||||
|
for (BakedQuad quad : display.getQuads(flowerState, face, 0)) {
|
||||||
|
Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||||
|
quad.pipe(transformer);
|
||||||
|
builder.add(transformer.build());
|
||||||
|
}
|
||||||
|
builder.addAll(compostBase.getQuads(null, face, 0));
|
||||||
|
}
|
||||||
|
faces.put(face, builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!display.isBuiltInRenderer()) {
|
||||||
|
builder = ImmutableList.builder();
|
||||||
|
for (BakedQuad quad : display.getQuads(flowerState, null, 0)) {
|
||||||
|
Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||||
|
quad.pipe(transformer);
|
||||||
|
builder.add(transformer.build());
|
||||||
|
}
|
||||||
|
builder.addAll(compostBase.getQuads(null, null, 0));
|
||||||
|
this.general = builder.build();
|
||||||
|
} else general = ImmutableList.of();
|
||||||
|
|
||||||
|
this.faces = Maps.immutableEnumMap(faces);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||||
|
if (side == null) return general;
|
||||||
|
return faces.get(side);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion() {
|
||||||
|
return compostBase.isAmbientOcclusion() && display.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture() {
|
||||||
|
return compostBase.getParticleTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides() {
|
||||||
|
return ItemOverrideList.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("RenderCompost.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class RenderCompost extends TileEntitySpecialRenderer<TileEntityCompost>{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(TileEntityCompost compost, double x, double y, double z, float partialTicks, int destroyStage, float f){
|
|
||||||
if(compost instanceof TileEntityCompost){
|
|
||||||
ItemStack slot = compost.inv.getStackInSlot(0);
|
|
||||||
|
|
||||||
if(StackUtil.isValid(slot)){
|
|
||||||
Block display = null;
|
|
||||||
int maxAmount = 0;
|
|
||||||
for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
|
||||||
if(slot.isItemEqual(aRecipe.input)){
|
|
||||||
display = aRecipe.inputDisplay;
|
|
||||||
maxAmount = aRecipe.input.getMaxStackSize();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if(slot.isItemEqual(aRecipe.output)){
|
|
||||||
display = aRecipe.outputDisplay;
|
|
||||||
maxAmount = aRecipe.output.getMaxStackSize();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(display != null){
|
|
||||||
float i = (float)slot.getCount()/(float)maxAmount;
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y+(i/3F)+0.01F, (float)z+0.5F);
|
|
||||||
//Hehe
|
|
||||||
if("ShadowfactsDev".equals(Minecraft.getMinecraft().player.getName())){
|
|
||||||
GlStateManager.translate(0F, 1F, 0F);
|
|
||||||
}
|
|
||||||
GlStateManager.scale(1.5F, i, 1.5F);
|
|
||||||
AssetUtil.renderBlockInWorld(display, 0);
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -64,7 +64,7 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpower
|
||||||
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
||||||
BlockPos offset = tile.getPos().offset(facing, 3);
|
BlockPos offset = tile.getPos().offset(facing, 3);
|
||||||
|
|
||||||
AssetUtil.renderLaser(tile.getPos().getX()+0.5, tile.getPos().getY()+0.5, tile.getPos().getZ()+0.5, offset.getX()+0.5, offset.getY()+0.95, offset.getZ()+0.5, 80, 1F, 0.1F, recipe.particleColor);
|
AssetUtil.renderLaser(tile.getPos().getX()+0.5, tile.getPos().getY()+0.5, tile.getPos().getZ()+0.5, offset.getX()+0.5, offset.getY()+0.95, offset.getZ()+0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import javax.vecmath.Matrix3f;
|
||||||
|
import javax.vecmath.Matrix4f;
|
||||||
|
import javax.vecmath.Vector3f;
|
||||||
|
import javax.vecmath.Vector4f;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||||
|
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||||
|
import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
||||||
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
|
public class Transformer extends VertexTransformer {
|
||||||
|
|
||||||
|
protected final Matrix4f transformation;
|
||||||
|
protected final Matrix3f normalTransformation;
|
||||||
|
|
||||||
|
public Transformer(TRSRTransformation transformation, VertexFormat format) {
|
||||||
|
super(new UnpackedBakedQuad.Builder(format));
|
||||||
|
// position transform
|
||||||
|
this.transformation = transformation.getMatrix();
|
||||||
|
// normal transform
|
||||||
|
this.normalTransformation = new Matrix3f();
|
||||||
|
this.transformation.getRotationScale(this.normalTransformation);
|
||||||
|
this.normalTransformation.invert();
|
||||||
|
this.normalTransformation.transpose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void put(int element, float... data) {
|
||||||
|
VertexFormatElement.EnumUsage usage = parent.getVertexFormat().getElement(element).getUsage();
|
||||||
|
|
||||||
|
// transform normals and position
|
||||||
|
if (usage == VertexFormatElement.EnumUsage.POSITION && data.length >= 3) {
|
||||||
|
Vector4f vec = new Vector4f(data);
|
||||||
|
vec.setW(1.0f);
|
||||||
|
transformation.transform(vec);
|
||||||
|
data = new float[4];
|
||||||
|
vec.get(data);
|
||||||
|
} else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) {
|
||||||
|
Vector3f vec = new Vector3f(data);
|
||||||
|
normalTransformation.transform(vec);
|
||||||
|
vec.normalize();
|
||||||
|
data = new float[4];
|
||||||
|
vec.get(data);
|
||||||
|
}
|
||||||
|
super.put(element, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnpackedBakedQuad build() {
|
||||||
|
return ((UnpackedBakedQuad.Builder) parent).build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
@ -185,7 +186,7 @@ public final class InitBooklet{
|
||||||
//Reconstruction
|
//Reconstruction
|
||||||
chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1)).setImportant();
|
chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1)).setImportant();
|
||||||
new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial();
|
new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial();
|
||||||
new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(new ItemStack(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText());
|
new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText());
|
||||||
new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemColorLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText());
|
new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemColorLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText());
|
||||||
new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDamageLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText());
|
new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDamageLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText());
|
||||||
new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMoreDamageLens), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText());
|
new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMoreDamageLens), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText());
|
||||||
|
|
|
@ -27,10 +27,14 @@ public class PageCoffeeMachine extends BookletPage{
|
||||||
|
|
||||||
private final CoffeeIngredient ingredient;
|
private final CoffeeIngredient ingredient;
|
||||||
private final ItemStack outcome;
|
private final ItemStack outcome;
|
||||||
|
private int counter = 0;
|
||||||
|
private int rotate = 0;
|
||||||
|
private final ItemStack[] stacks;
|
||||||
|
|
||||||
public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient){
|
public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient){
|
||||||
super(localizationKey);
|
super(localizationKey);
|
||||||
this.ingredient = ingredient;
|
this.ingredient = ingredient;
|
||||||
|
this.stacks = ingredient.getInput().getMatchingStacks();
|
||||||
|
|
||||||
this.outcome = new ItemStack(InitItems.itemCoffee);
|
this.outcome = new ItemStack(InitItems.itemCoffee);
|
||||||
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient);
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient);
|
||||||
|
@ -48,6 +52,8 @@ public class PageCoffeeMachine extends BookletPage{
|
||||||
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX+5, startY+51, 0, false, gui.getSmallFontSize(), 35);
|
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX+5, startY+51, 0, false, gui.getSmallFontSize(), 35);
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+90);
|
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+90);
|
||||||
|
|
||||||
|
if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+5+82, startY+10+1, 1F, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +61,7 @@ public class PageCoffeeMachine extends BookletPage{
|
||||||
public void initGui(GuiBookletBase gui, int startX, int startY){
|
public void initGui(GuiBookletBase gui, int startX, int startY){
|
||||||
super.initGui(gui, startX, startY);
|
super.initGui(gui, startX, startY);
|
||||||
|
|
||||||
gui.addOrModifyItemRenderer(this.ingredient.ingredient, startX+5+82, startY+10+1, 1F, true);
|
gui.addOrModifyItemRenderer(stacks[0], startX+5+82, startY+10+1, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.outcome, startX+5+36, startY+10+42, 1F, false);
|
gui.addOrModifyItemRenderer(this.outcome, startX+5+36, startY+10+42, 1F, false);
|
||||||
|
|
||||||
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX+5+37, startY+10+1, 1F, true);
|
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX+5+37, startY+10+1, 1F, true);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
||||||
|
|
||||||
if(counter++ % 50 == 0)gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+38+18, startY+6+1, 1F, true);
|
if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+38+18, startY+6+1, 1F, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,10 +25,24 @@ import java.util.List;
|
||||||
public class PageEmpowerer extends BookletPage{
|
public class PageEmpowerer extends BookletPage{
|
||||||
|
|
||||||
private final EmpowererRecipe recipe;
|
private final EmpowererRecipe recipe;
|
||||||
|
private int counter = 0;
|
||||||
|
private int rotate = 0;
|
||||||
|
ItemStack[] inputs;
|
||||||
|
ItemStack[] stand1;
|
||||||
|
ItemStack[] stand2;
|
||||||
|
ItemStack[] stand3;
|
||||||
|
ItemStack[] stand4;
|
||||||
|
|
||||||
public PageEmpowerer(int localizationKey, EmpowererRecipe recipe){
|
public PageEmpowerer(int localizationKey, EmpowererRecipe recipe){
|
||||||
super(localizationKey);
|
super(localizationKey);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
|
if(recipe != null) {
|
||||||
|
this.inputs = recipe.getInput().getMatchingStacks();
|
||||||
|
this.stand1 = recipe.getStandOne().getMatchingStacks();
|
||||||
|
this.stand2 = recipe.getStandTwo().getMatchingStacks();
|
||||||
|
this.stand3 = recipe.getStandThree().getMatchingStacks();
|
||||||
|
this.stand4 = recipe.getStandFour().getMatchingStacks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,6 +56,7 @@ public class PageEmpowerer extends BookletPage{
|
||||||
gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".empowererRecipe")+")", startX+6, startY+85, 0, false, gui.getMediumFontSize());
|
gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".empowererRecipe")+")", startX+6, startY+85, 0, false, gui.getMediumFontSize());
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
||||||
|
if(recipe != null) updateInputs(gui, startX, startY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,13 +65,25 @@ public class PageEmpowerer extends BookletPage{
|
||||||
super.initGui(gui, startX, startY);
|
super.initGui(gui, startX, startY);
|
||||||
|
|
||||||
if(this.recipe != null){
|
if(this.recipe != null){
|
||||||
gui.addOrModifyItemRenderer(this.recipe.modifier1, startX+5+26, startY+10+1, 1F, true);
|
gui.addOrModifyItemRenderer(stand1[0], startX+5+26, startY+10+1, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.recipe.modifier2, startX+5+1, startY+10+26, 1F, true);
|
gui.addOrModifyItemRenderer(stand2[0], startX+5+1, startY+10+26, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.recipe.modifier3, startX+5+51, startY+10+26, 1F, true);
|
gui.addOrModifyItemRenderer(stand3[0], startX+5+51, startY+10+26, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.recipe.modifier4, startX+5+26, startY+10+51, 1F, true);
|
gui.addOrModifyItemRenderer(stand4[0], startX+5+26, startY+10+51, 1F, true);
|
||||||
|
|
||||||
gui.addOrModifyItemRenderer(this.recipe.input, startX+5+26, startY+10+26, 1F, true);
|
gui.addOrModifyItemRenderer(inputs[0], startX+5+26, startY+10+26, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.recipe.output, startX+5+96, startY+10+26, 1F, false);
|
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX+5+96, startY+10+26, 1F, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateInputs(GuiBookletBase gui, int startX, int startY) {
|
||||||
|
if(counter++ % 50 == 0) {
|
||||||
|
rotate++;
|
||||||
|
gui.addOrModifyItemRenderer(stand1[rotate % stand1.length], startX+5+26, startY+10+1, 1F, true);
|
||||||
|
gui.addOrModifyItemRenderer(stand2[rotate % stand2.length], startX+5+1, startY+10+26, 1F, true);
|
||||||
|
gui.addOrModifyItemRenderer(stand3[rotate % stand3.length], startX+5+51, startY+10+26, 1F, true);
|
||||||
|
gui.addOrModifyItemRenderer(stand4[rotate % stand4.length], startX+5+26, startY+10+51, 1F, true);
|
||||||
|
|
||||||
|
gui.addOrModifyItemRenderer(inputs[rotate % inputs.length], startX+5+26, startY+10+26, 1F, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +92,7 @@ public class PageEmpowerer extends BookletPage{
|
||||||
super.getItemStacksForPage(list);
|
super.getItemStacksForPage(list);
|
||||||
|
|
||||||
if(this.recipe != null){
|
if(this.recipe != null){
|
||||||
list.add(this.recipe.output);
|
list.add(this.recipe.getOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,15 @@ public class PageReconstructor extends BookletPage{
|
||||||
|
|
||||||
private final LensConversionRecipe recipe;
|
private final LensConversionRecipe recipe;
|
||||||
private boolean isWildcard;
|
private boolean isWildcard;
|
||||||
|
private int counter = 0;
|
||||||
|
private int rotate = 0;
|
||||||
|
private ItemStack[] stacks;
|
||||||
|
|
||||||
|
|
||||||
public PageReconstructor(int localizationKey, LensConversionRecipe recipe){
|
public PageReconstructor(int localizationKey, LensConversionRecipe recipe){
|
||||||
super(localizationKey);
|
super(localizationKey);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
|
if(recipe != null) this.stacks = recipe.getInput().getMatchingStacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,6 +49,9 @@ public class PageReconstructor extends BookletPage{
|
||||||
gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".reconstructorRecipe")+")", startX+6, startY+63, 0, false, gui.getMediumFontSize());
|
gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".reconstructorRecipe")+")", startX+6, startY+63, 0, false, gui.getMediumFontSize());
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+88);
|
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+88);
|
||||||
|
if(this.recipe != null){
|
||||||
|
if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+30+1, startY+10+13, 1F, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,8 +60,8 @@ public class PageReconstructor extends BookletPage{
|
||||||
super.initGui(gui, startX, startY);
|
super.initGui(gui, startX, startY);
|
||||||
|
|
||||||
if(this.recipe != null){
|
if(this.recipe != null){
|
||||||
gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+30+1, startY+10+13, 1F, true);
|
gui.addOrModifyItemRenderer(stacks[0], startX+30+1, startY+10+13, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.recipe.outputStack, startX+30+47, startY+10+13, 1F, false);
|
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX+30+47, startY+10+13, 1F, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +70,7 @@ public class PageReconstructor extends BookletPage{
|
||||||
super.getItemStacksForPage(list);
|
super.getItemStacksForPage(list);
|
||||||
|
|
||||||
if(this.recipe != null){
|
if(this.recipe != null){
|
||||||
ItemStack copy = this.recipe.outputStack.copy();
|
ItemStack copy = this.recipe.getOutput().copy();
|
||||||
if(this.isWildcard){
|
if(this.isWildcard){
|
||||||
copy.setItemDamage(Util.WILDCARD);
|
copy.setItemDamage(Util.WILDCARD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,16 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.CactusFarmerBehavior;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.MelonPumpkinFarmerBehavior;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.NetherWartFarmerBehavior;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.ReedFarmerBehavior;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu.EnderlillyFarmerBehavior;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu.EnderlillyFarmerBehavior;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu.RedOrchidFarmerBehavior;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu.RedOrchidFarmerBehavior;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public final class InitCrafting{
|
public final class InitCrafting{
|
||||||
|
@ -34,8 +39,8 @@ public final class InitCrafting{
|
||||||
FoodCrafting.init();
|
FoodCrafting.init();
|
||||||
ToolCrafting.init();
|
ToolCrafting.init();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), Blocks.LEAVES, new ItemStack(InitItems.itemFertilizer), Blocks.DIRT);
|
ActuallyAdditionsAPI.addCompostRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal())), Blocks.LEAVES.getDefaultState(), new ItemStack(InitItems.itemFertilizer), Blocks.DIRT.getDefaultState());
|
||||||
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemCanolaSeed), Blocks.DIRT, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND);
|
ActuallyAdditionsAPI.addCompostRecipe(Ingredient.fromItem(InitItems.itemCanolaSeed), Blocks.DIRT.getDefaultState(), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND.getDefaultState());
|
||||||
|
|
||||||
int[] power = ConfigIntListValues.OIL_POWER.getValue();
|
int[] power = ConfigIntListValues.OIL_POWER.getValue();
|
||||||
int[] time = ConfigIntListValues.OIL_TIME.getValue();
|
int[] time = ConfigIntListValues.OIL_TIME.getValue();
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.event;
|
package de.ellpeck.actuallyadditions.mod.event;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
|
@ -46,8 +48,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ClientEvents{
|
public class ClientEvents{
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||||
|
@ -20,18 +24,14 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiInputter extends GuiContainer{
|
public class GuiInputter extends GuiWtfMojang{
|
||||||
|
|
||||||
public static final int OFFSET_ADVANCED = 12+36;
|
public static final int OFFSET_ADVANCED = 12+36;
|
||||||
public static final String[] SIDES = new String[]{
|
public static final String[] SIDES = new String[]{
|
||||||
|
|
|
@ -10,6 +10,11 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
@ -25,16 +30,13 @@ import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.StringUtils;
|
import net.minecraft.util.StringUtils;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemCoffee extends ItemFoodBase{
|
public class ItemCoffee extends ItemFoodBase{
|
||||||
|
|
||||||
public ItemCoffee(String name){
|
public ItemCoffee(String name){
|
||||||
|
@ -46,29 +48,28 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initIngredients(){
|
public static void initIngredients(){
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(new ItemStack(Items.MILK_BUCKET)));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.fromItem(Items.MILK_BUCKET)));
|
||||||
//Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?)
|
//Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?)
|
||||||
if(Loader.isModLoaded("harvestcraft")){
|
if(Loader.isModLoaded("harvestcraft")){
|
||||||
Item item = ItemUtil.getItemFromName("harvestcraft:soymilkItem");
|
Item item = ItemUtil.getItemFromName("harvestcraft:soymilkItem");
|
||||||
if(item != null){
|
if(item != null){
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(new ItemStack(item)));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.fromItem(item)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.SUGAR), new PotionEffect[]{new PotionEffect(MobEffects.SPEED, 30, 0)}, 4));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.SUGAR), 4, new PotionEffect(MobEffects.SPEED, 30, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.MAGMA_CREAM), new PotionEffect[]{new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0)}, 2));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.MAGMA_CREAM), 2, new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.FISH, 1, 3), new PotionEffect[]{new PotionEffect(MobEffects.WATER_BREATHING, 10, 0)}, 2));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromStacks(new ItemStack(Items.FISH, 1, 3)), 2, new PotionEffect(MobEffects.WATER_BREATHING, 10, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.GOLDEN_CARROT), new PotionEffect[]{new PotionEffect(MobEffects.NIGHT_VISION, 30, 0)}, 2));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.GOLDEN_CARROT), 2, new PotionEffect(MobEffects.NIGHT_VISION, 30, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.GHAST_TEAR), new PotionEffect[]{new PotionEffect(MobEffects.REGENERATION, 5, 0)}, 3));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.GHAST_TEAR), 3, new PotionEffect(MobEffects.REGENERATION, 5, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.BLAZE_POWDER), new PotionEffect[]{new PotionEffect(MobEffects.STRENGTH, 15, 0)}, 4));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.BLAZE_POWDER), 4, new PotionEffect(MobEffects.STRENGTH, 15, 0)));
|
||||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.FERMENTED_SPIDER_EYE), new PotionEffect[]{new PotionEffect(MobEffects.INVISIBILITY, 25, 0)}, 2));
|
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.FERMENTED_SPIDER_EYE), 2, new PotionEffect(MobEffects.INVISIBILITY, 25, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public static CoffeeIngredient getIngredientFromStack(ItemStack stack){
|
public static CoffeeIngredient getIngredientFromStack(ItemStack stack){
|
||||||
for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
|
for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
|
||||||
if(ingredient.ingredient.copy().isItemEqual(stack)){
|
if(ingredient.getInput().apply(stack)) return ingredient;
|
||||||
return ingredient;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -132,8 +133,8 @@ public class ItemCoffee extends ItemFoodBase{
|
||||||
|
|
||||||
public static class MilkIngredient extends CoffeeIngredient{
|
public static class MilkIngredient extends CoffeeIngredient{
|
||||||
|
|
||||||
public MilkIngredient(ItemStack ingredient){
|
public MilkIngredient(Ingredient ingredient){
|
||||||
super(ingredient, null, 0);
|
super(ingredient, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,8 +11,12 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta;
|
import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
|
@ -21,12 +25,13 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion;
|
import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
|
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public final class LensRecipeHandler{
|
public final class LensRecipeHandler{
|
||||||
|
|
||||||
|
@ -47,65 +52,65 @@ public final class LensRecipeHandler{
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
//Crystal Blocks
|
//Crystal Blocks
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
|
|
||||||
//Crystal Items
|
//Crystal Items
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DYE, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(Items.DYE, 1, 4)), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||||
|
|
||||||
//Lenses
|
//Lenses
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal())), new ItemStack(InitItems.itemColorLens), 5000);
|
||||||
recipeColorLens = RecipeUtil.lastReconstructorRecipe();
|
recipeColorLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
||||||
recipeExplosionLens = RecipeUtil.lastReconstructorRecipe();
|
recipeExplosionLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
||||||
recipeDamageLens = RecipeUtil.lastReconstructorRecipe();
|
recipeDamageLens = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelay), new ItemStack(InitBlocks.blockLaserRelayFluids), 2000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelay), new ItemStack(InitBlocks.blockLaserRelayFluids), 2000);
|
||||||
recipeFluidLaser = RecipeUtil.lastReconstructorRecipe();
|
recipeFluidLaser = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayFluids), new ItemStack(InitBlocks.blockLaserRelayItem), 2000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelayFluids), new ItemStack(InitBlocks.blockLaserRelayItem), 2000);
|
||||||
recipeItemLaser = RecipeUtil.lastReconstructorRecipe();
|
recipeItemLaser = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayItem), new ItemStack(InitBlocks.blockLaserRelay), 2000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelayItem), new ItemStack(InitBlocks.blockLaserRelay), 2000);
|
||||||
|
|
||||||
//Misc
|
//Misc
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000);
|
||||||
recipeSoulSand = RecipeUtil.lastReconstructorRecipe();
|
recipeSoulSand = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000);
|
||||||
recipeLeather = RecipeUtil.lastReconstructorRecipe();
|
recipeLeather = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000);
|
||||||
recipeNetherWart = RecipeUtil.lastReconstructorRecipe();
|
recipeNetherWart = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), 30000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), 30000);
|
||||||
recipePrismarine = RecipeUtil.lastReconstructorRecipe();
|
recipePrismarine = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), 2000);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItem(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), 2000);
|
||||||
recipeCrystallizedCanolaSeed = RecipeUtil.lastReconstructorRecipe();
|
recipeCrystallizedCanolaSeed = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
||||||
recipeWhiteWall = RecipeUtil.lastReconstructorRecipe();
|
recipeWhiteWall = RecipeUtil.lastReconstructorRecipe();
|
||||||
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1)), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
||||||
recipeGreenWall = RecipeUtil.lastReconstructorRecipe();
|
recipeGreenWall = RecipeUtil.lastReconstructorRecipe();
|
||||||
|
|
||||||
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(recipeEnchBook = new EnchBookConversion());
|
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(recipeEnchBook = new EnchBookConversion());
|
||||||
|
@ -121,13 +126,22 @@ public final class LensRecipeHandler{
|
||||||
ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLampOn), changer);
|
ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLampOn), changer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<LensConversionRecipe> getRecipesFor(ItemStack input){
|
@Deprecated //Use lens-checking method below.
|
||||||
ArrayList<LensConversionRecipe> possibleRecipes = new ArrayList<LensConversionRecipe>();
|
public static List<LensConversionRecipe> getRecipesFor(ItemStack input){
|
||||||
for(LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES){
|
List<LensConversionRecipe> possibleRecipes = new ArrayList<>();
|
||||||
if(ItemUtil.areItemsEqual(recipe.inputStack, input, true)){
|
for(LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES)
|
||||||
possibleRecipes.add(recipe);
|
if(recipe.getInput().apply(input)) possibleRecipes.add(recipe);
|
||||||
}
|
|
||||||
}
|
|
||||||
return possibleRecipes;
|
return possibleRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static LensConversionRecipe findMatchingRecipe(ItemStack input, Lens lens){
|
||||||
|
for(LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES)
|
||||||
|
if(recipe.matches(input, lens)) return recipe;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Ingredient fromBlock(Block b) {
|
||||||
|
return Ingredient.fromItem(Item.getItemFromBlock(b));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -52,7 +54,7 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory<CoffeeMachin
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, CoffeeMachineRecipeWrapper wrapper, IIngredients ingredients){
|
public void setRecipe(IRecipeLayout recipeLayout, CoffeeMachineRecipeWrapper wrapper, IIngredients ingredients){
|
||||||
recipeLayout.getItemStacks().init(0, true, 89, 20);
|
recipeLayout.getItemStacks().init(0, true, 89, 20);
|
||||||
recipeLayout.getItemStacks().set(0, wrapper.theIngredient.ingredient);
|
recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.ingredient.getInput().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(1, true, 44, 38);
|
recipeLayout.getItemStacks().init(1, true, 44, 38);
|
||||||
recipeLayout.getItemStacks().set(1, wrapper.cup);
|
recipeLayout.getItemStacks().set(1, wrapper.cup);
|
||||||
|
|
|
@ -10,6 +10,11 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
|
@ -24,60 +29,58 @@ import mezz.jei.api.ingredients.IIngredients;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
|
public final CoffeeIngredient ingredient;
|
||||||
|
|
||||||
public final CoffeeIngredient theIngredient;
|
|
||||||
public final ItemStack theOutput;
|
public final ItemStack theOutput;
|
||||||
public final ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
public final ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
||||||
public final ItemStack coffeeBeans = new ItemStack(InitItems.itemCoffeeBean);
|
public final ItemStack coffeeBeans = new ItemStack(InitItems.itemCoffeeBean);
|
||||||
|
|
||||||
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient){
|
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient) {
|
||||||
this.theIngredient = ingredient;
|
this.ingredient = ingredient;
|
||||||
|
|
||||||
this.theOutput = new ItemStack(InitItems.itemCoffee);
|
this.theOutput = new ItemStack(InitItems.itemCoffee);
|
||||||
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.theOutput, this.theIngredient);
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.theOutput, this.ingredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getIngredients(IIngredients ingredients){
|
public void getIngredients(IIngredients ingredients) {
|
||||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
List<ItemStack> list = new ArrayList<>();
|
||||||
list.add(this.theIngredient.ingredient);
|
for(ItemStack s : ingredient.getInput().getMatchingStacks())
|
||||||
|
list.add(s);
|
||||||
list.add(this.cup);
|
list.add(this.cup);
|
||||||
list.add(this.coffeeBeans);
|
list.add(this.coffeeBeans);
|
||||||
ingredients.setInputs(ItemStack.class, list);
|
ingredients.setInputs(ItemStack.class, list);
|
||||||
|
|
||||||
ingredients.setOutput(ItemStack.class, this.theOutput);
|
ingredients.setOutput(ItemStack.class, this.theOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||||
if(this.theIngredient.getExtraText() != null){
|
if (!Strings.isNullOrEmpty(this.ingredient.getExtraText())) {
|
||||||
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei."+ActuallyAdditions.MODID+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
minecraft.fontRenderer.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRenderer.drawString(this.ingredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.theIngredient.maxAmplifier > 0){
|
if (this.ingredient.getMaxAmplifier() > 0) {
|
||||||
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei."+ActuallyAdditions.MODID+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".coffee.maxAmount") + ": " + this.ingredient.getMaxAmplifier(), 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonY(){
|
public int getButtonY() {
|
||||||
return 68;
|
return 68;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBookletPage getPage(){
|
public IBookletPage getPage() {
|
||||||
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.compost;
|
package de.ellpeck.actuallyadditions.mod.jei.compost;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -19,42 +21,42 @@ import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.IRecipeCategory;
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
|
|
||||||
public class CompostRecipeCategory implements IRecipeCategory<CompostRecipeWrapper>{
|
public class CompostRecipeCategory implements IRecipeCategory<CompostRecipeWrapper> {
|
||||||
|
|
||||||
public static final String NAME = "actuallyadditions.compost";
|
public static final String NAME = "actuallyadditions.compost";
|
||||||
|
|
||||||
private final IDrawable background;
|
private final IDrawable background;
|
||||||
|
|
||||||
public CompostRecipeCategory(IGuiHelper helper){
|
public CompostRecipeCategory(IGuiHelper helper) {
|
||||||
this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_simple"), 0, 0, 96, 60);
|
this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_simple"), 0, 0, 96, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUid(){
|
public String getUid() {
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle(){
|
public String getTitle() {
|
||||||
return StringUtil.localize("container.nei."+NAME+".name");
|
return StringUtil.localize("container.nei." + NAME + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModName(){
|
public String getModName() {
|
||||||
return ActuallyAdditions.NAME;
|
return ActuallyAdditions.NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getBackground(){
|
public IDrawable getBackground() {
|
||||||
return this.background;
|
return this.background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, CompostRecipeWrapper wrapper, IIngredients ingredients){
|
public void setRecipe(IRecipeLayout recipeLayout, CompostRecipeWrapper wrapper, IIngredients ingredients) {
|
||||||
recipeLayout.getItemStacks().init(0, true, 4, 18);
|
recipeLayout.getItemStacks().init(0, true, 4, 18);
|
||||||
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.input);
|
recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.recipe.getInput().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(1, false, 66, 18);
|
recipeLayout.getItemStacks().init(1, false, 66, 18);
|
||||||
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.output);
|
recipeLayout.getItemStacks().set(1, wrapper.recipe.getOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,49 +10,51 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.compost;
|
package de.ellpeck.actuallyadditions.mod.jei.compost;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class CompostRecipeWrapper extends RecipeWrapperWithButton{
|
public class CompostRecipeWrapper extends RecipeWrapperWithButton {
|
||||||
|
|
||||||
public final CompostRecipe theRecipe;
|
public final CompostRecipe recipe;
|
||||||
|
|
||||||
public CompostRecipeWrapper(CompostRecipe recipe){
|
public CompostRecipeWrapper(CompostRecipe recipe) {
|
||||||
this.theRecipe = recipe;
|
this.recipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getIngredients(IIngredients ingredients){
|
public void getIngredients(IIngredients ingredients) {
|
||||||
ingredients.setInput(ItemStack.class, this.theRecipe.input);
|
ingredients.setInputs(ItemStack.class, Arrays.asList(recipe.getInput().getMatchingStacks()));
|
||||||
ingredients.setOutput(ItemStack.class, this.theRecipe.output);
|
ingredients.setOutput(ItemStack.class, recipe.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||||
int bake_time = TileEntityCompost.COMPOST_TIME_TICKS / 20;
|
int bake_time = TileEntityCompost.COMPOST_TIME_TICKS / 20;
|
||||||
minecraft.fontRenderer.drawString(bake_time + "s", 28, 3, 0xFFFFFF, true);
|
minecraft.fontRenderer.drawString(bake_time + "s", 28, 3, 0xFFFFFF, true);
|
||||||
//super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); Not sure the button needs to be here.
|
//super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); Not sure the button needs to be here.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX() {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonY(){
|
public int getButtonY() {
|
||||||
return 35;
|
return 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBookletPage getPage(){
|
public IBookletPage getPage() {
|
||||||
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockCompost));
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockCompost));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
|
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
@ -52,21 +54,21 @@ public class EmpowererRecipeCategory implements IRecipeCategory<EmpowererRecipeW
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipeWrapper wrapper, IIngredients ingredients){
|
public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipeWrapper wrapper, IIngredients ingredients){
|
||||||
recipeLayout.getItemStacks().init(0, true, 31, 31);
|
recipeLayout.getItemStacks().init(0, true, 31, 31);
|
||||||
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.input);
|
recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.theRecipe.getInput().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(1, true, 1, 31);
|
recipeLayout.getItemStacks().init(1, true, 1, 31);
|
||||||
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.modifier1);
|
recipeLayout.getItemStacks().set(1, Arrays.asList(wrapper.theRecipe.getStandOne().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(2, true, 31, 1);
|
recipeLayout.getItemStacks().init(2, true, 31, 1);
|
||||||
recipeLayout.getItemStacks().set(2, wrapper.theRecipe.modifier2);
|
recipeLayout.getItemStacks().set(2, Arrays.asList(wrapper.theRecipe.getStandTwo().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(3, true, 61, 31);
|
recipeLayout.getItemStacks().init(3, true, 61, 31);
|
||||||
recipeLayout.getItemStacks().set(3, wrapper.theRecipe.modifier3);
|
recipeLayout.getItemStacks().set(3, Arrays.asList(wrapper.theRecipe.getStandThree().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(4, true, 31, 61);
|
recipeLayout.getItemStacks().init(4, true, 31, 61);
|
||||||
recipeLayout.getItemStacks().set(4, wrapper.theRecipe.modifier4);
|
recipeLayout.getItemStacks().set(4, Arrays.asList(wrapper.theRecipe.getStandFour().getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(5, false, 112, 31);
|
recipeLayout.getItemStacks().init(5, false, 112, 31);
|
||||||
recipeLayout.getItemStacks().set(5, wrapper.theRecipe.output);
|
recipeLayout.getItemStacks().set(5, wrapper.theRecipe.getOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
|
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
@ -18,8 +21,6 @@ import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
|
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
public final EmpowererRecipe theRecipe;
|
public final EmpowererRecipe theRecipe;
|
||||||
|
@ -30,8 +31,20 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getIngredients(IIngredients ingredients){
|
public void getIngredients(IIngredients ingredients){
|
||||||
ingredients.setInputs(ItemStack.class, Arrays.asList(this.theRecipe.input, this.theRecipe.modifier1, this.theRecipe.modifier2, this.theRecipe.modifier3, this.theRecipe.modifier4));
|
List<ItemStack> inputs = new ArrayList<>();
|
||||||
ingredients.setOutput(ItemStack.class, this.theRecipe.output);
|
for(ItemStack s : theRecipe.getInput().getMatchingStacks())
|
||||||
|
inputs.add(s);
|
||||||
|
for(ItemStack s : theRecipe.getStandOne().getMatchingStacks())
|
||||||
|
inputs.add(s);
|
||||||
|
for(ItemStack s : theRecipe.getStandTwo().getMatchingStacks())
|
||||||
|
inputs.add(s);
|
||||||
|
for(ItemStack s : theRecipe.getStandThree().getMatchingStacks())
|
||||||
|
inputs.add(s);
|
||||||
|
for(ItemStack s : theRecipe.getStandFour().getMatchingStacks())
|
||||||
|
inputs.add(s);
|
||||||
|
|
||||||
|
ingredients.setInputs(ItemStack.class, inputs);
|
||||||
|
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
@ -25,68 +27,68 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTTagString;
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
|
||||||
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton{
|
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton {
|
||||||
|
|
||||||
public static final IRecipeWrapperFactory<LensConversionRecipe> FACTORY = (recipe) -> {
|
public static final IRecipeWrapperFactory<LensConversionRecipe> FACTORY = (recipe) -> {
|
||||||
if(recipe instanceof EnchBookConversion) return new EnchBookWrapper((EnchBookConversion) recipe);
|
if (recipe instanceof EnchBookConversion) return new EnchBookWrapper((EnchBookConversion) recipe);
|
||||||
return new ReconstructorRecipeWrapper(recipe);
|
return new ReconstructorRecipeWrapper(recipe);
|
||||||
};
|
};
|
||||||
|
|
||||||
public final LensConversionRecipe theRecipe;
|
public final LensConversionRecipe theRecipe;
|
||||||
|
|
||||||
public ReconstructorRecipeWrapper(LensConversionRecipe recipe){
|
public ReconstructorRecipeWrapper(LensConversionRecipe recipe) {
|
||||||
this.theRecipe = recipe;
|
this.theRecipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getIngredients(IIngredients ingredients){
|
public void getIngredients(IIngredients ingredients) {
|
||||||
ingredients.setInput(ItemStack.class, this.theRecipe.inputStack);
|
ingredients.setInputs(ItemStack.class, Arrays.asList(this.theRecipe.getInput().getMatchingStacks()));
|
||||||
ingredients.setOutput(ItemStack.class, this.theRecipe.outputStack);
|
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||||
minecraft.fontRenderer.drawString(this.theRecipe.energyUse+" CF", 55, 0, 0xFFFFFF, true);
|
minecraft.fontRenderer.drawString(this.theRecipe.getEnergyUsed() + " CF", 55, 0, 0xFFFFFF, true);
|
||||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonX(){
|
public int getButtonX() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getButtonY(){
|
public int getButtonY() {
|
||||||
return 40;
|
return 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBookletPage getPage(){
|
public IBookletPage getPage() {
|
||||||
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EnchBookWrapper extends ReconstructorRecipeWrapper {
|
public static class EnchBookWrapper extends ReconstructorRecipeWrapper {
|
||||||
|
|
||||||
private static final ItemStack BOOK = new ItemStack(Items.ENCHANTED_BOOK);
|
private static final ItemStack BOOK = new ItemStack(Items.ENCHANTED_BOOK);
|
||||||
private static final ItemStack OUT = new ItemStack(Items.ENCHANTED_BOOK);
|
private static final ItemStack OUT = new ItemStack(Items.ENCHANTED_BOOK);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
OUT.setStackDisplayName("Split Book");
|
OUT.setStackDisplayName("Split Book");
|
||||||
NBTTagCompound t = OUT.getTagCompound().getCompoundTag("display");
|
NBTTagCompound t = OUT.getTagCompound().getCompoundTag("display");
|
||||||
NBTTagList l = new NBTTagList();
|
NBTTagList l = new NBTTagList();
|
||||||
l.appendTag(new NBTTagString("Book will be split based on enchantments!"));
|
l.appendTag(new NBTTagString("Book will be split based on enchantments!"));
|
||||||
t.setTag("Lore", l);
|
t.setTag("Lore", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnchBookWrapper(EnchBookConversion recipe) {
|
public EnchBookWrapper(EnchBookConversion recipe) {
|
||||||
super(recipe);
|
super(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getIngredients(IIngredients ingredients){
|
public void getIngredients(IIngredients ingredients) {
|
||||||
ingredients.setInput(ItemStack.class, BOOK);
|
ingredients.setInput(ItemStack.class, BOOK);
|
||||||
ingredients.setOutput(ItemStack.class, OUT);
|
ingredients.setOutput(ItemStack.class, OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
for(PotionEffect effect : effects){
|
for(PotionEffect effect : effects){
|
||||||
PotionEffect effectHas = this.getSameEffectFromStack(stack, effect);
|
PotionEffect effectHas = this.getSameEffectFromStack(stack, effect);
|
||||||
if(effectHas != null){
|
if(effectHas != null){
|
||||||
if(effectHas.getAmplifier() < ingredient.maxAmplifier-1){
|
if(effectHas.getAmplifier() < ingredient.getMaxAmplifier()-1){
|
||||||
this.addEffectProperties(stack, effect, false, true);
|
this.addEffectProperties(stack, effect, false, true);
|
||||||
worked = true;
|
worked = true;
|
||||||
}
|
}
|
||||||
|
@ -168,10 +168,9 @@ public class MethodHandler implements IMethodHandler{
|
||||||
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
||||||
if(!tile.getWorldObject().isAirBlock(pos)){
|
if(!tile.getWorldObject().isAirBlock(pos)){
|
||||||
IBlockState state = tile.getWorldObject().getBlockState(pos);
|
IBlockState state = tile.getWorldObject().getBlockState(pos);
|
||||||
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)));
|
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)), tile.getLens());
|
||||||
for(LensConversionRecipe recipe : recipes){
|
if(recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()){
|
||||||
if(recipe != null && recipe.type == tile.getLens() && tile.getEnergy() >= recipe.energyUse){
|
ItemStack output = recipe.getOutput();
|
||||||
ItemStack output = recipe.outputStack;
|
|
||||||
if(StackUtil.isValid(output)){
|
if(StackUtil.isValid(output)){
|
||||||
tile.getWorldObject().playEvent(2001, pos, Block.getStateId(state));
|
tile.getWorldObject().playEvent(2001, pos, Block.getStateId(state));
|
||||||
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
|
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
|
||||||
|
@ -186,14 +185,13 @@ public class MethodHandler implements IMethodHandler{
|
||||||
tile.getWorldObject().setBlockToAir(pos);
|
tile.getWorldObject().setBlockToAir(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.extractEnergy(recipe.energyUse);
|
tile.extractEnergy(recipe.getEnergyUsed());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Converting the Items
|
//Converting the Items
|
||||||
|
@ -201,10 +199,9 @@ public class MethodHandler implements IMethodHandler{
|
||||||
for(EntityItem item : items){
|
for(EntityItem item : items){
|
||||||
ItemStack stack = item.getItem();
|
ItemStack stack = item.getItem();
|
||||||
if(!item.isDead && StackUtil.isValid(stack)){
|
if(!item.isDead && StackUtil.isValid(stack)){
|
||||||
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(stack);
|
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens());
|
||||||
for(LensConversionRecipe recipe : recipes){
|
if(recipe != null){
|
||||||
if(recipe != null && recipe.type == tile.getLens()){
|
int itemsPossible = Math.min(tile.getEnergy()/recipe.getEnergyUsed(), stack.getCount());
|
||||||
int itemsPossible = Math.min(tile.getEnergy()/recipe.energyUse, stack.getCount());
|
|
||||||
|
|
||||||
if(itemsPossible > 0){
|
if(itemsPossible > 0){
|
||||||
recipe.transformHook(item.getItem(), null, item.getPosition(), tile);
|
recipe.transformHook(item.getItem(), null, item.getPosition(), tile);
|
||||||
|
@ -218,18 +215,17 @@ public class MethodHandler implements IMethodHandler{
|
||||||
tile.getWorldObject().spawnEntity(inputLeft);
|
tile.getWorldObject().spawnEntity(inputLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack outputCopy = recipe.outputStack.copy();
|
ItemStack outputCopy = recipe.getOutput().copy();
|
||||||
outputCopy.setCount(itemsPossible);
|
outputCopy.setCount(itemsPossible);
|
||||||
|
|
||||||
EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy);
|
EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy);
|
||||||
tile.getWorldObject().spawnEntity(newItem);
|
tile.getWorldObject().spawnEntity(newItem);
|
||||||
|
|
||||||
tile.extractEnergy(recipe.energyUse*itemsPossible);
|
tile.extractEnergy(recipe.getEnergyUsed()*itemsPossible);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
|
return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.ClientRegistryHandler;
|
import de.ellpeck.actuallyadditions.mod.ClientRegistryHandler;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderCompost;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay;
|
||||||
|
@ -43,14 +43,17 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -81,7 +84,7 @@ public class ClientProxy implements IProxy{
|
||||||
|
|
||||||
new ClientEvents();
|
new ClientEvents();
|
||||||
|
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderCompost());
|
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderCompost());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayStand.class, new RenderDisplayStand());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayStand.class, new RenderDisplayStand());
|
||||||
|
@ -110,6 +113,18 @@ public class ClientProxy implements IProxy{
|
||||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)block).getItemColor(), block);
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)block).getItemColor(), block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IBlockColor color = (state, world, pos, tint) -> {
|
||||||
|
if (world != null && pos != null) {
|
||||||
|
TileEntity tileentity = world.getTileEntity(pos);
|
||||||
|
if (tileentity instanceof TileEntityCompost && ((TileEntityCompost) tileentity).getCurrentDisplay().getBlock() != state.getBlock()) {
|
||||||
|
IBlockState iblockstate = ((TileEntityCompost) tileentity).getCurrentDisplay();
|
||||||
|
return Minecraft.getMinecraft().getBlockColors().colorMultiplier(iblockstate, world, pos, tint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(color, InitBlocks.blockCompost);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.recipe;
|
package de.ellpeck.actuallyadditions.mod.recipe;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
@ -17,46 +20,52 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
|
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import net.minecraftforge.oredict.OreIngredient;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public final class EmpowererHandler {
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class EmpowererHandler{
|
|
||||||
|
|
||||||
public static final ArrayList<EmpowererRecipe> MAIN_PAGE_RECIPES = new ArrayList<EmpowererRecipe>();
|
public static final ArrayList<EmpowererRecipe> MAIN_PAGE_RECIPES = new ArrayList<EmpowererRecipe>();
|
||||||
public static EmpowererRecipe recipeEmpoweredCanolaSeed;
|
public static EmpowererRecipe recipeEmpoweredCanolaSeed;
|
||||||
|
|
||||||
public static void init(){
|
public static void init() {
|
||||||
addCrystalEmpowering(TheCrystals.REDSTONE, "dyeRed", new ItemStack(Items.NETHERBRICK), new ItemStack(Items.REDSTONE), new ItemStack(Items.BRICK));
|
addCrystalEmpowering(TheCrystals.REDSTONE, "dyeRed", Ingredient.fromItem(Items.NETHERBRICK), Ingredient.fromItem(Items.REDSTONE), Ingredient.fromItem(Items.BRICK));
|
||||||
addCrystalEmpowering(TheCrystals.LAPIS, "dyeCyan", new ItemStack(Items.PRISMARINE_SHARD), new ItemStack(Items.PRISMARINE_SHARD), new ItemStack(Items.PRISMARINE_SHARD));
|
addCrystalEmpowering(TheCrystals.LAPIS, "dyeCyan", Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_SHARD));
|
||||||
addCrystalEmpowering(TheCrystals.DIAMOND, "dyeLightBlue", new ItemStack(Items.CLAY_BALL), new ItemStack(Items.CLAY_BALL), new ItemStack(Blocks.CLAY));
|
addCrystalEmpowering(TheCrystals.DIAMOND, "dyeLightBlue", Ingredient.fromItem(Items.CLAY_BALL), Ingredient.fromItem(Items.CLAY_BALL), fromBlock(Blocks.CLAY));
|
||||||
addCrystalEmpowering(TheCrystals.IRON, "dyeGray", new ItemStack(Items.SNOWBALL), new ItemStack(Blocks.STONE_BUTTON), new ItemStack(Blocks.COBBLESTONE));
|
addCrystalEmpowering(TheCrystals.IRON, "dyeGray", Ingredient.fromItem(Items.SNOWBALL), fromBlock(Blocks.STONE_BUTTON), fromBlock(Blocks.COBBLESTONE));
|
||||||
|
|
||||||
addCrystalEmpowering(TheCrystals.COAL, "dyeBlack", new ItemStack(Items.COAL, 1, 1), new ItemStack(Items.FLINT), new ItemStack(Blocks.STONE));
|
addCrystalEmpowering(TheCrystals.COAL, "dyeBlack", igd(new ItemStack(Items.COAL, 1, 1)), Ingredient.fromItem(Items.FLINT), fromBlock(Blocks.STONE));
|
||||||
|
|
||||||
List<ItemStack> balls = OreDictionary.getOres("slimeball");
|
List<ItemStack> balls = OreDictionary.getOres("slimeball");
|
||||||
for(ItemStack ball : balls){
|
for (ItemStack ball : balls) {
|
||||||
addCrystalEmpowering(TheCrystals.EMERALD, "dyeLime", new ItemStack(Blocks.TALLGRASS, 1, 1), new ItemStack(Blocks.SAPLING), ball.copy());
|
addCrystalEmpowering(TheCrystals.EMERALD, "dyeLime", igd(new ItemStack(Blocks.TALLGRASS, 1, 1)), igd(new ItemStack(Blocks.SAPLING)), igd(ball.copy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack seed = new ItemStack(InitItems.itemCanolaSeed);
|
Ingredient seed = Ingredient.fromItem(InitItems.itemCanolaSeed);
|
||||||
ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, 1000, 30, new float[]{1F, 91F/255F, 76F/255F});
|
ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal())), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, 1000, 30, new float[] { 1F, 91F / 255F, 76F / 255F });
|
||||||
recipeEmpoweredCanolaSeed = RecipeUtil.lastEmpowererRecipe();
|
recipeEmpoweredCanolaSeed = RecipeUtil.lastEmpowererRecipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addCrystalEmpowering(TheCrystals type, String dye, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3){
|
private static void addCrystalEmpowering(TheCrystals type, String dye, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3) {
|
||||||
float[] color = type.conversionColorParticles;
|
float[] color = type.conversionColorParticles;
|
||||||
|
|
||||||
List<ItemStack> dyes = OreDictionary.getOres(dye);
|
ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemCrystal, 1, type.ordinal())), new ItemStack(InitItems.itemCrystalEmpowered, 1, type.ordinal()), new OreIngredient(dye), modifier1, modifier2, modifier3, 5000, 50, color);
|
||||||
for(ItemStack dyeStack : dyes){
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
||||||
ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemCrystal, 1, type.ordinal()), new ItemStack(InitItems.itemCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, 5000, 50, color);
|
ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitBlocks.blockCrystal, 1, type.ordinal())), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, type.ordinal()), new OreIngredient(dye), modifier1, modifier2, modifier3, 50000, 500, color);
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
||||||
ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitBlocks.blockCrystal, 1, type.ordinal()), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, 50000, 500, color);
|
}
|
||||||
MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
|
||||||
}
|
private static Ingredient igd(ItemStack s) {
|
||||||
|
return Ingredient.fromStacks(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Ingredient fromBlock(Block b) {
|
||||||
|
return Ingredient.fromItem(Item.getItemFromBlock(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@ import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class EnchBookConversion extends LensConversionRecipe {
|
public class EnchBookConversion extends LensConversionRecipe {
|
||||||
|
|
||||||
public EnchBookConversion() {
|
public EnchBookConversion() {
|
||||||
super(new ItemStack(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion);
|
super(Ingredient.fromItem(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,88 +12,110 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class TileEntityCompost extends TileEntityInventoryBase{
|
public class TileEntityCompost extends TileEntityInventoryBase {
|
||||||
|
|
||||||
public static final int COMPOST_TIME_TICKS = 3000;
|
public static final int COMPOST_TIME_TICKS = 3000;
|
||||||
|
|
||||||
public int conversionTime;
|
protected int conversionTime;
|
||||||
|
protected CompostRecipe recipe;
|
||||||
|
|
||||||
public TileEntityCompost(){
|
public TileEntityCompost() {
|
||||||
super(1, "compost");
|
super(1, "compost");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompostRecipe getRecipeForInput(ItemStack input){
|
public static CompostRecipe getRecipeForInput(ItemStack input) {
|
||||||
if(StackUtil.isValid(input)){
|
if (StackUtil.isValid(input)) {
|
||||||
for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
for (CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES) {
|
||||||
if(input.isItemEqual(recipe.input)){
|
if (recipe.matches(input)) return recipe;
|
||||||
return recipe;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
public void writeSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||||
super.writeSyncableNBT(compound, type);
|
super.writeSyncableNBT(compound, type);
|
||||||
if(type != NBTType.SAVE_BLOCK){
|
if (type != NBTType.SAVE_BLOCK) {
|
||||||
compound.setInteger("ConversionTime", this.conversionTime);
|
compound.setInteger("ConversionTime", this.conversionTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSyncSlots(){
|
public boolean shouldSyncSlots() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
public void readSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||||
super.readSyncableNBT(compound, type);
|
super.readSyncableNBT(compound, type);
|
||||||
if(type != NBTType.SAVE_BLOCK){
|
if (type != NBTType.SAVE_BLOCK) {
|
||||||
this.conversionTime = compound.getInteger("ConversionTime");
|
this.conversionTime = compound.getInteger("ConversionTime");
|
||||||
}
|
}
|
||||||
|
if (type == NBTType.SYNC) this.world.markBlockRangeForRenderUpdate(this.pos, this.pos.up());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if(!this.world.isRemote){
|
if (!this.world.isRemote) {
|
||||||
boolean theFlag = this.conversionTime > 0;
|
boolean theFlag = this.conversionTime > 0;
|
||||||
ItemStack input = inv.getStackInSlot(0);
|
ItemStack input = inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(input)){
|
if (StackUtil.isValid(input)) {
|
||||||
CompostRecipe recipe = getRecipeForInput(input);
|
if (recipe == null || !recipe.matches(input)) recipe = getRecipeForInput(input);
|
||||||
if(recipe != null){
|
if (recipe != null) {
|
||||||
this.conversionTime++;
|
this.conversionTime++;
|
||||||
if(this.conversionTime >= COMPOST_TIME_TICKS){
|
if (this.conversionTime >= COMPOST_TIME_TICKS) {
|
||||||
ItemStack output = recipe.output.copy();
|
ItemStack output = recipe.getOutput().copy();
|
||||||
output.setCount(input.getCount());
|
output.setCount(input.getCount());
|
||||||
this.inv.setStackInSlot(0, output);
|
this.inv.setStackInSlot(0, output);
|
||||||
this.conversionTime = 0;
|
this.conversionTime = 0;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
this.conversionTime = 0;
|
this.conversionTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(theFlag != this.conversionTime > 0){
|
if (theFlag != this.conversionTime > 0) {
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsert(int i, ItemStack stack, boolean automation){
|
public boolean canInsert(int i, ItemStack stack, boolean automation) {
|
||||||
return getRecipeForInput(stack) != null;
|
return getRecipeForInput(stack) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtract(int slot, ItemStack stack, boolean automation){
|
public boolean canExtract(int slot, ItemStack stack, boolean automation) {
|
||||||
return getRecipeForInput(stack) == null;
|
return getRecipeForInput(stack) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IBlockState getCurrentDisplay() {
|
||||||
|
ItemStack input = inv.getStackInSlot(0);
|
||||||
|
CompostRecipe displayRecipe = recipe;
|
||||||
|
if (displayRecipe == null || !displayRecipe.matches(input)) displayRecipe = getRecipeForInput(input);
|
||||||
|
|
||||||
|
if (displayRecipe == null) for (CompostRecipe r : ActuallyAdditionsAPI.COMPOST_RECIPES) {
|
||||||
|
if (ItemUtil.areItemsEqual(input, r.getOutput(), true)) return r.getOutputDisplay();
|
||||||
|
else if (r.getInput().apply(input)) return r.getInputDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(displayRecipe != null) return displayRecipe.getInputDisplay();
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getHeight() {
|
||||||
|
ItemStack input = inv.getStackInSlot(0);
|
||||||
|
if (input.isEmpty()) return 0;
|
||||||
|
return (float) input.getCount() / input.getMaxStackSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
@ -100,4 +101,8 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I
|
||||||
public IEnergyStorage getEnergyStorage(EnumFacing facing){
|
public IEnergyStorage getEnergyStorage(EnumFacing facing){
|
||||||
return this.storage;
|
return this.storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack() {
|
||||||
|
return this.inv.getStackInSlot(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,13 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -22,153 +26,143 @@ import net.minecraft.util.EnumParticleTypes;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
|
||||||
|
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int recipeForRenderIndex = -1;
|
public int recipeForRenderIndex = -1;
|
||||||
private int lastRecipe;
|
private int lastRecipe;
|
||||||
|
|
||||||
public TileEntityEmpowerer(){
|
public TileEntityEmpowerer() {
|
||||||
super(1, "empowerer");
|
super(1, "empowerer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EmpowererRecipe> getRecipesForInput(ItemStack input){
|
@Deprecated //Use findMatchingRecipe
|
||||||
|
public static List<EmpowererRecipe> getRecipesForInput(ItemStack input) {
|
||||||
List<EmpowererRecipe> recipesThatWork = new ArrayList<EmpowererRecipe>();
|
List<EmpowererRecipe> recipesThatWork = new ArrayList<EmpowererRecipe>();
|
||||||
if(StackUtil.isValid(input)){
|
if (StackUtil.isValid(input)) {
|
||||||
for(EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES){
|
for (EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
||||||
if(StackUtil.isValid(recipe.input) && recipe.input.isItemEqual(input)){
|
if (recipe.getInput().apply(input)) {
|
||||||
recipesThatWork.add(recipe);
|
recipesThatWork.add(recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return recipesThatWork;
|
return recipesThatWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPossibleInput(ItemStack stack) {
|
||||||
|
for(EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) if(r.getInput().apply(stack)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||||
|
for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
||||||
|
if (r.matches(base, stand1, stand2, stand3, stand4)) return r;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if(!this.world.isRemote){
|
if (!this.world.isRemote) {
|
||||||
List<EmpowererRecipe> recipes = getRecipesForInput(this.inv.getStackInSlot(0));
|
TileEntityDisplayStand[] stands = this.getNearbyStands();
|
||||||
if(!recipes.isEmpty()){
|
if (stands != null) {
|
||||||
for(EmpowererRecipe recipe : recipes){
|
EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack());
|
||||||
TileEntityDisplayStand[] modifierStands = this.getFittingModifiers(recipe, recipe.time);
|
if (recipe != null) {
|
||||||
if(modifierStands != null){ //Meaning the display stands around match all the criteria
|
this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe);
|
||||||
this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe);
|
|
||||||
|
|
||||||
this.processTime++;
|
this.processTime++;
|
||||||
boolean done = this.processTime >= recipe.time;
|
boolean done = this.processTime >= recipe.getTime();
|
||||||
|
|
||||||
for(TileEntityDisplayStand stand : modifierStands){
|
for (TileEntityDisplayStand stand : stands) {
|
||||||
stand.storage.extractEnergyInternal(recipe.energyPerStand/recipe.time, false);
|
stand.storage.extractEnergyInternal(recipe.getEnergyPerStand() / recipe.getTime(), false);
|
||||||
|
|
||||||
if(done){
|
if (done) {
|
||||||
stand.inv.getStackInSlot(0).shrink(1);
|
stand.inv.getStackInSlot(0).shrink(1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.processTime%5 == 0 && this.world instanceof WorldServer){
|
|
||||||
((WorldServer)this.world).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 2, 0, 0, 0, 0.1D);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(done){
|
|
||||||
((WorldServer)this.world).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 100, 0, 0, 0, 0.25D);
|
|
||||||
|
|
||||||
this.inv.setStackInSlot(0, recipe.output.copy());
|
|
||||||
this.markDirty();
|
|
||||||
|
|
||||||
this.processTime = 0;
|
|
||||||
this.recipeForRenderIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.processTime = 0;
|
|
||||||
this.recipeForRenderIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.lastRecipe != this.recipeForRenderIndex){
|
if (this.processTime % 5 == 0 && this.world instanceof WorldServer) {
|
||||||
this.lastRecipe = this.recipeForRenderIndex;
|
((WorldServer) this.world).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 2, 0, 0, 0, 0.1D);
|
||||||
this.sendUpdate();
|
}
|
||||||
|
|
||||||
|
if (done) {
|
||||||
|
((WorldServer) this.world).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D);
|
||||||
|
|
||||||
|
this.inv.setStackInSlot(0, recipe.getOutput().copy());
|
||||||
|
this.markDirty();
|
||||||
|
|
||||||
|
this.processTime = 0;
|
||||||
|
this.recipeForRenderIndex = -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.processTime = 0;
|
||||||
|
this.recipeForRenderIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.lastRecipe != this.recipeForRenderIndex) {
|
||||||
|
this.lastRecipe = this.recipeForRenderIndex;
|
||||||
|
this.sendUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileEntityDisplayStand[] getFittingModifiers(EmpowererRecipe recipe, int powerDivider){
|
private TileEntityDisplayStand[] getNearbyStands() {
|
||||||
TileEntityDisplayStand[] modifierStands = new TileEntityDisplayStand[4];
|
TileEntityDisplayStand[] stands = new TileEntityDisplayStand[4];
|
||||||
List<ItemStack> itemsStillNeeded = new ArrayList<ItemStack>(Arrays.asList(recipe.modifier1, recipe.modifier2, recipe.modifier3, recipe.modifier4));
|
|
||||||
|
|
||||||
for(int i = 0; i < EnumFacing.HORIZONTALS.length; i++){
|
for (int i = 0; i < EnumFacing.HORIZONTALS.length; i++) {
|
||||||
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
||||||
BlockPos offset = this.pos.offset(facing, 3);
|
BlockPos offset = this.pos.offset(facing, 3);
|
||||||
TileEntity tile = this.world.getTileEntity(offset);
|
TileEntity tile = this.world.getTileEntity(offset);
|
||||||
|
if (tile instanceof TileEntityDisplayStand) stands[i] = (TileEntityDisplayStand) tile;
|
||||||
if(tile instanceof TileEntityDisplayStand){
|
else return null;
|
||||||
TileEntityDisplayStand stand = (TileEntityDisplayStand)tile;
|
|
||||||
ItemStack standItem = stand.inv.getStackInSlot(0);
|
|
||||||
int containPlace = ItemUtil.getPlaceAt(itemsStillNeeded, standItem, true);
|
|
||||||
if(stand.storage.getEnergyStored() >= recipe.energyPerStand/powerDivider && containPlace != -1){
|
|
||||||
modifierStands[i] = stand;
|
|
||||||
itemsStillNeeded.remove(containPlace);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifierStands;
|
return stands;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
public void writeSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||||
super.writeSyncableNBT(compound, type);
|
super.writeSyncableNBT(compound, type);
|
||||||
if(type == NBTType.SAVE_TILE){
|
if (type == NBTType.SAVE_TILE) {
|
||||||
compound.setInteger("ProcessTime", this.processTime);
|
compound.setInteger("ProcessTime", this.processTime);
|
||||||
}
|
}
|
||||||
if(type == NBTType.SYNC){
|
if (type == NBTType.SYNC) {
|
||||||
compound.setInteger("RenderIndex", this.recipeForRenderIndex);
|
compound.setInteger("RenderIndex", this.recipeForRenderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
public void readSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||||
super.readSyncableNBT(compound, type);
|
super.readSyncableNBT(compound, type);
|
||||||
if(type == NBTType.SAVE_TILE){
|
if (type == NBTType.SAVE_TILE) {
|
||||||
this.processTime = compound.getInteger("ProcessTime");
|
this.processTime = compound.getInteger("ProcessTime");
|
||||||
}
|
}
|
||||||
if(type == NBTType.SYNC){
|
if (type == NBTType.SYNC) {
|
||||||
this.recipeForRenderIndex = compound.getInteger("RenderIndex");
|
this.recipeForRenderIndex = compound.getInteger("RenderIndex");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSyncSlots(){
|
public boolean shouldSyncSlots() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsert(int index, ItemStack stack, boolean automation){
|
public boolean canInsert(int index, ItemStack stack, boolean automation) {
|
||||||
return !automation || !getRecipesForInput(stack).isEmpty();
|
return !automation || !getRecipesForInput(stack).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtract(int index, ItemStack stack, boolean automation){
|
public boolean canExtract(int index, ItemStack stack, boolean automation) {
|
||||||
return !automation || getRecipesForInput(stack).isEmpty();
|
return !automation || getRecipesForInput(stack).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxStackSize(int slot){
|
public int getMaxStackSize(int slot) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int theSlot = StackUtil.findFirstFilled(this.inv);
|
int theSlot = StackUtil.findFirstFilled(this.inv);
|
||||||
|
if(theSlot == -1) return;
|
||||||
inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, inv.getStackInSlot(theSlot)));
|
inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, inv.getStackInSlot(theSlot)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,25 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.*;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderItem;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
@ -31,13 +38,14 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
public final class AssetUtil{
|
public final class AssetUtil{
|
||||||
|
|
||||||
|
@ -83,6 +91,20 @@ public final class AssetUtil{
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static void renderStateInWorld(IBlockState state, IBlockAccess world, BlockPos pos, float brightness){
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||||
|
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
|
||||||
|
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(state, world, pos, 0);
|
||||||
|
|
||||||
|
float r = (float) (i >> 16 & 255) / 255F;
|
||||||
|
float g = (float) (i >> 8 & 255) / 255F;
|
||||||
|
float b = (float) (i & 255) / 255F;
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(state, model, brightness, r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void renderItemWithoutScrewingWithColors(ItemStack stack){
|
public static void renderItemWithoutScrewingWithColors(ItemStack stack){
|
||||||
|
|
Loading…
Reference in a new issue