mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
chore: porting work, api package ported, micro ports here and there
This commit is contained in:
parent
e0391bbf87
commit
a200f9aa6a
42 changed files with 607 additions and 763 deletions
|
@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.*;
|
import de.ellpeck.actuallyadditions.api.recipe.*;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
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;
|
||||||
|
@ -37,7 +38,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
|
|
||||||
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
||||||
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
||||||
public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
// public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
||||||
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
||||||
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
||||||
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
||||||
|
@ -46,7 +47,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
*/
|
*/
|
||||||
public static final List<IFarmerBehavior> FARMER_BEHAVIORS = new ArrayList<>();
|
public static final List<IFarmerBehavior> FARMER_BEHAVIORS = new ArrayList<>();
|
||||||
public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<>();
|
public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<>();
|
||||||
public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<>();
|
// public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<>();
|
||||||
public static final List<OilGenRecipe> OIL_GENERATOR_RECIPES = new ArrayList<>();
|
public static final List<OilGenRecipe> OIL_GENERATOR_RECIPES = new ArrayList<>();
|
||||||
public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<>();
|
public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<>();
|
||||||
//This is added to automatically, you don't need to add anything to this list
|
//This is added to automatically, you don't need to add anything to this list
|
||||||
|
@ -200,7 +201,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,7 +213,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
* @param outputDisplay The state to display when there is output in the compost
|
* @param outputDisplay The state to display when there is output in the compost
|
||||||
*/
|
*/
|
||||||
public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
// COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,7 +235,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
* @param maxAmount The maximum stacksize of the returned stack
|
* @param maxAmount The maximum stacksize of the returned stack
|
||||||
*/
|
*/
|
||||||
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount) {
|
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount) {
|
||||||
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
// TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IBookletChapter {
|
public interface IBookletChapter {
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import java.util.List;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
|
||||||
|
|
||||||
public interface IBookletEntry {
|
public interface IBookletEntry {
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IBookletPage {
|
public interface IBookletPage {
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public interface IBookletPage {
|
||||||
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void actionPerformed(GuiBookletBase gui, GuiButton button);
|
void actionPerformed(GuiBookletBase gui, Button button);
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void initGui(GuiBookletBase gui, int startX, int startY);
|
void initGui(GuiBookletBase gui, int startX, int startY);
|
||||||
|
|
|
@ -10,19 +10,24 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet.internal;
|
package de.ellpeck.actuallyadditions.api.booklet.internal;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
public abstract class GuiBookletBase extends Screen {
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public abstract class GuiBookletBase extends GuiScreen {
|
protected GuiBookletBase(ITextComponent titleIn) {
|
||||||
|
super(titleIn);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale);
|
public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale);
|
||||||
|
|
||||||
public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length);
|
public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length);
|
||||||
|
|
||||||
public abstract List<GuiButton> getButtonList();
|
public abstract List<Button> getButtonList();
|
||||||
|
|
||||||
public abstract int getGuiLeft();
|
public abstract int getGuiLeft();
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,10 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
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;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
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.potion.PotionEffect;
|
import net.minecraft.potion.EffectInstance;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -31,13 +32,13 @@ public interface IMethodHandler {
|
||||||
|
|
||||||
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
||||||
|
|
||||||
PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect);
|
EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect);
|
||||||
|
|
||||||
void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp);
|
void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp);
|
||||||
|
|
||||||
void addEffectToStack(ItemStack stack, PotionEffect effect);
|
void addEffectToStack(ItemStack stack, EffectInstance effect);
|
||||||
|
|
||||||
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
EffectInstance[] getEffectsFromStack(ItemStack stack);
|
||||||
|
|
||||||
boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
package de.ellpeck.actuallyadditions.api.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.api.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,8 +5,9 @@ public interface IDisableableItem {
|
||||||
/**
|
/**
|
||||||
* Represents an item that can be disabled in the configuration of the mod.
|
* Represents an item that can be disabled in the configuration of the mod.
|
||||||
* If this returns true, assume the item is not registered with the game, but may still be instantiated.
|
* If this returns true, assume the item is not registered with the game, but may still be instantiated.
|
||||||
|
*
|
||||||
* @return If the item has not been registered with the Forge Registry.
|
* @return If the item has not been registered with the Forge Registry.
|
||||||
*/
|
*/
|
||||||
public boolean isDisabled();
|
boolean isDisabled();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,34 +13,34 @@ 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.item.crafting.Ingredient;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.EffectInstance;
|
||||||
|
|
||||||
public class CoffeeIngredient {
|
public class CoffeeIngredient {
|
||||||
|
|
||||||
protected final Ingredient input;
|
protected final Ingredient input;
|
||||||
protected final int maxAmplifier;
|
protected final int maxAmplifier;
|
||||||
protected PotionEffect[] effects;
|
protected EffectInstance[] effects;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public CoffeeIngredient(ItemStack input, PotionEffect[] effects, int maxAmplifier) {
|
public CoffeeIngredient(ItemStack input, EffectInstance[] effects, int maxAmplifier) {
|
||||||
this(Ingredient.fromStacks(input), maxAmplifier, effects);
|
this(Ingredient.fromStacks(input), maxAmplifier, effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoffeeIngredient(Ingredient input, int maxAmplifier, PotionEffect... effects) {
|
public CoffeeIngredient(Ingredient input, int maxAmplifier, EffectInstance... effects) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.effects = effects;
|
this.effects = effects;
|
||||||
this.maxAmplifier = maxAmplifier;
|
this.maxAmplifier = maxAmplifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
public boolean matches(ItemStack stack) {
|
||||||
return this.input.apply(stack);
|
return this.input.test(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getInput() {
|
public Ingredient getInput() {
|
||||||
return this.input;
|
return this.input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PotionEffect[] getEffects() {
|
public EffectInstance[] getEffects() {
|
||||||
return this.effects;
|
return this.effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
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 net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||||
ItemStack newStack = stack.copy();
|
ItemStack newStack = stack.copy();
|
||||||
int meta = newStack.getItemDamage();
|
int meta = newStack.getDamage();
|
||||||
newStack.setItemDamage((meta + 1) % 16);
|
newStack.setDamage((meta + 1) % 16);
|
||||||
return newStack;
|
return newStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +1,56 @@
|
||||||
/*
|
///*
|
||||||
* This file ("CompostRecipe.java") is part of the Actually Additions mod for Minecraft.
|
// * This file ("CompostRecipe.java") is part of the Actually Additions mod for Minecraft.
|
||||||
* It is created and owned by Ellpeck and distributed
|
// * It is created and owned by Ellpeck and distributed
|
||||||
* under the Actually Additions License to be found at
|
// * under the Actually Additions License to be found at
|
||||||
* http://ellpeck.de/actaddlicense
|
// * http://ellpeck.de/actaddlicense
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
*
|
// *
|
||||||
* © 2015-2017 Ellpeck
|
// * © 2015-2017 Ellpeck
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
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.item.ItemStack;
|
//import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
//import net.minecraft.item.crafting.Ingredient;
|
||||||
|
//
|
||||||
public class CompostRecipe {
|
//public class CompostRecipe {
|
||||||
|
//
|
||||||
protected final Ingredient input;
|
// protected final Ingredient input;
|
||||||
protected final ItemStack output;
|
// protected final ItemStack output;
|
||||||
protected final BlockState inputDisplay;
|
// protected final BlockState inputDisplay;
|
||||||
protected final BlockState outputDisplay;
|
// protected final BlockState outputDisplay;
|
||||||
|
//
|
||||||
@Deprecated
|
// @Deprecated
|
||||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
// public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
// this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
// public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState 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) {
|
// public boolean matches(ItemStack stack) {
|
||||||
return this.input.apply(stack);
|
// return this.input.apply(stack);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Ingredient getInput() {
|
// public Ingredient getInput() {
|
||||||
return this.input;
|
// return this.input;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public ItemStack getOutput() {
|
// public ItemStack getOutput() {
|
||||||
return this.output;
|
// return this.output;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public BlockState getInputDisplay() {
|
// public BlockState getInputDisplay() {
|
||||||
return this.inputDisplay;
|
// return this.inputDisplay;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public BlockState getOutputDisplay() {
|
// public BlockState getOutputDisplay() {
|
||||||
return this.outputDisplay;
|
// return this.outputDisplay;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class CrusherRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
public boolean matches(ItemStack stack) {
|
||||||
return this.input.apply(stack);
|
return this.input.test(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getOutputOne() {
|
public ItemStack getOutputOne() {
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EmpowererRecipe {
|
public class EmpowererRecipe {
|
||||||
|
|
||||||
protected final Ingredient input;
|
protected final Ingredient input;
|
||||||
|
@ -48,21 +48,23 @@ public class EmpowererRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||||
if (!this.input.apply(base)) return false;
|
if (!this.input.test(base)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
List<Ingredient> matches = new ArrayList<>();
|
List<Ingredient> matches = new ArrayList<>();
|
||||||
ItemStack[] stacks = { stand1, stand2, stand3, stand4 };
|
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
||||||
boolean[] unused = { true, true, true, true };
|
boolean[] unused = {true, true, true, true};
|
||||||
for (ItemStack s : stacks) {
|
for (ItemStack s : stacks) {
|
||||||
if (unused[0] && this.modifier1.apply(s)) {
|
if (unused[0] && this.modifier1.test(s)) {
|
||||||
matches.add(this.modifier1);
|
matches.add(this.modifier1);
|
||||||
unused[0] = false;
|
unused[0] = false;
|
||||||
} else if (unused[1] && this.modifier2.apply(s)) {
|
} else if (unused[1] && this.modifier2.test(s)) {
|
||||||
matches.add(this.modifier2);
|
matches.add(this.modifier2);
|
||||||
unused[1] = false;
|
unused[1] = false;
|
||||||
} else if (unused[2] && this.modifier3.apply(s)) {
|
} else if (unused[2] && this.modifier3.test(s)) {
|
||||||
matches.add(this.modifier3);
|
matches.add(this.modifier3);
|
||||||
unused[2] = false;
|
unused[2] = false;
|
||||||
} else if (unused[3] && this.modifier4.apply(s)) {
|
} else if (unused[3] && this.modifier4.test(s)) {
|
||||||
matches.add(this.modifier4);
|
matches.add(this.modifier4);
|
||||||
unused[3] = false;
|
unused[3] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
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 net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ 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.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -36,7 +37,7 @@ public class LensConversionRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(ItemStack input, Lens lens) {
|
public boolean matches(ItemStack input, Lens lens) {
|
||||||
return this.input.apply(input) && this.type == lens;
|
return this.input.test(input) && this.type == lens;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getInput() {
|
public Ingredient getInput() {
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
/*
|
///*
|
||||||
* This file ("TreasureChestLoot.java") is part of the Actually Additions mod for Minecraft.
|
// * This file ("TreasureChestLoot.java") is part of the Actually Additions mod for Minecraft.
|
||||||
* It is created and owned by Ellpeck and distributed
|
// * It is created and owned by Ellpeck and distributed
|
||||||
* under the Actually Additions License to be found at
|
// * under the Actually Additions License to be found at
|
||||||
* http://ellpeck.de/actaddlicense
|
// * http://ellpeck.de/actaddlicense
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
*
|
// *
|
||||||
* © 2015-2017 Ellpeck
|
// * © 2015-2017 Ellpeck
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
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.util.WeightedRandom;
|
//import net.minecraft.util.WeightedRandom;
|
||||||
|
//
|
||||||
public class TreasureChestLoot extends WeightedRandom.Item {
|
//public class TreasureChestLoot extends WeightedRandom.Item {
|
||||||
|
//
|
||||||
public final ItemStack returnItem;
|
// public final ItemStack returnItem;
|
||||||
public final int minAmount;
|
// public final int minAmount;
|
||||||
public final int maxAmount;
|
// public final int maxAmount;
|
||||||
|
//
|
||||||
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount) {
|
// public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount) {
|
||||||
super(chance);
|
// super(chance);
|
||||||
this.returnItem = returnItem;
|
// this.returnItem = returnItem;
|
||||||
this.minAmount = minAmount;
|
// this.minAmount = minAmount;
|
||||||
this.maxAmount = maxAmount;
|
// this.maxAmount = maxAmount;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
@ -26,8 +26,6 @@ import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
|
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
||||||
|
@ -70,7 +68,7 @@ public class ActuallyAdditions {
|
||||||
public static final ItemGroup GROUP = new ItemGroup(MODID) {
|
public static final ItemGroup GROUP = new ItemGroup(MODID) {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createIcon() {
|
public ItemStack createIcon() {
|
||||||
return new ItemStack(InitItems.itemBooklet);
|
return new ItemStack(InitItems.itemBooklet.get());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,8 +110,6 @@ public class ActuallyAdditions {
|
||||||
|
|
||||||
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
|
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
|
||||||
|
|
||||||
InitToolMaterials.init();
|
|
||||||
InitArmorMaterials.init();
|
|
||||||
InitFluids.init();
|
InitFluids.init();
|
||||||
new UpdateChecker();
|
new UpdateChecker();
|
||||||
BannerHelper.init();
|
BannerHelper.init();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
|
|
||||||
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(upgrade)) {
|
if (StackUtil.isValid(upgrade)) {
|
||||||
if (upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility) {
|
if (upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility.get()) {
|
||||||
hasInvis = true;
|
hasInvis = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
||||||
if (secondTile instanceof TileEntityLaserRelay) {
|
if (secondTile instanceof TileEntityLaserRelay) {
|
||||||
ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0);
|
ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0);
|
||||||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility.get();
|
||||||
|
|
||||||
if (hasGoggles || !hasInvis || !otherInvis) {
|
if (hasGoggles || !hasInvis || !otherInvis) {
|
||||||
float[] color = hasInvis && otherInvis
|
float[] color = hasInvis && otherInvis
|
||||||
|
|
|
@ -19,95 +19,95 @@ public final class CrusherCrafting {
|
||||||
// public static CrusherRecipe recipeGoldHorseArmor;
|
// public static CrusherRecipe recipeGoldHorseArmor;
|
||||||
// public static CrusherRecipe recipeDiamondHorseArmor;
|
// public static CrusherRecipe recipeDiamondHorseArmor;
|
||||||
//
|
//
|
||||||
// public static void init() {
|
public static void init() {
|
||||||
// ActuallyAdditions.LOGGER.info("Initializing Crusher Recipes...");
|
// ActuallyAdditions.LOGGER.info("Initializing Crusher Recipes...");
|
||||||
//
|
//
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
//
|
//
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
//
|
//
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreRedstone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("oreRedstone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreLapis")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("oreLapis")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("coal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("coal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("oreCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("blockCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("blockCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreQuartz")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("oreQuartz")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0);
|
||||||
// if (!CrusherRecipeRegistry.hasException("cobblestone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0);
|
// if (!CrusherRecipeRegistry.hasException("cobblestone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0);
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
|
||||||
// if (!CrusherRecipeRegistry.hasException("stone")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0);
|
// if (!CrusherRecipeRegistry.hasException("stone")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0);
|
||||||
//
|
//
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
//
|
//
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getEmpty(), 0);
|
||||||
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
// MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||||
//
|
//
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreNickel")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15);
|
// if (!CrusherRecipeRegistry.hasException("oreNickel")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15);
|
||||||
// if (!CrusherRecipeRegistry.hasException("oreIron")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20);
|
// if (!CrusherRecipeRegistry.hasException("oreIron")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20);
|
||||||
//
|
//
|
||||||
// ItemStack temp = getStack("dustIron");
|
// ItemStack temp = getStack("dustIron");
|
||||||
// if (!temp.isEmpty()) {
|
// if (!temp.isEmpty()) {
|
||||||
// temp.setCount(6);
|
// temp.setCount(6);
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.IRON_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.IRON_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
||||||
// recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe();
|
// recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// temp = getStack("dustGold");
|
// temp = getStack("dustGold");
|
||||||
// if (!temp.isEmpty()) {
|
// if (!temp.isEmpty()) {
|
||||||
// temp.setCount(6);
|
// temp.setCount(6);
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.GOLDEN_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.GOLDEN_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
||||||
// recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe();
|
// recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// temp = getStack("dustDiamond");
|
// temp = getStack("dustDiamond");
|
||||||
// if (!temp.isEmpty()) {
|
// if (!temp.isEmpty()) {
|
||||||
// temp.setCount(6);
|
// temp.setCount(6);
|
||||||
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.DIAMOND_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
// ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.DIAMOND_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
|
||||||
// recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe();
|
// recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("denseore", 8));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("denseore", 8));
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("gem", 1));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("gem", 1));
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ingot", 1));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ingot", 1));
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2, "gem")); //Search for gems first so removeDuplicates doesn't clear gem recipes.
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2, "gem")); //Search for gems first so removeDuplicates doesn't clear gem recipes.
|
||||||
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2));
|
// CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2));
|
||||||
//
|
//
|
||||||
// CrusherRecipeRegistry.registerFinally();
|
// CrusherRecipeRegistry.registerFinally();
|
||||||
// }
|
}
|
||||||
//
|
//
|
||||||
// private static ItemStack getStack(String ore) {
|
// private static ItemStack getStack(String ore) {
|
||||||
// List<ItemStack> stacks = OreDictionary.getOres(ore);
|
// List<ItemStack> stacks = OreDictionary.getOres(ore);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -28,7 +28,7 @@ public class RenderWorm extends Render<EntityWorm> {
|
||||||
private static ItemStack stack = ItemStack.EMPTY;
|
private static ItemStack stack = ItemStack.EMPTY;
|
||||||
|
|
||||||
public static void fixItemStack() {
|
public static void fixItemStack() {
|
||||||
stack = new ItemStack(InitItems.itemWorm);
|
stack = new ItemStack(InitItems.itemWorm.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RenderWorm(RenderManager renderManager) {
|
protected RenderWorm(RenderManager renderManager) {
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class CommonEvents {
|
||||||
//checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
|
//checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
|
||||||
|
|
||||||
if (ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()) {
|
if (ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()) {
|
||||||
if (!event.getPlayer().world.isRemote && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != InitItems.itemBooklet) {
|
if (!event.getPlayer().world.isRemote && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != InitItems.itemBooklet.get()) {
|
||||||
|
|
||||||
String name = event.getCrafting().getItem().getRegistryName().toString();
|
String name = event.getCrafting().getItem().getRegistryName().toString();
|
||||||
if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
||||||
|
@ -172,7 +172,7 @@ public class CommonEvents {
|
||||||
save.bookGottenAlready = true;
|
save.bookGottenAlready = true;
|
||||||
WorldData.get(event.getPlayer().getEntityWorld()).markDirty();
|
WorldData.get(event.getPlayer().getEntityWorld()).markDirty();
|
||||||
|
|
||||||
ItemEntity entityItem = new ItemEntity(event.getPlayer().world, event.getPlayer().getPosX(), event.getPlayer().getPosY(), event.getPlayer().getPosZ(), new ItemStack(InitItems.itemBooklet));
|
ItemEntity entityItem = new ItemEntity(event.getPlayer().world, event.getPlayer().getPosX(), event.getPlayer().getPosY(), event.getPlayer().getPosZ(), new ItemStack(InitItems.itemBooklet.get()));
|
||||||
entityItem.setPickupDelay(0);
|
entityItem.setPickupDelay(0);
|
||||||
event.getPlayer().world.addEntity(entityItem);
|
event.getPlayer().world.addEntity(entityItem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,17 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemArmor;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
public class ContainerEnergizer extends Container {
|
public class ContainerEnergizer extends Container {
|
||||||
|
|
||||||
public static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[]{EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
|
public static final EquipmentSlotType[] VALID_EQUIPMENT_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET};
|
||||||
private final TileEntityEnergizer energizer;
|
private final TileEntityEnergizer energizer;
|
||||||
|
|
||||||
public ContainerEnergizer(PlayerEntity player, TileEntityBase tile) {
|
public ContainerEnergizer(PlayerEntity player, TileEntityBase tile) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ContainerFarmer extends Container {
|
public class ContainerFarmer extends Container {
|
||||||
|
@ -29,22 +29,22 @@ public class ContainerFarmer extends Container {
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.farmer.inv, j + i * 2, 67 + j * 18, 21 + i * 18));
|
this.addSlot(new SlotItemHandlerUnconditioned(this.farmer.inv, j + i * 2, 67 + j * 18, 21 + i * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.farmer.inv, 6 + j + i * 2, 105 + j * 18, 21 + i * 18));
|
this.addSlot(new SlotItemHandlerUnconditioned(this.farmer.inv, 6 + j + i * 2, 105 + j * 18, 21 + i * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
|
this.addSlot(new Slot(inventory, i, 8 + i * 18, 155));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,8 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
|
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
|
||||||
import de.ellpeck.actuallyadditions.mod.material.ToolMaterials;
|
import de.ellpeck.actuallyadditions.mod.material.ToolMaterials;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.init.MobEffects;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemTier;
|
import net.minecraft.item.ItemTier;
|
||||||
import net.minecraft.potion.PotionEffect;
|
|
||||||
import net.minecraft.tileentity.TileEntityChest;
|
|
||||||
import net.minecraftforge.fml.RegistryObject;
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
@ -47,51 +41,47 @@ public final class InitItems {
|
||||||
public static final RegistryObject<Item> ENORI_CRYSTAL_SHARD = ITEMS.register("item_enori_crystal_shard", ItemBase::new);
|
public static final RegistryObject<Item> ENORI_CRYSTAL_SHARD = ITEMS.register("item_enori_crystal_shard", ItemBase::new);
|
||||||
|
|
||||||
// CRYSTALS
|
// CRYSTALS
|
||||||
public static final RegistryObject<Item> RESTONIA_CRYSTAL = ITEMS.register("restonia_crystal", ItemBase::new);
|
public static final RegistryObject<Item> RESTONIA_CRYSTAL = ITEMS.register("restonia_crystal", ItemCrystal::new);
|
||||||
public static final RegistryObject<Item> PALIS_CRYSTAL = ITEMS.register("palis_crystal", ItemBase::new);
|
public static final RegistryObject<Item> PALIS_CRYSTAL = ITEMS.register("palis_crystal", ItemCrystal::new);
|
||||||
public static final RegistryObject<Item> DIAMATINE_CRYSTAL = ITEMS.register("diamatine_crystal", ItemBase::new);
|
public static final RegistryObject<Item> DIAMATINE_CRYSTAL = ITEMS.register("diamatine_crystal", ItemCrystal::new);
|
||||||
public static final RegistryObject<Item> VOID_CRYSTAL = ITEMS.register("void_crystal", ItemBase::new);
|
public static final RegistryObject<Item> VOID_CRYSTAL = ITEMS.register("void_crystal", ItemCrystal::new);
|
||||||
public static final RegistryObject<Item> EMERADIC_CRYSTAL = ITEMS.register("emeradic_crystal", ItemBase::new);
|
public static final RegistryObject<Item> EMERADIC_CRYSTAL = ITEMS.register("emeradic_crystal", ItemCrystal::new);
|
||||||
public static final RegistryObject<Item> ENORI_CRYSTAL = ITEMS.register("enori_crystal", ItemBase::new);
|
public static final RegistryObject<Item> ENORI_CRYSTAL = ITEMS.register("enori_crystal", ItemCrystal::new);
|
||||||
|
|
||||||
public static final RegistryObject<Item> RESTONIA_EMPOWERED_CRYSTAL = ITEMS.register("restonia_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> RESTONIA_EMPOWERED_CRYSTAL = ITEMS.register("restonia_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
public static final RegistryObject<Item> PALIS_EMPOWERED_CRYSTAL = ITEMS.register("palis_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> PALIS_EMPOWERED_CRYSTAL = ITEMS.register("palis_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
public static final RegistryObject<Item> DIAMATINE_EMPOWERED_CRYSTAL = ITEMS.register("diamatine_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> DIAMATINE_EMPOWERED_CRYSTAL = ITEMS.register("diamatine_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
public static final RegistryObject<Item> VOID_EMPOWERED_CRYSTAL = ITEMS.register("void_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> VOID_EMPOWERED_CRYSTAL = ITEMS.register("void_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
public static final RegistryObject<Item> EMERADIC_EMPOWERED_CRYSTAL = ITEMS.register("emeradic_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> EMERADIC_EMPOWERED_CRYSTAL = ITEMS.register("emeradic_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
public static final RegistryObject<Item> ENORI_EMPOWERED_CRYSTAL = ITEMS.register("enori_empowered_crystal", ItemBase::new);
|
public static final RegistryObject<Item> ENORI_EMPOWERED_CRYSTAL = ITEMS.register("enori_empowered_crystal", () -> new ItemCrystal(true));
|
||||||
|
|
||||||
// BLACK QUARTZ
|
// BLACK QUARTZ
|
||||||
public static final RegistryObject<Item> BLACK_QUARTZ = ITEMS.register("black_quartz", ItemBase::new));
|
public static final RegistryObject<Item> BLACK_QUARTZ = ITEMS.register("black_quartz", ItemBase::new);
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static final RegistryObject<Item> itemCrystal = ITEMS.register("", new ItemCrystal("item_crystal", false));
|
|
||||||
@Deprecated
|
|
||||||
public static final RegistryObject<Item> itemCrystalEmpowered = ITEMS.register("", new ItemCrystal("item_crystal_empowered", true));
|
|
||||||
|
|
||||||
public static final RegistryObject<Item> itemEngineerGogglesAdvanced = ITEMS.register("", new ItemEngineerGoggles("item_engineer_goggles_advanced", true));
|
public static final RegistryObject<Item> itemEngineerGogglesAdvanced = ITEMS.register("item_engineer_goggles_advanced", () -> new ItemEngineerGoggles(true));
|
||||||
public static final RegistryObject<Item> itemEngineerGoggles = ITEMS.register("", new ItemEngineerGoggles("item_engineer_goggles", false));
|
public static final RegistryObject<Item> itemEngineerGoggles = ITEMS.register("item_engineer_goggles", () -> new ItemEngineerGoggles(false));
|
||||||
public static final RegistryObject<Item> itemLaserUpgradeRange = ITEMS.register("item_laser_upgrade_range", ItemLaserRelayUpgrade::new);
|
public static final RegistryObject<Item> itemLaserUpgradeRange = ITEMS.register("item_laser_upgrade_range", ItemBase::new);
|
||||||
public static final RegistryObject<Item> itemLaserUpgradeInvisibility = ITEMS.register("item_laser_upgrade_invisibility", ItemLaserRelayUpgrade::new);
|
public static final RegistryObject<Item> itemLaserUpgradeInvisibility = ITEMS.register("item_laser_upgrade_invisibility", ItemBase::new);
|
||||||
public static final RegistryObject<Item> itemFillingWand = ITEMS.register("item_filling_wand", ItemFillingWand::new);
|
public static final RegistryObject<Item> itemFillingWand = ITEMS.register("item_filling_wand", ItemFillingWand::new);
|
||||||
public static final RegistryObject<Item> itemBag = ITEMS.register("", new ItemBag("item_bag", false));
|
public static final RegistryObject<Item> itemBag = ITEMS.register("item_bag", () -> new ItemBag(false));
|
||||||
public static final RegistryObject<Item> itemVoidBag = ITEMS.register("", new ItemBag("item_void_bag", true));
|
public static final RegistryObject<Item> itemVoidBag = ITEMS.register("item_void_bag", () -> new ItemBag(true));
|
||||||
public static final RegistryObject<Item> itemWorm = ITEMS.register("item_worm", ItemWorm::new);
|
public static final RegistryObject<Item> itemWorm = ITEMS.register("item_worm", ItemWorm::new);
|
||||||
public static final RegistryObject<Item> itemPlayerProbe = ITEMS.register("item_player_probe", ItemPlayerProbe::new);
|
public static final RegistryObject<Item> itemPlayerProbe = ITEMS.register("item_player_probe", ItemPlayerProbe::new);
|
||||||
public static final RegistryObject<Item> itemFilter = ITEMS.register("item_filter", ItemFilter::new);
|
public static final RegistryObject<Item> itemFilter = ITEMS.register("item_filter", ItemFilter::new);
|
||||||
public static final RegistryObject<Item> itemWaterBowl = ITEMS.register("item_water_bowl", ItemWaterBowl::new);
|
public static final RegistryObject<Item> itemWaterBowl = ITEMS.register("item_water_bowl", ItemWaterBowl::new);
|
||||||
public static final RegistryObject<Item> itemSpawnerChanger = ITEMS.register("item_spawner_changer", ItemSpawnerChanger::new);
|
public static final RegistryObject<Item> itemSpawnerChanger = ITEMS.register("item_spawner_changer", ItemSpawnerChanger::new);
|
||||||
public static final RegistryObject<Item> itemCrateKeeper = ITEMS.register("item_crate_keeper", ItemGeneric::new.setMaxStackSize(1));
|
public static final RegistryObject<Item> itemCrateKeeper = ITEMS.register("item_crate_keeper", () -> new ItemGeneric(defaultProps().maxStackSize(1)));
|
||||||
public static final RegistryObject<Item> itemColorLens = ITEMS.register("", new ItemLens("item_color_lens", ActuallyAdditionsAPI.lensColor));
|
public static final RegistryObject<Item> itemColorLens = ITEMS.register("item_color_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensColor));
|
||||||
public static final RegistryObject<Item> itemExplosionLens = ITEMS.register("", new ItemLens("item_explosion_lens", ActuallyAdditionsAPI.lensDetonation));
|
public static final RegistryObject<Item> itemExplosionLens = ITEMS.register("item_explosion_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensDetonation));
|
||||||
public static final RegistryObject<Item> itemDamageLens = ITEMS.register("", new ItemLens("item_damage_lens", ActuallyAdditionsAPI.lensDeath));
|
public static final RegistryObject<Item> itemDamageLens = ITEMS.register("item_damage_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensDeath));
|
||||||
public static final RegistryObject<Item> itemMoreDamageLens = ITEMS.register("", new ItemLens("item_more_damage_lens", ActuallyAdditionsAPI.lensEvenMoarDeath));
|
public static final RegistryObject<Item> itemMoreDamageLens = ITEMS.register("item_more_damage_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensEvenMoarDeath));
|
||||||
public static final RegistryObject<Item> itemDisenchantingLens = ITEMS.register("", new ItemLens("item_disenchanting_lens", ActuallyAdditionsAPI.lensDisenchanting));
|
public static final RegistryObject<Item> itemDisenchantingLens = ITEMS.register("item_disenchanting_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensDisenchanting));
|
||||||
public static final RegistryObject<Item> itemMiningLens = ITEMS.register("", new ItemLens("item_mining_lens", ActuallyAdditionsAPI.lensMining));
|
public static final RegistryObject<Item> itemMiningLens = ITEMS.register("item_mining_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensMining));
|
||||||
public static final RegistryObject<Item> itemLaserWrench = ITEMS.register("item_laser_wrench", ItemLaserWrench::new);
|
public static final RegistryObject<Item> itemLaserWrench = ITEMS.register("item_laser_wrench", ItemLaserWrench::new);
|
||||||
public static final RegistryObject<Item> itemChestToCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_chest_to_crate_upgrade", TileEntityChest.class, InitBlocks.blockGiantChest.getDefaultState()));
|
// public static final RegistryObject<Item> itemChestToCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_chest_to_crate_upgrade", TileEntityChest.class, InitBlocks.blockGiantChest.getDefaultState()));
|
||||||
public static final RegistryObject<Item> itemSmallToMediumCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_small_to_medium_crate_upgrade", TileEntityGiantChest.class, InitBlocks.blockGiantChestMedium.getDefaultState()));
|
// public static final RegistryObject<Item> itemSmallToMediumCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_small_to_medium_crate_upgrade", TileEntityGiantChest.class, InitBlocks.blockGiantChestMedium.getDefaultState()));
|
||||||
public static final RegistryObject<Item> itemMediumToLargeCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_medium_to_large_crate_upgrade", TileEntityGiantChestMedium.class, InitBlocks.blockGiantChestLarge.getDefaultState()));
|
// public static final RegistryObject<Item> itemMediumToLargeCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("item_medium_to_large_crate_upgrade", TileEntityGiantChestMedium.class, InitBlocks.blockGiantChestLarge.getDefaultState()));
|
||||||
public static final RegistryObject<Item> itemBooklet = ITEMS.register("item_booklet", ItemBooklet::new);
|
public static final RegistryObject<Item> itemBooklet = ITEMS.register("item_booklet", ItemBooklet::new);
|
||||||
public static final RegistryObject<Item> itemGrowthRing = ITEMS.register("item_growth_ring", ItemGrowthRing::new);
|
public static final RegistryObject<Item> itemGrowthRing = ITEMS.register("item_growth_ring", ItemGrowthRing::new);
|
||||||
public static final RegistryObject<Item> itemMagnetRing = ITEMS.register("item_suction_ring", ItemMagnetRing::new);
|
public static final RegistryObject<Item> itemMagnetRing = ITEMS.register("item_suction_ring", ItemMagnetRing::new);
|
||||||
|
|
|
@ -10,97 +10,99 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler.GuiTypes;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemBag extends ItemBase {
|
public class ItemBag extends ItemBase {
|
||||||
|
|
||||||
public final boolean isVoid;
|
public final boolean isVoid;
|
||||||
|
|
||||||
public ItemBag(String name, boolean isVoid) {
|
public ItemBag(boolean isVoid) {
|
||||||
super(name);
|
super(InitItems.defaultProps().maxStackSize(1));
|
||||||
this.isVoid = isVoid;
|
this.isVoid = isVoid;
|
||||||
this.setMaxStackSize(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
ItemStack stack = playerIn.getHeldItem(hand);
|
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
||||||
if (!this.isVoid) {
|
if (!this.isVoid) {
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = context.getWorld().getTileEntity(context.getPos());
|
||||||
if (tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)) {
|
if (tile != null) {
|
||||||
if (!worldIn.isRemote) {
|
if (!context.getWorld().isRemote) {
|
||||||
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing);
|
ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerBag.getSlotAmount(this.isVoid));
|
||||||
if (handler != null) {
|
|
||||||
boolean changed = false;
|
|
||||||
|
|
||||||
ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerBag.getSlotAmount(this.isVoid));
|
boolean changed = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, context.getFace())
|
||||||
ItemDrill.loadSlotsFromNBT(inv, stack);
|
.map(cap -> {
|
||||||
|
boolean localChanged = false;
|
||||||
|
ItemDrill.loadSlotsFromNBT(inv, stack);
|
||||||
|
|
||||||
for (int j = 0; j < inv.getSlots(); j++) {
|
for (int j = 0; j < inv.getSlots(); j++) {
|
||||||
ItemStack invStack = inv.getStackInSlot(j);
|
ItemStack invStack = inv.getStackInSlot(j);
|
||||||
if (StackUtil.isValid(invStack)) {
|
if (StackUtil.isValid(invStack)) {
|
||||||
for (int i = 0; i < handler.getSlots(); i++) {
|
for (int i = 0; i < cap.getSlots(); i++) {
|
||||||
ItemStack remain = handler.insertItem(i, invStack, false);
|
ItemStack remain = cap.insertItem(i, invStack, false);
|
||||||
if (!ItemStack.areItemStacksEqual(remain, invStack)) {
|
if (!ItemStack.areItemStacksEqual(remain, invStack)) {
|
||||||
inv.setStackInSlot(j, remain.copy());
|
inv.setStackInSlot(j, remain.copy());
|
||||||
changed = true;
|
localChanged = true;
|
||||||
if (!StackUtil.isValid(remain)) {
|
if (!StackUtil.isValid(remain)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
invStack = remain;
|
||||||
}
|
}
|
||||||
invStack = remain;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (changed) {
|
return localChanged;
|
||||||
ItemDrill.writeSlotsToNBT(inv, stack);
|
}).orElse(false);
|
||||||
}
|
|
||||||
|
if (changed) {
|
||||||
|
ItemDrill.writeSlotsToNBT(inv, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||||
if (!world.isRemote && hand == Hand.MAIN_HAND) {
|
if (!world.isRemote && hand == Hand.MAIN_HAND) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, (this.isVoid
|
NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> new ContainerBag(windowId, playerInventory, playerEntity.getHeldItem(hand), this.isVoid), StringTextComponent.EMPTY));
|
||||||
? GuiTypes.VOID_BAG
|
// player.openGui(ActuallyAdditions.INSTANCE, (this.isVoid
|
||||||
: GuiTypes.BAG).ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
|
// ? GuiTypes.VOID_BAG
|
||||||
|
// : GuiTypes.BAG).ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||||
}
|
}
|
||||||
return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand));
|
return ActionResult.resultPass(player.getHeldItem(hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: [port] confirm this is correct
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
public CompoundNBT getShareTag(ItemStack stack) {
|
||||||
return this.isVoid
|
return new CompoundNBT();
|
||||||
? EnumRarity.RARE
|
|
||||||
: EnumRarity.UNCOMMON;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public CompoundNBT getNBTShareTag(ItemStack stack) {
|
// public CompoundNBT getNBTShareTag(ItemStack stack) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,18 +26,16 @@ import net.minecraft.client.MainWindow;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.EnumActionResult;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -47,28 +45,26 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static IBookletPage forcedPage;
|
public static IBookletPage forcedPage;
|
||||||
|
|
||||||
public ItemBooklet(String name) {
|
public ItemBooklet() {
|
||||||
super(name);
|
super(InitItems.defaultProps().maxStackSize(1));
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction face, float hitX, float hitY, float hitZ) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
if (player.isSneaking()) {
|
if (context.getPlayer().isSneaking()) {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = context.getWorld().getBlockState(context.getPos());
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
ItemStack blockStack = new ItemStack(block, 1, block.damageDropped(state));
|
ItemStack blockStack = new ItemStack(block);
|
||||||
IBookletPage page = BookletUtils.findFirstPageForStack(blockStack);
|
IBookletPage page = BookletUtils.findFirstPageForStack(blockStack);
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
if (world.isRemote) {
|
if (context.getWorld().isRemote) {
|
||||||
forcedPage = page;
|
forcedPage = page;
|
||||||
}
|
}
|
||||||
this.onItemRightClick(world, player, hand);
|
this.onItemRightClick(context.getWorld(), context.getPlayer(), context.getHand());
|
||||||
return EnumActionResult.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.FAIL;
|
return ActionResultType.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,11 +90,6 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) {
|
public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) {
|
||||||
|
@ -117,7 +108,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
|
||||||
|
|
||||||
AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack())
|
AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack())
|
||||||
? page.getChapter().getDisplayItemStack()
|
? page.getChapter().getDisplayItemStack()
|
||||||
: new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth() / 2 - 10, height + 41, 1F);
|
: new ItemStack(InitItems.itemBooklet.get()), resolution.getScaledWidth() / 2 - 10, height + 41, 1F);
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + strg3, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + strg3, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
|
|
|
@ -10,33 +10,19 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystal;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
|
||||||
|
|
||||||
public class ItemCrystal extends ItemBase {
|
public class ItemCrystal extends ItemBase {
|
||||||
|
|
||||||
private final boolean isEmpowered;
|
private final boolean isEmpowered;
|
||||||
|
|
||||||
public ItemCrystal(String name, boolean isEmpowered) {
|
public ItemCrystal(boolean isEmpowered) {
|
||||||
super(name);
|
super();
|
||||||
this.isEmpowered = isEmpowered;
|
this.isEmpowered = isEmpowered;
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public ItemCrystal() {
|
||||||
public int getMetadata(int damage) {
|
this.isEmpowered = false;
|
||||||
return damage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,31 +30,10 @@ public class ItemCrystal extends ItemBase {
|
||||||
return this.isEmpowered;
|
return this.isEmpowered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String getTranslationKey(ItemStack stack) {
|
// public String getTranslationKey(ItemStack stack) {
|
||||||
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
|
// return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length
|
||||||
}
|
// ? StringUtil.BUGGED_ITEM_NAME
|
||||||
|
// : this.getTranslationKey() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
|
||||||
@Override
|
// }
|
||||||
public IRarity getForgeRarity(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? EnumRarity.COMMON : BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
if (this.isInCreativeTab(tab)) {
|
|
||||||
for (int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++) {
|
|
||||||
list.add(new ItemStack(this, 1, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void registerRendering() {
|
|
||||||
for (int i = 0; i < BlockCrystal.ALL_CRYSTALS.length; i++) {
|
|
||||||
String name = this.getRegistryName() + "_" + BlockCrystal.ALL_CRYSTALS[i].name;
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(name), "inventory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,25 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.misc.IGoggles;
|
import de.ellpeck.actuallyadditions.api.misc.IGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
|
|
||||||
|
@ -36,10 +36,9 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
|
|
||||||
private final boolean displayMobs;
|
private final boolean displayMobs;
|
||||||
|
|
||||||
public ItemEngineerGoggles(String name, boolean displayMobs) {
|
public ItemEngineerGoggles(boolean displayMobs) {
|
||||||
super(name, InitArmorMaterials.armorMaterialGoggles, 0, StackUtil.getEmpty());
|
super(ArmorMaterials.GOGGLES, EquipmentSlotType.HEAD, InitItems.defaultProps().setNoRepair().maxDamage(0));
|
||||||
this.displayMobs = displayMobs;
|
this.displayMobs = displayMobs;
|
||||||
this.setMaxDamage(0);
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
@ -51,13 +50,13 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||||
PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer();
|
PlayerEntity player = ClientProxy.getCurrentPlayer();
|
||||||
if (player != null && isWearing(player)) {
|
if (player != null && isWearing(player)) {
|
||||||
ItemStack face = player.inventory.armorInventory.get(3);
|
ItemStack face = player.inventory.armorInventory.get(3);
|
||||||
if (((IGoggles) face.getItem()).displaySpectralMobs()) {
|
if (((IGoggles) face.getItem()).displaySpectralMobs()) {
|
||||||
double range = 8;
|
double range = 8;
|
||||||
AxisAlignedBB aabb = new AxisAlignedBB(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range);
|
AxisAlignedBB aabb = new AxisAlignedBB(player.getPosX() - range, player.getPosY() - range, player.getPosZ() - range, player.getPosX() + range, player.getPosY() + range, player.getPosZ() + range);
|
||||||
List<Entity> entities = player.world.getEntitiesWithinAABB(Entity.class, aabb);
|
List<Entity> entities = player.world.getEntitiesWithinAABB(Entity.class, aabb);
|
||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
this.cachedGlowingEntities.addAll(entities);
|
this.cachedGlowingEntities.addAll(entities);
|
||||||
|
@ -65,7 +64,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
|
|
||||||
if (!this.cachedGlowingEntities.isEmpty()) {
|
if (!this.cachedGlowingEntities.isEmpty()) {
|
||||||
for (Entity entity : this.cachedGlowingEntities) {
|
for (Entity entity : this.cachedGlowingEntities) {
|
||||||
if (entity.isDead || entity.getDistanceSq(player.posX, player.posY, player.posZ) > range * range) {
|
if (!entity.isAlive() || entity.getDistanceSq(player.getPosX(), player.getPosY(), player.getPosZ()) > range * range) {
|
||||||
entity.setGlowing(false);
|
entity.setGlowing(false);
|
||||||
|
|
||||||
this.cachedGlowingEntities.remove(entity);
|
this.cachedGlowingEntities.remove(entity);
|
||||||
|
@ -81,7 +80,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
|
|
||||||
if (!this.cachedGlowingEntities.isEmpty()) {
|
if (!this.cachedGlowingEntities.isEmpty()) {
|
||||||
for (Entity entity : this.cachedGlowingEntities) {
|
for (Entity entity : this.cachedGlowingEntities) {
|
||||||
if (!entity.isDead) {
|
if (entity.isAlive()) {
|
||||||
entity.setGlowing(false);
|
entity.setGlowing(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,11 +88,6 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean displaySpectralMobs() {
|
public boolean displaySpectralMobs() {
|
||||||
return this.displayMobs;
|
return this.displayMobs;
|
||||||
|
|
|
@ -10,41 +10,43 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Help;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.text.IFormattableTextComponent;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ItemFillingWand extends ItemEnergy {
|
public class ItemFillingWand extends ItemEnergy {
|
||||||
|
|
||||||
public ItemFillingWand(String name) {
|
public ItemFillingWand() {
|
||||||
super(500000, 1000, name);
|
super(500000, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean removeFittingItem(BlockState state, PlayerEntity player) {
|
private static boolean removeFittingItem(BlockState state, PlayerEntity player) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
ItemStack stack = new ItemStack(block, 1, block.damageDropped(state));
|
ItemStack stack = new ItemStack(block, 1);
|
||||||
|
|
||||||
if (StackUtil.isValid(stack)) {
|
if (StackUtil.isValid(stack)) {
|
||||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||||
|
@ -63,63 +65,56 @@ public class ItemFillingWand extends ItemEnergy {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void saveData(ItemStack pickBlock, BlockState state, ItemStack wand) {
|
private static void saveData(BlockState state, ItemStack wand) {
|
||||||
if (!wand.hasTagCompound()) {
|
wand.getOrCreateTag().put("state", NBTUtil.writeBlockState(state));
|
||||||
wand.setTagCompound(new CompoundNBT());
|
|
||||||
}
|
|
||||||
wand.getTagCompound().setInteger("state", Block.getStateId(state));
|
|
||||||
wand.getTagCompound().setString("name", pickBlock.getDisplayName());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Pair<BlockState, String> loadData(ItemStack stack) {
|
private static Optional<BlockState> loadData(ItemStack stack) {
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.getOrCreateTag().contains("state")) {
|
||||||
return Pair.of(Block.getStateById(stack.getTagCompound().getInteger("state")), stack.getTagCompound().getString("name"));
|
return Optional.of(NBTUtil.readBlockState(stack.getOrCreateTag().getCompound("state")));
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
if (context.getPlayer() == null) {
|
||||||
if (!world.isRemote && player.getItemInUseCount() <= 0) {
|
return ActionResultType.PASS;
|
||||||
if (player.isSneaking()) {
|
}
|
||||||
BlockState state = world.getBlockState(pos);
|
|
||||||
ItemStack pick = state.getBlock().getPickBlock(state, world.rayTraceBlocks(player.getPositionVector(), new Vec3d(pos.getX() + hitX, pos.getY() + hitY, pos.getZ() + hitZ)), world, pos, player);
|
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
||||||
saveData(pick, state, stack);
|
if (!context.getWorld().isRemote && context.getPlayer().getItemInUseCount() <= 0) {
|
||||||
return EnumActionResult.SUCCESS;
|
if (context.getPlayer().isSneaking()) {
|
||||||
} else if (loadData(stack) != null) {
|
BlockState state = context.getWorld().getBlockState(context.getPos());
|
||||||
if (!stack.hasTagCompound()) {
|
saveData(state, stack);
|
||||||
stack.setTagCompound(new CompoundNBT());
|
return ActionResultType.SUCCESS;
|
||||||
}
|
} else if (loadData(stack).isPresent()) {
|
||||||
CompoundNBT compound = stack.getTagCompound();
|
CompoundNBT compound = stack.getOrCreateTag();
|
||||||
|
|
||||||
if (compound.getInt("CurrX") == 0 && compound.getInt("CurrY") == 0 && compound.getInt("CurrZ") == 0) {
|
if (compound.getInt("CurrX") == 0 && compound.getInt("CurrY") == 0 && compound.getInt("CurrZ") == 0) {
|
||||||
compound.putInt("FirstX", pos.getX());
|
compound.putInt("FirstX", context.getPos().getX());
|
||||||
compound.putInt("FirstY", pos.getY());
|
compound.putInt("FirstY", context.getPos().getY());
|
||||||
compound.putInt("FirstZ", pos.getZ());
|
compound.putInt("FirstZ", context.getPos().getZ());
|
||||||
|
|
||||||
player.setActiveHand(hand);
|
context.getPlayer().setActiveHand(context.getHand());
|
||||||
return EnumActionResult.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.PASS;
|
return super.onItemUse(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entity, int timeLeft) {
|
public void onPlayerStoppedUsing(ItemStack stack, World world, LivingEntity entity, int timeLeft) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
boolean clear = true;
|
boolean clear = true;
|
||||||
if (entity instanceof PlayerEntity) {
|
if (entity instanceof PlayerEntity) {
|
||||||
RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (PlayerEntity) entity);
|
RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (PlayerEntity) entity);
|
||||||
if (result != null && result.getBlockPos() != null) {
|
if (result instanceof BlockRayTraceResult) {
|
||||||
if (!stack.hasTagCompound()) {
|
CompoundNBT compound = stack.getOrCreateTag();
|
||||||
stack.setTagCompound(new CompoundNBT());
|
|
||||||
}
|
|
||||||
CompoundNBT compound = stack.getTagCompound();
|
|
||||||
|
|
||||||
BlockPos pos = result.getBlockPos();
|
BlockPos pos = ((BlockRayTraceResult) result).getPos();
|
||||||
compound.putInt("SecondX", pos.getX());
|
compound.putInt("SecondX", pos.getX());
|
||||||
compound.putInt("SecondY", pos.getY());
|
compound.putInt("SecondY", pos.getY());
|
||||||
compound.putInt("SecondZ", pos.getZ());
|
compound.putInt("SecondZ", pos.getZ());
|
||||||
|
@ -137,28 +132,29 @@ public class ItemFillingWand extends ItemEnergy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
|
public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||||
super.onUpdate(stack, world, entity, itemSlot, isSelected);
|
super.inventoryTick(stack, world, entity, itemSlot, isSelected);
|
||||||
|
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
boolean shouldClear = false;
|
boolean shouldClear = false;
|
||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
if (entity instanceof PlayerEntity && stack.hasTagCompound()) {
|
if (entity instanceof PlayerEntity && stack.hasTag()) {
|
||||||
PlayerEntity player = (PlayerEntity) entity;
|
PlayerEntity player = (PlayerEntity) entity;
|
||||||
boolean creative = player.capabilities.isCreativeMode;
|
boolean creative = player.isCreative();
|
||||||
|
|
||||||
CompoundNBT compound = stack.getTagCompound();
|
CompoundNBT compound = stack.getOrCreateTag();
|
||||||
|
|
||||||
BlockPos firstPos = new BlockPos(compound.getInt("FirstX"), compound.getInt("FirstY"), compound.getInt("FirstZ"));
|
BlockPos firstPos = new BlockPos(compound.getInt("FirstX"), compound.getInt("FirstY"), compound.getInt("FirstZ"));
|
||||||
BlockPos secondPos = new BlockPos(compound.getInt("SecondX"), compound.getInt("SecondY"), compound.getInt("SecondZ"));
|
BlockPos secondPos = new BlockPos(compound.getInt("SecondX"), compound.getInt("SecondY"), compound.getInt("SecondZ"));
|
||||||
|
|
||||||
if (!BlockPos.ORIGIN.equals(firstPos) && !BlockPos.ORIGIN.equals(secondPos)) {
|
if (!BlockPos.ZERO.equals(firstPos) && !BlockPos.ZERO.equals(secondPos)) {
|
||||||
int energyUse = 1500;
|
int energyUse = 1500;
|
||||||
|
|
||||||
Pair<BlockState, String> data = loadData(stack);
|
Optional<BlockState> data = loadData(stack);
|
||||||
if (data != null && (creative || this.getEnergyStored(stack) >= energyUse)) {
|
if (data.isPresent() && (creative || this.getEnergyStored(stack) >= energyUse)) {
|
||||||
BlockState replaceState = data.getLeft();
|
BlockState replaceState = data.get(); // not the best way to do this.
|
||||||
int lowestX = Math.min(firstPos.getX(), secondPos.getX());
|
int lowestX = Math.min(firstPos.getX(), secondPos.getX());
|
||||||
int lowestY = Math.min(firstPos.getY(), secondPos.getY());
|
int lowestY = Math.min(firstPos.getY(), secondPos.getY());
|
||||||
int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ());
|
int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ());
|
||||||
|
@ -170,7 +166,7 @@ public class ItemFillingWand extends ItemEnergy {
|
||||||
BlockPos pos = new BlockPos(lowestX + currX, lowestY + currY, lowestZ + currZ);
|
BlockPos pos = new BlockPos(lowestX + currX, lowestY + currY, lowestZ + currZ);
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
if (state.getBlock().isReplaceable(world, pos) && replaceState.getBlock().canPlaceBlockAt(world, pos)) {
|
if (state.getMaterial().isReplaceable() && replaceState.isValidPosition(world, pos)) {
|
||||||
if (creative || removeFittingItem(replaceState, player)) {
|
if (creative || removeFittingItem(replaceState, player)) {
|
||||||
world.setBlockState(pos, replaceState, 2);
|
world.setBlockState(pos, replaceState, 2);
|
||||||
|
|
||||||
|
@ -223,26 +219,18 @@ public class ItemFillingWand extends ItemEnergy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||||
|
|
||||||
String display = StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".item_filling_wand.selectedBlock.none");
|
IFormattableTextComponent display = loadData(stack)
|
||||||
|
.map(state -> state.getBlock().getTranslatedName())
|
||||||
|
.orElse(Help.Trans("tooltip", "item_filling_wand.selectedBlock.none"));
|
||||||
|
|
||||||
Pair<BlockState, String> data = loadData(stack);
|
tooltip.add(Help.Trans("tooltip", "item_filling_wand.selectedBlock", display.getString()));
|
||||||
if (data != null) {
|
|
||||||
display = data.getRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
tooltip.add(String.format("%s: %s", StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".item_filling_wand.selectedBlock"), display));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxItemUseDuration(ItemStack stack) {
|
public int getUseDuration(ItemStack stack) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,9 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class ItemLaserRelayUpgrade extends ItemBase {
|
public class ItemLaserRelayUpgrade extends ItemBase {
|
||||||
|
public ItemLaserRelayUpgrade() {
|
||||||
public ItemLaserRelayUpgrade(String name) {
|
super();
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,93 +10,76 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import net.minecraft.block.BlockGrass;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemWorm extends ItemBase {
|
public class ItemWorm extends ItemBase {
|
||||||
|
|
||||||
public ItemWorm(String name) {
|
public ItemWorm() {
|
||||||
super(name);
|
super();
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
this.addPropertyOverride(new ResourceLocation(ActuallyAdditions.MODID, "snail"), new IItemPropertyGetter() {
|
// TODO: [port] Not sure what this does
|
||||||
@Override
|
// this.addPropertyOverride(new ResourceLocation(ActuallyAdditions.MODID, "snail"), (IItemPropertyGetter) (stack, world, entity) -> "snail mail".equalsIgnoreCase(stack.getDisplayName().getString())
|
||||||
@OnlyIn(Dist.CLIENT)
|
// ? 1F
|
||||||
public float apply(ItemStack stack, World world, EntityLivingBase entity) {
|
// : 0F);
|
||||||
return "snail mail".equalsIgnoreCase(stack.getDisplayName())
|
|
||||||
? 1F
|
|
||||||
: 0F;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float par8, float par9, float par10) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
BlockPos pos = context.getPos();
|
||||||
BlockState state = world.getBlockState(pos);
|
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
||||||
if (EntityWorm.canWormify(world, pos, state)) {
|
BlockState state = context.getWorld().getBlockState(pos);
|
||||||
List<EntityWorm> worms = world.getEntitiesWithinAABB(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2));
|
if (EntityWorm.canWormify(context.getWorld(), context.getPos(), state)) {
|
||||||
if (worms == null || worms.isEmpty()) {
|
List<EntityWorm> worms = context.getWorld().getEntitiesWithinAABB(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2));
|
||||||
if (!world.isRemote) {
|
if (worms.isEmpty()) {
|
||||||
EntityWorm worm = new EntityWorm(world);
|
if (!context.getWorld().isRemote) {
|
||||||
|
EntityWorm worm = new EntityWorm(context.getWorld());
|
||||||
worm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
worm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||||
worm.setCustomNameTag(stack.getDisplayName());
|
worm.setCustomName(stack.getDisplayName()); // TODO: WHAT DOES THIS EVEN DO?
|
||||||
world.spawnEntity(worm);
|
context.getWorld().addEntity(worm);
|
||||||
if (!player.capabilities.isCreativeMode) {
|
if (!context.getPlayer().isCreative()) {
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.onItemUse(player, world, pos, hand, side, par8, par9, par10);
|
return super.onItemUse(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOW)
|
@SubscribeEvent(priority = EventPriority.LOW)
|
||||||
public void onHoe(UseHoeEvent event) {
|
public void onHoe(UseHoeEvent event) {
|
||||||
if (ConfigBoolValues.WORMS.isEnabled() && event.getResult() != Result.DENY) {
|
if (ConfigBoolValues.WORMS.isEnabled() && event.getResult() != Event.Result.DENY) {
|
||||||
World world = event.getWorld();
|
World world = event.getEntity().world;
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
BlockPos pos = event.getPos();
|
BlockPos pos = event.getContext().getPos();
|
||||||
if (world.isAirBlock(pos.up())) {
|
if (world.isAirBlock(pos.up())) {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F) {
|
if (state.getBlock() == Blocks.GRASS && world.rand.nextFloat() >= 0.95F) {
|
||||||
ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2) + 1);
|
ItemStack stack = new ItemStack(InitItems.itemWorm.get(), world.rand.nextInt(2) + 1);
|
||||||
EntityItem item = new EntityItem(event.getWorld(), pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, stack);
|
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, stack);
|
||||||
world.spawnEntity(item);
|
world.addEntity(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,61 +11,22 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.item.ArmorItem;
|
import net.minecraft.item.ArmorItem;
|
||||||
import net.minecraft.item.IArmorMaterial;
|
import net.minecraft.item.IArmorMaterial;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public class ItemArmorAA extends ArmorItem implements IDisableableItem {
|
public class ItemArmorAA extends ArmorItem implements IDisableableItem {
|
||||||
|
|
||||||
private final ItemStack repairItem;
|
|
||||||
private final String name;
|
|
||||||
private final IRarity rarity;
|
|
||||||
private final boolean disabled;
|
private final boolean disabled;
|
||||||
|
|
||||||
public ItemArmorAA(IArmorMaterial material, int type) {
|
public ItemArmorAA(IArmorMaterial material, EquipmentSlotType type) {
|
||||||
super(material, 0, ContainerEnergizer.VALID_EQUIPMENT_SLOTS[type]);
|
this(material, type, InitItems.defaultProps());
|
||||||
this.repairItem = this.repairItem;
|
|
||||||
this.name = this.name;
|
|
||||||
this.rarity = this.rarity;
|
|
||||||
this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) + ". It will not be registered.");
|
|
||||||
if (!this.disabled) {
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register() {
|
public ItemArmorAA(IArmorMaterial material, EquipmentSlotType type, Properties properties) {
|
||||||
ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
|
super(material, type, properties);
|
||||||
|
this.disabled = false;
|
||||||
this.registerRendering();
|
// this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) + ". It will not be registered.");
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBaseName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void registerRendering() {
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IRarity getForgeRarity(ItemStack stack) {
|
|
||||||
return this.rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) {
|
|
||||||
return StackUtil.isValid(this.repairItem) && ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,25 +10,30 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.resources.I18n;
|
import de.ellpeck.actuallyadditions.mod.util.Help;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -38,29 +43,32 @@ public abstract class ItemEnergy extends ItemBase {
|
||||||
private final int maxPower;
|
private final int maxPower;
|
||||||
private final int transfer;
|
private final int transfer;
|
||||||
|
|
||||||
public ItemEnergy(int maxPower, int transfer, String name) {
|
public ItemEnergy(int maxPower, int transfer) {
|
||||||
super(name);
|
super(InitItems.defaultProps().maxStackSize(1));
|
||||||
this.maxPower = maxPower;
|
this.maxPower = maxPower;
|
||||||
this.transfer = transfer;
|
this.transfer = transfer;
|
||||||
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxStackSize(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: [port] make sure this is right
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public boolean getShareTag() {
|
public CompoundNBT getShareTag(ItemStack stack) {
|
||||||
return true;
|
return new CompoundNBT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public boolean getShareTag() {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(storage -> {
|
||||||
if (storage != null) {
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
tooltip.add(Help.Trans("misc", "power_long", format.format(storage.getEnergyStored()), format.format(storage.getMaxEnergyStored())));
|
||||||
tooltip.add(String.format("%s/%s %s", format.format(storage.getEnergyStored()), format.format(storage.getMaxEnergyStored()), I18n.format("actuallyadditions.cflong")));
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,21 +78,15 @@ public abstract class ItemEnergy extends ItemBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list) {
|
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||||
if (this.isInCreativeTab(tabs)) {
|
super.fillItemGroup(group, items);
|
||||||
ItemStack stackFull = new ItemStack(this);
|
if (!this.isInGroup(group)) {
|
||||||
if (stackFull.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return;
|
||||||
IEnergyStorage storage = stackFull.getCapability(CapabilityEnergy.ENERGY, null);
|
|
||||||
if (storage != null) {
|
|
||||||
this.setEnergy(stackFull, storage.getMaxEnergyStored());
|
|
||||||
list.add(stackFull);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stackEmpty = new ItemStack(this);
|
|
||||||
this.setEnergy(stackEmpty, 0);
|
|
||||||
list.add(stackEmpty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack charged = new ItemStack(this);
|
||||||
|
charged.getOrCreateTag().putDouble("Energy", this.getMaxEnergyStored(charged));
|
||||||
|
items.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,94 +96,79 @@ public abstract class ItemEnergy extends ItemBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack) {
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return stack.getCapability(CapabilityEnergy.ENERGY, null)
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
.map(cap -> {
|
||||||
if (storage != null) {
|
double maxAmount = cap.getMaxEnergyStored();
|
||||||
double maxAmount = storage.getMaxEnergyStored();
|
double energyDif = maxAmount - cap.getEnergyStored();
|
||||||
double energyDif = maxAmount - storage.getEnergyStored();
|
|
||||||
return energyDif / maxAmount;
|
return energyDif / maxAmount;
|
||||||
}
|
})
|
||||||
}
|
.orElse(super.getDurabilityForDisplay(stack));
|
||||||
return super.getDurabilityForDisplay(stack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRGBDurabilityForDisplay(ItemStack stack) {
|
public int getRGBDurabilityForDisplay(ItemStack stack) {
|
||||||
PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer();
|
PlayerEntity player = ClientProxy.getCurrentPlayer();
|
||||||
if (player != null && player.world != null) {
|
if (player != null && player.world != null) {
|
||||||
float[] color = AssetUtil.getWheelColor(player.world.getTotalWorldTime() % 256);
|
float[] color = AssetUtil.getWheelColor(player.world.getGameTime() % 256);
|
||||||
return MathHelper.rgb(color[0] / 255F, color[1] / 255F, color[2] / 255F);
|
return MathHelper.rgb(color[0] / 255F, color[1] / 255F, color[2] / 255F);
|
||||||
}
|
}
|
||||||
return super.getRGBDurabilityForDisplay(stack);
|
return super.getRGBDurabilityForDisplay(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergy(ItemStack stack, int energy) {
|
public void setEnergy(ItemStack stack, int energy) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(cap -> {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
if (cap instanceof CustomEnergyStorage) {
|
||||||
if (storage instanceof CustomEnergyStorage) {
|
((CustomEnergyStorage) cap).setEnergyStored(energy);
|
||||||
((CustomEnergyStorage) storage).setEnergyStored(energy);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public int receiveEnergyInternal(ItemStack stack, int maxReceive, boolean simulate) {
|
public int receiveEnergyInternal(ItemStack stack, int maxReceive, boolean simulate) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
// if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
// IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||||
if (storage instanceof CustomEnergyStorage) {
|
// if (storage instanceof CustomEnergyStorage) {
|
||||||
((CustomEnergyStorage) storage).receiveEnergyInternal(maxReceive, simulate);
|
// ((CustomEnergyStorage) storage).receiveEnergyInternal(maxReceive, simulate);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int extractEnergyInternal(ItemStack stack, int maxExtract, boolean simulate) {
|
public int extractEnergyInternal(ItemStack stack, int maxExtract, boolean simulate) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return stack.getCapability(CapabilityEnergy.ENERGY)
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
.map(cap -> cap instanceof CustomEnergyStorage
|
||||||
if (storage instanceof CustomEnergyStorage) {
|
? ((CustomEnergyStorage) cap).extractEnergyInternal(maxExtract, simulate)
|
||||||
((CustomEnergyStorage) storage).extractEnergyInternal(maxExtract, simulate);
|
: 0)
|
||||||
}
|
.orElse(0);
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public int receiveEnergy(ItemStack stack, int maxReceive, boolean simulate) {
|
public int receiveEnergy(ItemStack stack, int maxReceive, boolean simulate) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
// if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
// IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||||
if (storage != null) {
|
// if (storage != null) {
|
||||||
return storage.receiveEnergy(maxReceive, simulate);
|
// return storage.receiveEnergy(maxReceive, simulate);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int extractEnergy(ItemStack stack, int maxExtract, boolean simulate) {
|
public int extractEnergy(ItemStack stack, int maxExtract, boolean simulate) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return stack.getCapability(CapabilityEnergy.ENERGY)
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
.map(cap -> cap.extractEnergy(maxExtract, simulate))
|
||||||
if (storage != null) {
|
.orElse(0);
|
||||||
return storage.extractEnergy(maxExtract, simulate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnergyStored(ItemStack stack) {
|
public int getEnergyStored(ItemStack stack) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return stack.getCapability(CapabilityEnergy.ENERGY, null)
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
.map(IEnergyStorage::getEnergyStored)
|
||||||
if (storage != null) {
|
.orElse(0);
|
||||||
return storage.getEnergyStored();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxEnergyStored(ItemStack stack) {
|
public int getMaxEnergyStored(ItemStack stack) {
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
return stack.getCapability(CapabilityEnergy.ENERGY, null)
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
.map(IEnergyStorage::getMaxEnergyStored)
|
||||||
if (storage != null) {
|
.orElse(0);
|
||||||
return storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -192,41 +179,30 @@ public abstract class ItemEnergy extends ItemBase {
|
||||||
private static class EnergyCapabilityProvider implements ICapabilityProvider {
|
private static class EnergyCapabilityProvider implements ICapabilityProvider {
|
||||||
|
|
||||||
public final CustomEnergyStorage storage;
|
public final CustomEnergyStorage storage;
|
||||||
|
private final LazyOptional<CustomEnergyStorage> energyCapability;
|
||||||
|
|
||||||
public EnergyCapabilityProvider(ItemStack stack, ItemEnergy item) {
|
public EnergyCapabilityProvider(ItemStack stack, ItemEnergy item) {
|
||||||
this.storage = new CustomEnergyStorage(item.maxPower, item.transfer, item.transfer) {
|
this.storage = new CustomEnergyStorage(item.maxPower, item.transfer, item.transfer) {
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyStored() {
|
public int getEnergyStored() {
|
||||||
if (stack.hasTagCompound()) {
|
return stack.getOrCreateTag().getInt("Energy");
|
||||||
return stack.getTagCompound().getInteger("Energy");
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnergyStored(int energy) {
|
public void setEnergyStored(int energy) {
|
||||||
if (!stack.hasTagCompound()) {
|
stack.getOrCreateTag().putInt("Energy", energy);
|
||||||
stack.setTagCompound(new CompoundNBT());
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.getTagCompound().setInteger("Energy", energy);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
this.energyCapability = LazyOptional.of(() -> this.storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, Direction facing) {
|
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||||
return this.getCapability(capability, facing) != null;
|
if (cap == CapabilityEnergy.ENERGY) {
|
||||||
}
|
return this.energyCapability.cast();
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public <T> T getCapability(Capability<T> capability, Direction facing) {
|
|
||||||
if (capability == CapabilityEnergy.ENERGY) {
|
|
||||||
return CapabilityEnergy.ENERGY.cast(this.storage);
|
|
||||||
}
|
}
|
||||||
return null;
|
return LazyOptional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,23 +12,16 @@ package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class ItemLens extends ItemBase implements ILensItem {
|
public class ItemLens extends ItemBase implements ILensItem {
|
||||||
|
|
||||||
private final Lens type;
|
private final Lens type;
|
||||||
|
|
||||||
public ItemLens(String name, Lens type) {
|
public ItemLens(Lens type) {
|
||||||
super(name);
|
super(InitItems.defaultProps().maxStackSize(1));
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.setMaxStackSize(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,11 +12,7 @@ package de.ellpeck.actuallyadditions.mod.jei;
|
||||||
|
|
||||||
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.*;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
|
||||||
|
@ -36,13 +32,10 @@ import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeWrapper;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory;
|
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeWrapper;
|
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeWrapper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import mezz.jei.api.IJeiHelpers;
|
|
||||||
import mezz.jei.api.IModPlugin;
|
import mezz.jei.api.IModPlugin;
|
||||||
import mezz.jei.api.IModRegistry;
|
import mezz.jei.api.constants.VanillaRecipeCategoryUid;
|
||||||
import mezz.jei.api.JEIPlugin;
|
import mezz.jei.api.helpers.IJeiHelpers;
|
||||||
import mezz.jei.api.ingredients.IIngredientBlacklist;
|
import mezz.jei.api.registration.IRecipeCategoryRegistration;
|
||||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
|
||||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
@JEIPlugin
|
@JEIPlugin
|
||||||
|
@ -78,22 +71,22 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
|
||||||
registry.addRecipeClickArea(GuiFurnaceDouble.class, 51, 40, 74, 22, VanillaRecipeCategoryUid.SMELTING);
|
registry.addRecipeClickArea(GuiFurnaceDouble.class, 51, 40, 74, 22, VanillaRecipeCategoryUid.SMELTING);
|
||||||
|
|
||||||
IIngredientBlacklist blacklist = helpers.getIngredientBlacklist();
|
IIngredientBlacklist blacklist = helpers.getIngredientBlacklist();
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockRice));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockRice.get()));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCanola));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCanola.get()));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockFlax));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockFlax.get()));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCoffee));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockCoffee.get()));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockWildPlant.get(), 1, Util.WILDCARD));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn.get(), 1, Util.WILDCARD));
|
||||||
blacklist.addIngredientToBlacklist(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()));
|
blacklist.addIngredientToBlacklist(new ItemStack(InitItems.itemMisc.get(), 1, TheMiscItems.YOUTUBE_ICON.ordinal()));
|
||||||
|
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitItems.itemCrafterOnAStick), VanillaRecipeCategoryUid.CRAFTING);
|
registry.addRecipeCatalyst(new ItemStack(InitItems.itemCrafterOnAStick.get()), VanillaRecipeCategoryUid.CRAFTING);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockFurnaceDouble), VanillaRecipeCategoryUid.SMELTING);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockFurnaceDouble.get()), VanillaRecipeCategoryUid.SMELTING);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinder), CrusherRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinderDouble), CrusherRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockGrinderDouble.get()), CrusherRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCoffeeMachine), CoffeeMachineRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCoffeeMachine.get()), CoffeeMachineRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockAtomicReconstructor), ReconstructorRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockAtomicReconstructor.get()), ReconstructorRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockEmpowerer), EmpowererRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockEmpowerer.get()), EmpowererRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitItems.itemBooklet), BookletRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitItems.itemBooklet.get()), BookletRecipeCategory.NAME);
|
||||||
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCompost), CompostRecipeCategory.NAME);
|
registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCompost.get()), CompostRecipeCategory.NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ public enum ArmorMaterials implements IArmorMaterial {
|
||||||
DIAMATINE("diamatine_armor_material", 36, new int[]{4, 7, 8, 4}, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(InitItems.DIAMATINE_CRYSTAL.get())),
|
DIAMATINE("diamatine_armor_material", 36, new int[]{4, 7, 8, 4}, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(InitItems.DIAMATINE_CRYSTAL.get())),
|
||||||
VOID("void_armor_material", 23, new int[]{1, 3, 4, 1}, 13, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(InitItems.VOID_CRYSTAL.get())),
|
VOID("void_armor_material", 23, new int[]{1, 3, 4, 1}, 13, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(InitItems.VOID_CRYSTAL.get())),
|
||||||
EMERADIC("emeradic_armor_material", 32, new int[]{6, 9, 9, 4}, 18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(InitItems.EMERADIC_CRYSTAL.get())),
|
EMERADIC("emeradic_armor_material", 32, new int[]{6, 9, 9, 4}, 18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(InitItems.EMERADIC_CRYSTAL.get())),
|
||||||
ENORI("enori_armor_material", 24, new int[]{3, 6, 6, 3}, 11, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(InitItems.ENORI_CRYSTAL.get()));
|
ENORI("enori_armor_material", 24, new int[]{3, 6, 6, 3}, 11, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(InitItems.ENORI_CRYSTAL.get())),
|
||||||
|
GOGGLES("goggles_armor_material", 0, new int[]{0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.EMPTY);
|
||||||
|
|
||||||
// HMMM Tasty stolen code from MC, how lovely.
|
// HMMM Tasty stolen code from MC, how lovely.
|
||||||
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
||||||
|
|
|
@ -10,21 +10,21 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.misc;
|
package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.BannerPattern;
|
import net.minecraft.tileentity.BannerPattern;
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public final class BannerHelper {
|
public final class BannerHelper {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
addCraftingPattern("drill", new ItemStack(InitItems.itemDrill, 1, 3));
|
addCraftingPattern("drill", new ItemStack(InitItems.itemDrill.get(), 1, 3));
|
||||||
addCraftingPattern("leaf_blo", new ItemStack(InitItems.itemLeafBlower));
|
addCraftingPattern("leaf_blo", new ItemStack(InitItems.itemLeafBlower.get()));
|
||||||
addCraftingPattern("phan_con", new ItemStack(InitItems.itemPhantomConnector));
|
addCraftingPattern("phan_con", new ItemStack(InitItems.itemPhantomConnector.get()));
|
||||||
addCraftingPattern("book", new ItemStack(InitItems.itemBooklet));
|
addCraftingPattern("book", new ItemStack(InitItems.itemBooklet.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,8 @@ public final class BannerHelper {
|
||||||
* pattern.
|
* pattern.
|
||||||
*/
|
*/
|
||||||
public static void addCraftingPattern(String name, ItemStack craftingStack) {
|
public static void addCraftingPattern(String name, ItemStack craftingStack) {
|
||||||
Class<?>[] paramTypes = { String.class, String.class, ItemStack.class };
|
Class<?>[] paramTypes = {String.class, String.class, ItemStack.class};
|
||||||
Object[] paramValues = { ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack };
|
Object[] paramValues = {ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack};
|
||||||
EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues);
|
EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.proxy;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -82,7 +82,7 @@ public class ClientProxy {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerEntity getCurrentPlayer() {
|
public static ClientPlayerEntity getCurrentPlayer() {
|
||||||
return Minecraft.getInstance().player;
|
return Minecraft.getInstance().player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -184,6 +185,6 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) {
|
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) {
|
||||||
return new;
|
return new ContainerBioReactor(windowId, playerInventory, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
|
||||||
|
|
||||||
public int getMaxRange() {
|
public int getMaxRange() {
|
||||||
ItemStack upgrade = this.inv.getStackInSlot(0);
|
ItemStack upgrade = this.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(upgrade) && upgrade.getItem() == InitItems.itemLaserUpgradeRange) {
|
if (StackUtil.isValid(upgrade) && upgrade.getItem() == InitItems.itemLaserUpgradeRange.get()) {
|
||||||
return MAX_DISTANCE_RANGED;
|
return MAX_DISTANCE_RANGED;
|
||||||
} else {
|
} else {
|
||||||
return MAX_DISTANCE;
|
return MAX_DISTANCE;
|
||||||
|
|
|
@ -6,6 +6,7 @@ tooltip.actuallyadditions.disabled=Disabled Object
|
||||||
actuallyadditions.cft=CF/t
|
actuallyadditions.cft=CF/t
|
||||||
actuallyadditions.cf=CF
|
actuallyadditions.cf=CF
|
||||||
actuallyadditions.cflong=Crystal Flux
|
actuallyadditions.cflong=Crystal Flux
|
||||||
|
misc.actuallyadditions.power_long=%s/%s Crystal Flux
|
||||||
|
|
||||||
#Fluids
|
#Fluids
|
||||||
fluid.actuallyadditions.refinedcanolaoil=Refined Canola Oil
|
fluid.actuallyadditions.refinedcanolaoil=Refined Canola Oil
|
||||||
|
@ -586,7 +587,7 @@ tooltip.actuallyadditions.battery.changeMode=Sneak-right-click to toggle.
|
||||||
tooltip.actuallyadditions.previouslyDoubleFurnace=Previously "Double Furnace"
|
tooltip.actuallyadditions.previouslyDoubleFurnace=Previously "Double Furnace"
|
||||||
tooltip.actuallyadditions.previouslyBag=Previously "Bag"
|
tooltip.actuallyadditions.previouslyBag=Previously "Bag"
|
||||||
tooltip.actuallyadditions.previouslyVoidBag=Previously "Void Bag"
|
tooltip.actuallyadditions.previouslyVoidBag=Previously "Void Bag"
|
||||||
tooltip.actuallyadditions.item_filling_wand.selectedBlock=Selected Block
|
tooltip.actuallyadditions.item_filling_wand.selectedBlock=Selected Block:
|
||||||
tooltip.actuallyadditions.item_filling_wand.selectedBlock.none=None
|
tooltip.actuallyadditions.item_filling_wand.selectedBlock.none=None
|
||||||
tooltip.actuallyadditions.coffeeCup.noEffect=No Effects
|
tooltip.actuallyadditions.coffeeCup.noEffect=No Effects
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue