mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Deleted all the codes...
This commit is contained in:
parent
3e61998ca8
commit
bbea6ba4d8
481 changed files with 0 additions and 44184 deletions
|
@ -1,318 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||
import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.*;
|
||||
import de.ellpeck.actuallyadditions.common.recipes.CrusherRecipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class ActuallyAdditionsAPI {
|
||||
|
||||
public static final String MOD_ID = "actuallyadditions";
|
||||
public static final String API_ID = MOD_ID + "api";
|
||||
public static final String API_VERSION = "34";
|
||||
|
||||
public static final IForgeRegistry<Lens> LENS_REGISTRY = new RegistryBuilder<Lens>().disableSync().disableSaving().disableOverrides().create();
|
||||
|
||||
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<TreasureChestLoot> TREASURE_CHEST_LOOT = 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 Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
||||
/**
|
||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
||||
*/
|
||||
public static final List<IFarmerBehavior> FARMER_BEHAVIORS = 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<OilGenRecipe> OIL_GENERATOR_RECIPES = 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
|
||||
public static final List<IBookletChapter> ALL_CHAPTERS = new ArrayList<>();
|
||||
//This is added to automatically, you don't need to add anything to this list
|
||||
public static final List<IBookletPage> BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA = new ArrayList<>();
|
||||
public static final List<WeightedOre> STONE_ORES = new ArrayList<>();
|
||||
public static final List<WeightedOre> NETHERRACK_ORES = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Use this to handle things that aren't based in the API itself
|
||||
* DO NOT CHANGE/OVERRIDE THIS!!
|
||||
* This is getting initialized in Actually Additions' PreInit phase
|
||||
*/
|
||||
public static IMethodHandler methodHandler;
|
||||
|
||||
/**
|
||||
* Use this to add, remove or get Laser Relay Connections and Networks
|
||||
* The network system is built in a way that doesn't need the individual
|
||||
* positions to be Laser Relays, it relies only on BlockPos
|
||||
* DO NOT CHANGE/OVERRIDE THIS!!
|
||||
* This is getting initialized in Actually Additions' PreInit phase
|
||||
*/
|
||||
public static ILaserRelayConnectionHandler connectionHandler;
|
||||
|
||||
//These are getting initialized in Actually Additions' PreInit phase
|
||||
//DO NOT CHANGE/OVERRIDE THESE!!
|
||||
public static IBookletEntry entryGettingStarted;
|
||||
public static IBookletEntry entryReconstruction;
|
||||
public static IBookletEntry entryLaserRelays;
|
||||
public static IBookletEntry entryFunctionalNonRF;
|
||||
public static IBookletEntry entryFunctionalRF;
|
||||
public static IBookletEntry entryGeneratingRF;
|
||||
public static IBookletEntry entryItemsNonRF;
|
||||
public static IBookletEntry entryItemsRF;
|
||||
public static IBookletEntry entryMisc;
|
||||
public static IBookletEntry entryUpdatesAndInfos;
|
||||
//This is added to automatically, you don't need to add anything to this entry
|
||||
public static IBookletEntry entryAllAndSearch;
|
||||
public static IBookletEntry entryTrials;
|
||||
|
||||
//These are getting initialized in Actually Additions' PreInit phase
|
||||
//DO NOT CHANGE/OVERRIDE THESE!!
|
||||
public static LensConversion lensDefaultConversion;
|
||||
public static Lens lensDetonation;
|
||||
public static Lens lensDeath;
|
||||
public static Lens lensEvenMoarDeath;
|
||||
public static Lens lensColor;
|
||||
public static Lens lensDisruption;
|
||||
public static Lens lensDisenchanting;
|
||||
public static Lens lensMining;
|
||||
|
||||
/**
|
||||
* Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of stone.
|
||||
* Higher weight means higher occurence.
|
||||
*
|
||||
* @param oreName The ore's name
|
||||
* @param weight The ore's weight
|
||||
*/
|
||||
public static void addMiningLensStoneOre(String oreName, int weight) {
|
||||
STONE_ORES.add(new WeightedOre(oreName, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of netherrack.
|
||||
* Higher weight means higher occurence.
|
||||
*
|
||||
* @param oreName The ore's name
|
||||
* @param weight The ore's weight
|
||||
*/
|
||||
public static void addMiningLensNetherOre(String oreName, int weight) {
|
||||
NETHERRACK_ORES.add(new WeightedOre(oreName, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Recipe to the Crusher Recipe Registry
|
||||
*
|
||||
* @param input The input as an ItemStack
|
||||
* @param outputOne The first output as an ItemStack
|
||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||
*/
|
||||
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||
CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Recipe to the Crusher Recipe Registry
|
||||
*
|
||||
* @param input The input as an Ingredient
|
||||
* @param outputOne The first output as an ItemStack
|
||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||
*/
|
||||
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds multiple Recipes to the Crusher Recipe Registry
|
||||
* Use this if you want to add OreDictionary recipes easier
|
||||
*
|
||||
* @param inputs The inputs as an ItemStack List, stacksizes are ignored
|
||||
* @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored
|
||||
* @param outputOneAmounts The amount of the first output, will be equal for all entries in the list
|
||||
* @param outputTwos The second outputs as a List (can be null or empty if there should be none)
|
||||
* @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list
|
||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||
*/
|
||||
public static boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
|
||||
return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance);
|
||||
}
|
||||
|
||||
//Same thing as above, but with ItemStack outputs.
|
||||
@Deprecated //Use Ingredient
|
||||
public static boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) {
|
||||
return methodHandler.addCrusherRecipes(inputs, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Recipe to the Oil generator
|
||||
*
|
||||
* @param fluidName The name of the fluid to be consumed
|
||||
* @param genAmount The amount of energy generated per operation
|
||||
*/
|
||||
public static void addOilGenRecipe(String fluidName, int genAmount) {
|
||||
addOilGenRecipe(fluidName, genAmount, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Recipe to the Oil generator
|
||||
*
|
||||
* @param fluidName The name of the fluid to be consumed
|
||||
* @param genAmount The amount of energy generated per operation
|
||||
*/
|
||||
public static void addOilGenRecipe(String fluidName, int genAmount, int genTime) {
|
||||
OIL_GENERATOR_RECIPES.add(new OilGenRecipe(fluidName, genAmount, genTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new conversion recipe to the compost.
|
||||
*
|
||||
* @param input The itemstack to be input into the compost
|
||||
* @param inputDisplay The block to display when there is input in the compost
|
||||
* @param output The itemstack to be output from the compost once conversion finishes
|
||||
* @param outputDisplay The block to display when there is output in the compost
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new conversion recipe to the compost.
|
||||
*
|
||||
* @param input The ingredient to be input into the compost
|
||||
* @param inputDisplay The state to display when there is input in the compost
|
||||
* @param output The itemstack to be output from the compost once conversion finishes
|
||||
* @param outputDisplay The state to display when there is output in the compost
|
||||
*/
|
||||
public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur
|
||||
*
|
||||
* @param stack The ItemStack to be returned
|
||||
* @param chance The chance (this is from WeightedRandom.Item)
|
||||
*/
|
||||
public static void addBallOfFurReturnItem(ItemStack stack, int chance) {
|
||||
BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the list of possible items to be returned when opening a Treasure Chest
|
||||
*
|
||||
* @param stack The ItemStack to be returned, the stacksize is ignored
|
||||
* @param chance The chance (this is from WeightedRandom.Item)
|
||||
* @param minAmount The minimum 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) {
|
||||
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||
}
|
||||
|
||||
public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||
* StackSizes can only be 1 and greater ones will be ignored
|
||||
*
|
||||
* @param input The input as an ItemStack
|
||||
* @param output The output as an ItemStack
|
||||
* @param energyUse The amount of RF used per conversion
|
||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) {
|
||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) {
|
||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
||||
* StackSizes can only be 1 and greater ones will be ignored
|
||||
*
|
||||
* @param input The input as an ItemStack
|
||||
* @param output The output as an ItemStack
|
||||
* @param energyUse The amount of RF used per conversion
|
||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||
*/
|
||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) {
|
||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||
}
|
||||
|
||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) {
|
||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item and the way it is modified to the Atomic Reconstructor's color lens.
|
||||
* This also works for blocks, but they have to be in their item form.
|
||||
* The way it is modified is an instance of IColorLensChanger. When modifying the item,
|
||||
* its modifyItem() method will be called with a stack containing the item.
|
||||
*
|
||||
* @param item The item (or block's item) to add
|
||||
* @param changer The change mechanism
|
||||
*/
|
||||
public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer) {
|
||||
RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an ingredient to the Coffee Machine ingredient list
|
||||
*
|
||||
* @param ingredient The ingredient to add
|
||||
*/
|
||||
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient) {
|
||||
COFFEE_MACHINE_INGREDIENTS.add(ingredient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a booklet entry to the list of entries
|
||||
*
|
||||
* @param entry The entry to add
|
||||
*/
|
||||
public static void addBookletEntry(IBookletEntry entry) {
|
||||
BOOKLET_ENTRIES.add(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new farmer behavior to the Farmer
|
||||
*
|
||||
* @param behavior The behavior to add
|
||||
*/
|
||||
public static void addFarmerBehavior(IFarmerBehavior behavior) {
|
||||
FARMER_BEHAVIORS.add(behavior);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public interface IBookletChapter {
|
||||
|
||||
IBookletPage[] getAllPages();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedName();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedNameWithFormatting();
|
||||
|
||||
IBookletEntry getEntry();
|
||||
|
||||
ItemStack getDisplayItemStack();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
int getPageIndex(IBookletPage page);
|
||||
|
||||
int getSortingPriority();
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IBookletEntry {
|
||||
|
||||
List<IBookletChapter> getAllChapters();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedName();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getLocalizedNameWithFormatting();
|
||||
|
||||
void addChapter(IBookletChapter chapter);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
|
||||
|
||||
int getSortingPriority();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
boolean visibleOnFrontPage();
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
public interface IBookletPage {
|
||||
|
||||
void getItemStacksForPage(List<ItemStack> list);
|
||||
|
||||
void getFluidStacksForPage(List<FluidStack> list);
|
||||
|
||||
IBookletChapter getChapter();
|
||||
|
||||
void setChapter(IBookletChapter chapter);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
String getInfoText();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
||||
|
||||
// todo: this won't be needed anymore
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void actionPerformed(GuiBookletBase gui, Button button);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void initGui(GuiBookletBase gui, int startX, int startY);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
||||
|
||||
boolean shouldBeOnLeftSide();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
String getWebLink();
|
||||
|
||||
IBookletPage addTextReplacement(String key, String value);
|
||||
|
||||
IBookletPage addTextReplacement(String key, float value);
|
||||
|
||||
IBookletPage addTextReplacement(String key, int value);
|
||||
|
||||
int getSortingPriority();
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
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 net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class GuiBookletBase extends Screen {
|
||||
|
||||
protected GuiBookletBase(ITextComponent titleIn) {
|
||||
super(new StringTextComponent(""));
|
||||
}
|
||||
|
||||
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 List<Button> getButtonList();
|
||||
|
||||
public abstract int getGuiLeft();
|
||||
|
||||
public abstract int getGuiTop();
|
||||
|
||||
public abstract int getSizeX();
|
||||
|
||||
public abstract int getSizeY();
|
||||
|
||||
public abstract void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer);
|
||||
|
||||
public abstract float getSmallFontSize();
|
||||
|
||||
public abstract float getMediumFontSize();
|
||||
|
||||
public abstract float getLargeFontSize();
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.farmer;
|
||||
|
||||
/**
|
||||
* Return values for IFarmerBehavior, each one has a different meaning in harvest and planting contexts.
|
||||
*
|
||||
*/
|
||||
public enum FarmerResult {
|
||||
|
||||
/**
|
||||
* Indicates that your behavior failed to perform the action it attempted.
|
||||
*/
|
||||
FAIL,
|
||||
|
||||
/**
|
||||
* Indicates that your behavior succeeded doing the action it attempted. For harvesting, this also shrinks the current stack by one, and stops processing.
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* Indicates you want the farmer to halt all further actions this tick. This will exit the farmer behavior loop if returned.
|
||||
*/
|
||||
STOP_PROCESSING
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.farmer;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFarmerBehavior {
|
||||
|
||||
/**
|
||||
* Try to plant a seed with this behavior
|
||||
* If this method returns true, the seed ItemStack will be shrunk by one.
|
||||
* This method will not be called if the block at the given position is not replaceable.
|
||||
*
|
||||
* @param seed The seed stack to plant
|
||||
* @param world The world
|
||||
* @param pos The position to plant the seed on
|
||||
* @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots
|
||||
* @return If planting was successful
|
||||
*/
|
||||
FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer);
|
||||
|
||||
/**
|
||||
* Try to harvest a plant with this behavior
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos The position of the plant
|
||||
* @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots
|
||||
* @return If harvesting was successful
|
||||
*/
|
||||
FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer);
|
||||
|
||||
int getPriority();
|
||||
|
||||
default Integer getPrioInt() {
|
||||
return getPriority();
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
/**
|
||||
* This is a helper interface for Lens' invoke() method.
|
||||
* <p>
|
||||
* This is not supposed to be implemented.
|
||||
* Can be cast to TileEntity.
|
||||
*/
|
||||
public interface IAtomicReconstructor extends IEnergyTile {
|
||||
|
||||
Lens getLens();
|
||||
|
||||
Direction getOrientation();
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This is not supposed to be implemented.
|
||||
* Can be cast to TileEntity.
|
||||
*/
|
||||
public interface IEnergyTile {
|
||||
|
||||
BlockPos getPosition();
|
||||
|
||||
int getX();
|
||||
|
||||
int getY();
|
||||
|
||||
int getZ();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getWorld()}
|
||||
*/
|
||||
@Deprecated
|
||||
World getWorldObject();
|
||||
|
||||
World getWorld();
|
||||
|
||||
void extractEnergy(int amount);
|
||||
|
||||
int getEnergy();
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a helper interface for IFarmerBehavior.
|
||||
* <p>
|
||||
* This is not supposed to be implemented.
|
||||
* Can be cast to TileEntity.
|
||||
*/
|
||||
public interface IFarmer extends IEnergyTile {
|
||||
|
||||
Direction getOrientation();
|
||||
|
||||
boolean canAddToSeeds(List<ItemStack> stacks);
|
||||
|
||||
boolean canAddToOutput(List<ItemStack> stacks);
|
||||
|
||||
void addToSeeds(List<ItemStack> stacks);
|
||||
|
||||
void addToOutput(List<ItemStack> stacks);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the internal method handler.
|
||||
* Use ActuallyAdditionsAPI.methodHandler for calling
|
||||
* This is not supposed to be implemented.
|
||||
*/
|
||||
public interface IMethodHandler {
|
||||
|
||||
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
||||
|
||||
EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect);
|
||||
|
||||
void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp);
|
||||
|
||||
void addEffectToStack(ItemStack stack, EffectInstance effect);
|
||||
|
||||
EffectInstance[] getEffectsFromStack(ItemStack stack);
|
||||
|
||||
boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
boolean invokeReconstructor(IAtomicReconstructor tile);
|
||||
|
||||
boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance);
|
||||
|
||||
@Deprecated //Use Ingredient input on AA API class
|
||||
boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance);
|
||||
|
||||
IBookletPage generateTextPage(int id);
|
||||
|
||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY);
|
||||
|
||||
IBookletPage generateCraftingPage(int id, IRecipe... recipes);
|
||||
|
||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result);
|
||||
|
||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages);
|
||||
|
||||
IBookletPage generateTextPage(int id, int priority);
|
||||
|
||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority);
|
||||
|
||||
IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes);
|
||||
|
||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
|
||||
|
||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
|
||||
|
||||
IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IConnectionPair {
|
||||
|
||||
void writeToNBT(CompoundNBT compound);
|
||||
|
||||
void readFromNBT(CompoundNBT compound);
|
||||
|
||||
BlockPos[] getPositions();
|
||||
|
||||
boolean doesSuppressRender();
|
||||
|
||||
LaserType getType();
|
||||
|
||||
boolean contains(BlockPos pos);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This is the internal laser relay connection handler.
|
||||
* Use ActuallyAdditionsAPI.connectionHandler for calling
|
||||
* This is not supposed to be implemented.
|
||||
* <p>
|
||||
* The network system is built in a way that doesn't need the individual
|
||||
* positions to be Laser Relays, it relies only on BlockPos
|
||||
*/
|
||||
public interface ILaserRelayConnectionHandler {
|
||||
|
||||
ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world);
|
||||
|
||||
void removeRelayFromNetwork(BlockPos relay, World world);
|
||||
|
||||
Network getNetworkFor(BlockPos relay, World world);
|
||||
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world);
|
||||
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender);
|
||||
|
||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected);
|
||||
|
||||
void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay);
|
||||
|
||||
LaserType getTypeFromLaser(TileEntity tile);
|
||||
|
||||
LaserType getTypeFromLaser(BlockPos pos, World world);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
public enum LaserType {
|
||||
ENERGY,
|
||||
ITEM,
|
||||
FLUID
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.laser;
|
||||
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
|
||||
public class Network {
|
||||
|
||||
public final ConcurrentSet<IConnectionPair> connections = new ConcurrentSet<>();
|
||||
public int changeAmount;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.connections.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Network) {
|
||||
if (this.connections.equals(((Network) obj).connections)) { return true; }
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.lens;
|
||||
|
||||
/**
|
||||
* This is the base class for a Reconstructor Lens Item
|
||||
*/
|
||||
public interface ILensItem {
|
||||
|
||||
/**
|
||||
* Returns the lens type that belongs to this lens item
|
||||
*/
|
||||
Lens getLens();
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
/**
|
||||
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
|
||||
*/
|
||||
public abstract class Lens extends ForgeRegistryEntry<Lens> {
|
||||
|
||||
/**
|
||||
* Invokes the lens type's behavior on a block
|
||||
*
|
||||
* @param hitBlock The block that was hit
|
||||
* @param tile The tile the lens was invoked from
|
||||
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
|
||||
*/
|
||||
public abstract boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
/**
|
||||
* Returns the color in an array of 3 float values that are r, g, b
|
||||
*/
|
||||
public abstract float[] getColor();
|
||||
|
||||
/**
|
||||
* Gets the maximum distance the beam goes with this lens
|
||||
*/
|
||||
public abstract int getDistance();
|
||||
|
||||
/**
|
||||
* @return If the lens can be invoked at the current time
|
||||
*/
|
||||
public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* This is the base class for a Reconstructor Lens Type that converts two items
|
||||
* via the ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES list.
|
||||
* <p>
|
||||
* If you want to make a new type of conversion, just use your type in the recipe
|
||||
* If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.
|
||||
*/
|
||||
public class LensConversion extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getColor() {
|
||||
return new float[] { 27F / 255F, 109F / 255F, 1F };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDistance() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.misc;
|
||||
|
||||
public interface IDisableableItem {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return If the item has not been registered with the Forge Registry.
|
||||
*/
|
||||
boolean isDisabled();
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.misc;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IDisplayStandItem {
|
||||
|
||||
boolean update(ItemStack stack, TileEntity tile, int elapsedTicks);
|
||||
|
||||
int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.misc;
|
||||
|
||||
public interface IGoggles {
|
||||
|
||||
boolean displaySpectralMobs();
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
// todo: not sure how to denote this anymore
|
||||
//@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID)
|
||||
package de.ellpeck.actuallyadditions.api;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Changes an item's color by changing its metadata.
|
||||
* Much like dye and wool, 0 is white and 15 is black and it will cycle around.
|
||||
*/
|
||||
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
||||
|
||||
/**
|
||||
* @todo: this is very very likely to no longer work...
|
||||
*/
|
||||
@Override
|
||||
public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
ItemStack newStack = stack.copy();
|
||||
int meta = newStack.getDamage();
|
||||
newStack.setDamage((meta + 1) % 16);
|
||||
return newStack;
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EmpowererRecipe {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
|
||||
protected final Ingredient modifier1;
|
||||
protected final Ingredient modifier2;
|
||||
protected final Ingredient modifier3;
|
||||
protected final Ingredient modifier4;
|
||||
|
||||
protected final int energyPerStand;
|
||||
protected final float[] particleColor;
|
||||
protected final int time;
|
||||
|
||||
@Deprecated
|
||||
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
this(Ingredient.fromStacks(input), output, Ingredient.fromStacks(modifier1), Ingredient.fromStacks(modifier2), Ingredient.fromStacks(modifier3), Ingredient.fromStacks(modifier4), energyPerStand, time, particleColor);
|
||||
}
|
||||
|
||||
public EmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.modifier1 = modifier1;
|
||||
this.modifier2 = modifier2;
|
||||
this.modifier3 = modifier3;
|
||||
this.modifier4 = modifier4;
|
||||
this.energyPerStand = energyPerStand;
|
||||
this.particleColor = particleColor;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||
if (!this.input.test(base)) return false;
|
||||
List<Ingredient> matches = new ArrayList<>();
|
||||
ItemStack[] stacks = { stand1, stand2, stand3, stand4 };
|
||||
boolean[] unused = { true, true, true, true };
|
||||
for (ItemStack s : stacks) {
|
||||
if (unused[0] && this.modifier1.test(s)) {
|
||||
matches.add(this.modifier1);
|
||||
unused[0] = false;
|
||||
} else if (unused[1] && this.modifier2.test(s)) {
|
||||
matches.add(this.modifier2);
|
||||
unused[1] = false;
|
||||
} else if (unused[2] && this.modifier3.test(s)) {
|
||||
matches.add(this.modifier3);
|
||||
unused[2] = false;
|
||||
} else if (unused[3] && this.modifier4.test(s)) {
|
||||
matches.add(this.modifier4);
|
||||
unused[3] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return matches.size() == 4;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public Ingredient getStandOne() {
|
||||
return this.modifier1;
|
||||
}
|
||||
|
||||
public Ingredient getStandTwo() {
|
||||
return this.modifier2;
|
||||
}
|
||||
|
||||
public Ingredient getStandThree() {
|
||||
return this.modifier3;
|
||||
}
|
||||
|
||||
public Ingredient getStandFour() {
|
||||
return this.modifier4;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public int getEnergyPerStand() {
|
||||
return this.energyPerStand;
|
||||
}
|
||||
|
||||
public float[] getParticleColors() {
|
||||
return this.particleColor;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Used for the Atomic Reconstructor's Color Lens changing algorythm.
|
||||
* When registering a new item to be changed, it needs an IColorLensChanger which
|
||||
* is the method with which the item will be changed.
|
||||
* <p>
|
||||
* See ColorLensChangerByDyeMeta for reference.
|
||||
*/
|
||||
public interface IColorLensChanger {
|
||||
|
||||
/**
|
||||
* Modifies the given item.
|
||||
* Will only be called with stacks containing items that are registered with
|
||||
* this IColorLensChanger.
|
||||
*
|
||||
* @param stack the stack to modify
|
||||
* @param hitBlockState The state of the block that was hit
|
||||
* @param hitBlock the block that was hit (usually air, or the block that is also in the stack)
|
||||
* @param tile the Reconstructor doing the color conversion
|
||||
* @return the modified stack. Please make sure to return a modified COPY of the input stack.
|
||||
*/
|
||||
ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class LensConversionRecipe {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
protected final int energy;
|
||||
protected final Lens type;
|
||||
|
||||
@Deprecated
|
||||
public LensConversionRecipe(ItemStack input, ItemStack output, int energy, Lens type) {
|
||||
this(Ingredient.fromStacks(input), output, energy, type);
|
||||
}
|
||||
|
||||
public LensConversionRecipe(Ingredient input, ItemStack output, int energy, Lens type) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.energy = energy;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack input, Lens lens) {
|
||||
return this.input.test(input) && this.type == lens;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public int getEnergyUsed() {
|
||||
return this.energy;
|
||||
}
|
||||
|
||||
public Lens getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
public class OilGenRecipe {
|
||||
|
||||
public final String fluidName;
|
||||
public final int genAmount;
|
||||
public final int genTime;
|
||||
|
||||
/**
|
||||
* Oil generator recipe
|
||||
* @param fluidName The fluid
|
||||
* @param genAmount The power generated, in CF/t
|
||||
* @param genTime The length the fluid burns for, in seconds
|
||||
*/
|
||||
public OilGenRecipe(String fluidName, int genAmount, int genTime) {
|
||||
this.fluidName = fluidName;
|
||||
this.genAmount = genAmount;
|
||||
this.genTime = genTime;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
public class TreasureChestLoot extends WeightedRandom.Item {
|
||||
|
||||
public final ItemStack returnItem;
|
||||
public final int minAmount;
|
||||
public final int maxAmount;
|
||||
|
||||
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount) {
|
||||
super(chance);
|
||||
this.returnItem = returnItem;
|
||||
this.minAmount = minAmount;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
public class WeightedOre extends WeightedRandom.Item {
|
||||
|
||||
public final String name;
|
||||
|
||||
public WeightedOre(String name, int weight) {
|
||||
super(weight);
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.tile;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
|
||||
*/
|
||||
public interface IPhantomTile {
|
||||
|
||||
/**
|
||||
* @return If the Phantom Tile is currently bound to anything
|
||||
*/
|
||||
boolean hasBoundPosition();
|
||||
|
||||
/**
|
||||
* @return If the Phantom Tile's bound position is in range
|
||||
*/
|
||||
boolean isBoundThingInRange();
|
||||
|
||||
/**
|
||||
* @return The position this tile is bound to
|
||||
*/
|
||||
BlockPos getBoundPosition();
|
||||
|
||||
/**
|
||||
* Sets the bound position
|
||||
*/
|
||||
void setBoundPosition(BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The ID of the GUI it opens, -1 if none
|
||||
*/
|
||||
int getGuiID();
|
||||
|
||||
/**
|
||||
* @return The range the tile currently has
|
||||
*/
|
||||
int getRange();
|
||||
}
|
|
@ -1,324 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.booklet.chapter.BookletChapter;
|
||||
import de.ellpeck.actuallyadditions.booklet.chapter.BookletChapterCoffee;
|
||||
import de.ellpeck.actuallyadditions.booklet.chapter.BookletChapterCrusher;
|
||||
import de.ellpeck.actuallyadditions.booklet.chapter.BookletChapterTrials;
|
||||
import de.ellpeck.actuallyadditions.booklet.entry.BookletEntry;
|
||||
import de.ellpeck.actuallyadditions.booklet.entry.BookletEntryAllItems;
|
||||
import de.ellpeck.actuallyadditions.booklet.entry.BookletEntryTrials;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCrafting;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageEmpowerer;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageFurnace;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageLinkButton;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PagePicture;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageReconstructor;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageTextOnly;
|
||||
import de.ellpeck.actuallyadditions.common.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.BlockCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.CrusherCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.FoodCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.ItemCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.MiscCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.ToolCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.common.gen.AAWorldGen;
|
||||
import de.ellpeck.actuallyadditions.common.gen.WorldGenLushCaves;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemWingsOfTheBats;
|
||||
import de.ellpeck.actuallyadditions.common.items.lens.LensDisenchanting;
|
||||
import de.ellpeck.actuallyadditions.common.items.lens.LensRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheFoods;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.common.recipe.EmpowererHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityCoalGenerator;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityDirectionalBreaker;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFireworkBox;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFurnaceSolar;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityGrinder;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityHeatCollector;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemRepairer;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLaserRelayEnergy;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLaserRelayEnergyAdvanced;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLaserRelayEnergyExtreme;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLavaFactoryController;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityLeafGenerator;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityMiner;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityPhantomPlacer;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityPhantomface;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityPlayerInterface;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityRangedCollector;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityShockSuppressor;
|
||||
import de.ellpeck.actuallyadditions.common.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
public final class InitBooklet {
|
||||
|
||||
public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
|
||||
|
||||
public static void preInit() {
|
||||
ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
|
||||
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
|
||||
|
||||
ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
|
||||
ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
|
||||
ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial();
|
||||
ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF");
|
||||
ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF");
|
||||
ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF");
|
||||
ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF");
|
||||
ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF");
|
||||
ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
|
||||
ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
initChapters();
|
||||
|
||||
int chapCount = 0;
|
||||
int pageCount = 0;
|
||||
int infoCount = 0;
|
||||
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
|
||||
for (IBookletChapter chapter : entry.getAllChapters()) {
|
||||
if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
|
||||
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
|
||||
chapCount++;
|
||||
|
||||
for (IBookletPage page : chapter.getAllPages()) {
|
||||
pageCount++;
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
page.getItemStacksForPage(items);
|
||||
List<FluidStack> fluids = new ArrayList<>();
|
||||
page.getFluidStacksForPage(fluids);
|
||||
|
||||
if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
|
||||
if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
|
||||
ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
|
||||
infoCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> {
|
||||
Integer prio1 = entry1.getSortingPriority();
|
||||
Integer prio2 = entry2.getSortingPriority();
|
||||
return prio2.compareTo(prio1);
|
||||
});
|
||||
Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> {
|
||||
Integer prio1 = chapter1.getSortingPriority();
|
||||
Integer prio2 = chapter2.getSortingPriority();
|
||||
return prio2.compareTo(prio1);
|
||||
});
|
||||
Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> {
|
||||
Integer prio1 = page1.getSortingPriority();
|
||||
Integer prio2 = page2.getSortingPriority();
|
||||
return prio2.compareTo(prio1);
|
||||
});
|
||||
|
||||
ActuallyAdditions.LOGGER.info("Registered a total of " + chapCount + " booklet chapters, where " + infoCount + " out of " + pageCount + " booklet pages contain information about items or fluids!");
|
||||
}
|
||||
|
||||
private static void initChapters() {
|
||||
//Getting Started
|
||||
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
|
||||
chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant();
|
||||
new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||
ArrayList<BookletPage> crystalPages = new ArrayList<>();
|
||||
crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard()));
|
||||
for (int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++) {
|
||||
crystalPages.add(new PageReconstructor(7 + i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
||||
}
|
||||
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).setNoText());
|
||||
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
|
||||
chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145));
|
||||
chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
|
||||
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
|
||||
ArrayList<BookletPage> empowererPages = new ArrayList<>();
|
||||
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
|
||||
for (int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++) {
|
||||
empowererPages.add(new PageEmpowerer(7 + i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
||||
}
|
||||
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText());
|
||||
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
|
||||
new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockEmpowerer), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
|
||||
new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText(), new PageCrafting(14, ItemCrafting.recipeLens).setNoText());
|
||||
chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant();
|
||||
|
||||
//Miscellaneous
|
||||
new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemWorm), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemWorm)), new PagePicture(2, "page_worms", 145)).setImportant();
|
||||
new BookletChapter("lushCaves", ActuallyAdditionsAPI.entryMisc, new ItemStack(Blocks.STONE), new PageTextOnly(1), new PagePicture(2, "page_lush_caves", 0).setNoText());
|
||||
new BookletChapter("crystalClusters", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockCrystalClusterEmerald), new PageTextOnly(1).addItemsToPage(WorldGenLushCaves.CRYSTAL_CLUSTERS), new PageCrafting(2, MiscCrafting.RECIPES_CRYSTAL_SHARDS).setNoText(), new PageCrafting(3, MiscCrafting.RECIPES_CRYSTAL_SHARDS_BACK).setNoText()).setSpecial();
|
||||
new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BANNER, 1, 15), new PageTextOnly(1));
|
||||
new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText());
|
||||
chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", AAWorldGen.QUARTZ_MIN).addTextReplacement("<highest>", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
|
||||
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial();
|
||||
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
|
||||
ArrayList<BookletPage> lampPages = new ArrayList<>();
|
||||
lampPages.add(new PageTextOnly(lampPages.size() + 1));
|
||||
lampPages.add(new PageTextOnly(lampPages.size() + 1));
|
||||
lampPages.add(new PageCrafting(lampPages.size() + 1, BlockCrafting.recipePowerer).setWildcard().setNoText());
|
||||
for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
|
||||
lampPages.add(new PageCrafting(lampPages.size() + 1, recipe).setNoText());
|
||||
}
|
||||
new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockColoredLampOn, 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()]));
|
||||
new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()), new PageCrafting(1, ItemCrafting.recipeEnderStar));
|
||||
new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal())));
|
||||
new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest), new PagePicture(1, "page_treasure_chest", 150).addItemsToPage(new ItemStack(InitBlocks.blockTreasureChest)), new PageTextOnly(2)).setSpecial();
|
||||
new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemHairyBall), new PagePicture(1, "page_fur_balls", 110).addItemsToPage(new ItemStack(InitItems.itemHairyBall)), new PageTextOnly(2)).setSpecial();
|
||||
new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockBlackLotus)), new PageCrafting(2, ItemCrafting.recipeBlackDye));
|
||||
new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemWaterBowl), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemWaterBowl)));
|
||||
new BookletChapter("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTinyTorch), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial();
|
||||
|
||||
//Reconstruction
|
||||
chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1)).setImportant();
|
||||
new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial();
|
||||
new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText());
|
||||
new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemColorLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText());
|
||||
new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDamageLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText());
|
||||
new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMoreDamageLens), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText());
|
||||
new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemExplosionLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText());
|
||||
new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDisenchantingLens), new PageTextOnly(1).addTextReplacement("<energy>", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial();
|
||||
new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMiningLens), new PageTextOnly(1).addTextReplacement("<energy>", ConfigIntValues.MINING_LENS_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant();
|
||||
|
||||
//Laser Relays
|
||||
chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitItems.itemLaserWrench), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<range>", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant();
|
||||
new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<cap1>", TileEntityLaserRelayEnergy.CAP).addTextReplacement("<cap2>", TileEntityLaserRelayEnergyAdvanced.CAP).addTextReplacement("<cap3>", TileEntityLaserRelayEnergyExtreme.CAP), new PagePicture(3, "page_laser_relay", 0).setNoText(), new PageCrafting(4, BlockCrafting.recipeLaserRelay).setWildcard().setNoText(), new PageCrafting(5, BlockCrafting.recipeLaserRelayAdvanced).setWildcard().setNoText(), new PageCrafting(6, BlockCrafting.recipeLaserRelayExtreme).setWildcard().setNoText());
|
||||
new BookletChapter("fluidLaser", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockLaserRelayFluids), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText());
|
||||
new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockLaserRelayItem), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial();
|
||||
new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockItemViewer), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText());
|
||||
new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockLaserRelayItemWhitelist), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard());
|
||||
new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitBlocks.blockItemViewerHopping), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText());
|
||||
new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitItems.itemLaserUpgradeInvisibility), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant();
|
||||
new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitItems.itemLaserUpgradeRange), new PageTextOnly(1).addTextReplacement("<def>", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("<upgraded>", TileEntityLaserRelay.MAX_DISTANCE_RANGED), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeRange).setNoText()).setImportant();
|
||||
|
||||
//No RF Using Blocks
|
||||
new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockBreaker), new PageCrafting(1, BlockCrafting.recipeBreaker).setWildcard(), new PageCrafting(2, BlockCrafting.recipePlacer).setWildcard(), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer).setWildcard(), new PageCrafting(4, BlockCrafting.recipeLiquidCollector).setWildcard());
|
||||
new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockDropper), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText());
|
||||
new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomLiquiface), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomface.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant();
|
||||
new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomRedstoneface), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
|
||||
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
|
||||
new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
|
||||
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant();
|
||||
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
|
||||
new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
|
||||
new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
|
||||
new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemFertilizer)), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageTextOnly(3).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal())));
|
||||
new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade), new PageCrafting(6, ItemCrafting.recipeSmallToMediumCrateUpgrade), new PageCrafting(7, ItemCrafting.recipeMediumToLargeCrateUpgrade));
|
||||
new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockRangedCollector), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText());
|
||||
|
||||
//RF Using Blocks
|
||||
new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFireworkBox), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial();
|
||||
new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockBatteryBox), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial();
|
||||
new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(InitItems.itemCanolaSeed)), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant();
|
||||
new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
|
||||
new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
|
||||
|
||||
List<IBookletPage> list = new ArrayList<>();
|
||||
list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityGrinder.ENERGY_USE));
|
||||
list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
|
||||
list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
|
||||
if (CrusherCrafting.recipeIronHorseArmor != null) list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
|
||||
if (CrusherCrafting.recipeGoldHorseArmor != null) list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
|
||||
if (CrusherCrafting.recipeDiamondHorseArmor != null) list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
|
||||
|
||||
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), list.toArray(new IBookletPage[0]));
|
||||
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityFurnaceDouble.ENERGY_USE));
|
||||
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());
|
||||
new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));
|
||||
new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE));
|
||||
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
|
||||
new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
|
||||
new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
|
||||
new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockShockSuppressor), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
|
||||
|
||||
//RF Generating Blocks
|
||||
new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
|
||||
new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("<min>", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText());
|
||||
new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addItemsToPage(new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidRefinedCanolaOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText());
|
||||
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("<range>", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
|
||||
new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockBioReactor), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial();
|
||||
|
||||
//No RF Using Items
|
||||
chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemEngineerGoggles), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant();
|
||||
new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
|
||||
new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
|
||||
new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText());
|
||||
new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant();
|
||||
new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPlayerProbe), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
|
||||
ArrayList<BookletPage> aiotPages = new ArrayList<>();
|
||||
aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
|
||||
for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
|
||||
aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText());
|
||||
}
|
||||
new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
|
||||
|
||||
new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3));
|
||||
|
||||
ArrayList<BookletPage> potionRingPages = new ArrayList<>();
|
||||
potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
|
||||
for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
|
||||
potionRingPages.add(new PageCrafting(potionRingPages.size() + 1, recipe).setNoText());
|
||||
}
|
||||
new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPotionRing), potionRingPages.toArray(new BookletPage[potionRingPages.size()]));
|
||||
new BookletChapter("spawnerChanger", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemSpawnerChanger), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeSpawnerChanger).setNoText());
|
||||
new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitItems.itemFilter), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
|
||||
|
||||
//RF Using Items
|
||||
new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial();
|
||||
new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemFillingWand), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial();
|
||||
new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant();
|
||||
new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing));
|
||||
new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing));
|
||||
new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemWaterRemovalRing), new PageCrafting(1, ItemCrafting.recipeWaterRing));
|
||||
new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemBatteryTriple), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText());
|
||||
|
||||
//Updates and infos
|
||||
new BookletChapter("changelog", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.CLOCK), new PageLinkButton(1, UpdateChecker.CHANGELOG_LINK));
|
||||
new BookletChapter("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd"));
|
||||
new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant();
|
||||
new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemBooklet), new PageLinkButton(1, "http://ellpeck.de"));
|
||||
|
||||
//Trials
|
||||
chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial();
|
||||
new BookletChapterTrials("crystalProduction", new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), false);
|
||||
new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false);
|
||||
new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME)), false);
|
||||
new BookletChapterTrials("autoDisenchanter", new ItemStack(InitItems.itemDisenchantingLens), false);
|
||||
new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, Fluid.BUCKET_VOLUME)), false);
|
||||
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
|
||||
new BookletChapterTrials("empowererAutomation", new ItemStack(InitBlocks.blockEmpowerer), false);
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.button;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BookmarkButton extends GuiButton {
|
||||
|
||||
private final GuiBooklet booklet;
|
||||
public IBookletPage assignedPage;
|
||||
|
||||
public BookmarkButton(int id, int x, int y, GuiBooklet booklet) {
|
||||
super(id, x, y, 16, 16, "");
|
||||
this.booklet = booklet;
|
||||
}
|
||||
|
||||
public void onPressed() {
|
||||
if (this.assignedPage != null) {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
this.assignedPage = null;
|
||||
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
||||
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
||||
Minecraft.getMinecraft().displayGuiScreen(gui);
|
||||
}
|
||||
} else {
|
||||
if (this.booklet instanceof GuiPage) {
|
||||
this.assignedPage = ((GuiPage) this.booklet).pages[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
if (k == 0) {
|
||||
k = 1;
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
int renderHeight = 25;
|
||||
this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null ? 0 : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight);
|
||||
this.mouseDragged(minecraft, x, y);
|
||||
|
||||
if (this.assignedPage != null) {
|
||||
ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
|
||||
if (StackUtil.isValid(display)) {
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawHover(int mouseX, int mouseY) {
|
||||
if (this.isMouseOver()) {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
if (this.assignedPage != null) {
|
||||
IBookletChapter chapter = this.assignedPage.getChapter();
|
||||
|
||||
list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
|
||||
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
|
||||
list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
|
||||
} else {
|
||||
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
|
||||
|
||||
if (this.booklet instanceof GuiPage) {
|
||||
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
|
||||
} else {
|
||||
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
|
||||
}
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.button;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class EntryButton extends GuiButton {
|
||||
|
||||
private final GuiBookletBase gui;
|
||||
private final ItemStack stackToRender;
|
||||
|
||||
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender) {
|
||||
super(id, x, y, width, height, text);
|
||||
this.gui = gui;
|
||||
StackUtil.isValid(stackToRender);
|
||||
this.stackToRender = stackToRender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
|
||||
if (this.visible) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
|
||||
int textOffsetX = 0;
|
||||
if (StackUtil.isValid(this.stackToRender)) {
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
|
||||
GlStateManager.popMatrix();
|
||||
textOffsetX = 10;
|
||||
}
|
||||
|
||||
float scale = this.gui.getMediumFontSize();
|
||||
|
||||
if (this.hovered) {
|
||||
GlStateManager.pushMatrix();
|
||||
AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.fontRenderer.getStringWidth(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
StringUtil.renderScaledAsciiString(minecraft.fontRenderer, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.button;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class TrialsButton extends TexturedButton {
|
||||
|
||||
private final boolean isTrials;
|
||||
|
||||
public TrialsButton(GuiBooklet gui) {
|
||||
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16);
|
||||
this.isTrials = gui.areTrialsOpened();
|
||||
this.enabled = !this.isTrials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int x, int y, float f) {
|
||||
super.drawButton(minecraft, x, y, f);
|
||||
|
||||
if (this.visible) {
|
||||
if (this.hovered || this.isTrials) {
|
||||
this.drawCenteredString(minecraft.fontRenderer, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHoverState(boolean mouseOver) {
|
||||
if (mouseOver || this.isTrials) {
|
||||
return 2;
|
||||
} else if (!this.enabled) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.chapter;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BookletChapter implements IBookletChapter {
|
||||
|
||||
public final IBookletPage[] pages;
|
||||
public final IBookletEntry entry;
|
||||
public final ItemStack displayStack;
|
||||
private final String identifier;
|
||||
private final int priority;
|
||||
public TextFormatting color;
|
||||
|
||||
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||
this(identifier, entry, displayStack, 0, pages);
|
||||
}
|
||||
|
||||
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
|
||||
this.pages = pages;
|
||||
this.identifier = identifier;
|
||||
this.entry = entry;
|
||||
this.displayStack = displayStack;
|
||||
if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) displayStack = ItemStack.EMPTY;
|
||||
this.priority = priority;
|
||||
this.color = TextFormatting.RESET;
|
||||
|
||||
this.entry.addChapter(this);
|
||||
for (IBookletPage page : this.pages) {
|
||||
page.setChapter(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletPage[] getAllPages() {
|
||||
return this.pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
return this.color + this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletEntry getEntry() {
|
||||
return this.entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDisplayItemStack() {
|
||||
return this.displayStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPageIndex(IBookletPage page) {
|
||||
for (int i = 0; i < this.pages.length; i++) {
|
||||
if (this.pages[i] == page) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
public BookletChapter setImportant() {
|
||||
this.color = TextFormatting.DARK_GREEN;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletChapter setSpecial() {
|
||||
this.color = TextFormatting.DARK_PURPLE;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.chapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemCoffee;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BookletChapterCoffee extends BookletChapter {
|
||||
|
||||
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||
super(identifier, entry, displayStack, getPages(pages));
|
||||
}
|
||||
|
||||
private static IBookletPage[] getPages(IBookletPage... pages) {
|
||||
List<IBookletPage> allPages = new ArrayList<>();
|
||||
allPages.addAll(Arrays.asList(pages));
|
||||
|
||||
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
|
||||
BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
|
||||
if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
|
||||
page.setNoText();
|
||||
}
|
||||
allPages.add(page);
|
||||
}
|
||||
|
||||
return allPages.toArray(new IBookletPage[allPages.size()]);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.chapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.CrusherCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BookletChapterCrusher extends BookletChapter {
|
||||
|
||||
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||
super(identifier, entry, displayStack, getPages(pages));
|
||||
}
|
||||
|
||||
private static IBookletPage[] getPages(IBookletPage... pages) {
|
||||
List<IBookletPage> allPages = new ArrayList<>();
|
||||
allPages.addAll(Arrays.asList(pages));
|
||||
|
||||
for (CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES) {
|
||||
allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
|
||||
}
|
||||
|
||||
return allPages.toArray(new IBookletPage[allPages.size()]);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.chapter;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageTrials;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BookletChapterTrials extends BookletChapter {
|
||||
|
||||
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
|
||||
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||
boolean completed = data.completedTrials.contains(this.getIdentifier());
|
||||
|
||||
return (completed ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
|
||||
}
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.entry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BookletEntry implements IBookletEntry {
|
||||
|
||||
private final String identifier;
|
||||
private final int priority;
|
||||
private final List<IBookletChapter> chapters = new ArrayList<>();
|
||||
private TextFormatting color;
|
||||
|
||||
public BookletEntry(String identifier) {
|
||||
this(identifier, 0);
|
||||
}
|
||||
|
||||
public BookletEntry(String identifier, int prio) {
|
||||
this.identifier = identifier;
|
||||
this.priority = prio;
|
||||
ActuallyAdditionsAPI.addBookletEntry(this);
|
||||
|
||||
this.color = TextFormatting.RESET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static boolean fitsFilter(IBookletPage page, String searchBarText) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
page.getItemStacksForPage(items);
|
||||
if (!items.isEmpty()) {
|
||||
for (ItemStack stack : items) {
|
||||
if (StackUtil.isValid(stack)) {
|
||||
List<String> tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
for (String strg : tooltip) {
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<FluidStack> fluids = new ArrayList<>();
|
||||
page.getFluidStacksForPage(fluids);
|
||||
if (!fluids.isEmpty()) {
|
||||
for (FluidStack stack : fluids) {
|
||||
if (stack != null) {
|
||||
String strg = stack.getLocalizedName();
|
||||
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IBookletChapter> getAllChapters() {
|
||||
return this.chapters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedName() {
|
||||
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLocalizedNameWithFormatting() {
|
||||
return this.color + this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChapter(IBookletChapter chapter) {
|
||||
this.chapters.add(chapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
|
||||
if (searchBarText != null && !searchBarText.isEmpty()) {
|
||||
String search = searchBarText.toLowerCase(Locale.ROOT);
|
||||
|
||||
List<IBookletChapter> fittingChapters = new ArrayList<>();
|
||||
for (IBookletChapter chapter : this.getAllChapters()) {
|
||||
if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) {
|
||||
fittingChapters.add(chapter);
|
||||
} else {
|
||||
for (IBookletPage page : chapter.getAllPages()) {
|
||||
if (fitsFilter(page, search)) {
|
||||
fittingChapters.add(chapter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fittingChapters;
|
||||
} else {
|
||||
return this.getAllChapters();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean visibleOnFrontPage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BookletEntry setImportant() {
|
||||
this.color = TextFormatting.DARK_GREEN;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletEntry setSpecial() {
|
||||
this.color = TextFormatting.DARK_PURPLE;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.entry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
|
||||
public class BookletEntryAllItems extends BookletEntry {
|
||||
|
||||
public BookletEntryAllItems(String identifier) {
|
||||
super(identifier, -Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChapter(IBookletChapter chapter) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IBookletChapter> getAllChapters() {
|
||||
return ActuallyAdditionsAPI.ALL_CHAPTERS;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.entry;
|
||||
|
||||
public class BookletEntryTrials extends BookletEntry {
|
||||
|
||||
public BookletEntryTrials(String identifier) {
|
||||
super(identifier, -Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visibleOnFrontPage() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,365 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.button.BookmarkButton;
|
||||
import de.ellpeck.actuallyadditions.booklet.button.TrialsButton;
|
||||
import de.ellpeck.actuallyadditions.common.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData.PlayerSave;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.common.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiBooklet extends GuiBookletBase {
|
||||
|
||||
public static final int BUTTONS_PER_PAGE = 12;
|
||||
public static final ResourceLocation RES_LOC_GUI = AssetUtil.getBookletGuiLocation("gui_booklet");
|
||||
public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets");
|
||||
protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12];
|
||||
public GuiScreen previousScreen;
|
||||
public GuiBookletBase parentPage;
|
||||
public GuiTextField searchField;
|
||||
protected int xSize;
|
||||
protected int ySize;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
private GuiButton buttonLeft;
|
||||
private GuiButton buttonRight;
|
||||
private GuiButton buttonBack;
|
||||
|
||||
private GuiButton buttonTrials;
|
||||
|
||||
private float smallFontSize;
|
||||
private float mediumFontSize;
|
||||
private float largeFontSize;
|
||||
|
||||
public GuiBooklet(GuiScreen previousScreen, GuiBookletBase parentPage) {
|
||||
this.previousScreen = previousScreen;
|
||||
this.parentPage = parentPage;
|
||||
|
||||
this.xSize = 281;
|
||||
this.ySize = 180;
|
||||
}
|
||||
|
||||
private static float getFontSize(String lang, ConfigIntValues config, float defaultValue) {
|
||||
int conf = config.getValue();
|
||||
if (conf <= 0) {
|
||||
try {
|
||||
return Float.parseFloat(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".fontSize." + lang));
|
||||
} catch (Exception e) {
|
||||
return defaultValue;
|
||||
}
|
||||
} else {
|
||||
return conf / 100F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
|
||||
this.smallFontSize = getFontSize("small", ConfigIntValues.FONT_SIZE_SMALL, 0.5F);
|
||||
this.mediumFontSize = getFontSize("medium", ConfigIntValues.FONT_SIZE_MEDIUM, 0.75F);
|
||||
this.largeFontSize = getFontSize("large", ConfigIntValues.FONT_SIZE_LARGE, 0.8F);
|
||||
|
||||
if (this.hasPageLeftButton()) {
|
||||
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up");
|
||||
this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, -2000, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText);
|
||||
this.buttonList.add(this.buttonLeft);
|
||||
}
|
||||
|
||||
if (this.hasPageRightButton()) {
|
||||
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down");
|
||||
this.buttonRight = new TexturedButton(RES_LOC_GADGETS, -2001, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText);
|
||||
this.buttonList.add(this.buttonRight);
|
||||
}
|
||||
|
||||
if (this.hasBackButton()) {
|
||||
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page");
|
||||
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, -2002, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText);
|
||||
this.buttonList.add(this.buttonBack);
|
||||
}
|
||||
|
||||
if (this.hasSearchBar()) {
|
||||
this.searchField = new GuiTextField(-420, this.fontRenderer, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12);
|
||||
this.searchField.setMaxStringLength(50);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
}
|
||||
|
||||
if (this.hasBookmarkButtons()) {
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
||||
|
||||
int xStart = this.guiLeft + this.xSize / 2 - 16 * this.bookmarkButtons.length / 2;
|
||||
for (int i = 0; i < this.bookmarkButtons.length; i++) {
|
||||
this.bookmarkButtons[i] = new BookmarkButton(1337 + i, xStart + i * 16, this.guiTop + this.ySize, this);
|
||||
this.buttonList.add(this.bookmarkButtons[i]);
|
||||
|
||||
if (data.bookmarks[i] != null) {
|
||||
this.bookmarkButtons[i].assignedPage = data.bookmarks[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.buttonTrials = new TrialsButton(this);
|
||||
this.buttonList.add(this.buttonTrials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
|
||||
//Don't cache the parent GUI, otherwise it opens again when you close the cached book!
|
||||
this.previousScreen = null;
|
||||
|
||||
if (this.mc.player == null) return;
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
||||
data.lastOpenBooklet = this;
|
||||
|
||||
boolean change = false;
|
||||
for (int i = 0; i < this.bookmarkButtons.length; i++) {
|
||||
if (data.bookmarks[i] != this.bookmarkButtons[i].assignedPage) {
|
||||
data.bookmarks[i] = this.bookmarkButtons[i].assignedPage;
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
PacketHandlerHelper.sendPlayerDataToServer(true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
this.drawScreenPre(mouseX, mouseY, partialTicks);
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
this.drawScreenPost(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
public void drawScreenPre(int mouseX, int mouseY, float partialTicks) {
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
this.mc.getTextureManager().bindTexture(RES_LOC_GUI);
|
||||
drawModalRectWithCustomSizedTexture(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512);
|
||||
|
||||
if (this.hasSearchBar()) {
|
||||
this.mc.getTextureManager().bindTexture(RES_LOC_GADGETS);
|
||||
this.drawTexturedModalRect(this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14);
|
||||
|
||||
boolean unicodeBefore = this.fontRenderer.getUnicodeFlag();
|
||||
this.fontRenderer.setUnicodeFlag(true);
|
||||
|
||||
if (!this.searchField.isFocused() && (this.searchField.getText() == null || this.searchField.getText().isEmpty())) {
|
||||
this.fontRenderer.drawString(TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF, false);
|
||||
}
|
||||
|
||||
this.searchField.drawTextBox();
|
||||
|
||||
this.fontRenderer.setUnicodeFlag(unicodeBefore);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreenPost(int mouseX, int mouseY, float partialTicks) {
|
||||
for (GuiButton button : this.buttonList) {
|
||||
if (button instanceof BookmarkButton) {
|
||||
((BookmarkButton) button).drawHover(mouseX, mouseY);
|
||||
} else if (button instanceof TexturedButton) {
|
||||
((TexturedButton) button).drawHover(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if (this.hasSearchBar()) {
|
||||
this.searchField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
if (mouseButton == 1 && this.hasBackButton()) {
|
||||
this.onBackButtonPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() throws IOException {
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if (wheel != 0) {
|
||||
if (wheel < 0) {
|
||||
if (this.hasPageRightButton()) {
|
||||
this.onPageRightButtonPressed();
|
||||
}
|
||||
} else if (wheel > 0) {
|
||||
if (this.hasPageLeftButton()) {
|
||||
this.onPageLeftButtonPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
|
||||
if (this.hasSearchBar()) {
|
||||
this.searchField.updateCursorCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPageLeftButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onPageLeftButtonPressed() {
|
||||
|
||||
}
|
||||
|
||||
public boolean hasPageRightButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onPageRightButtonPressed() {
|
||||
|
||||
}
|
||||
|
||||
public boolean areTrialsOpened() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBackButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBackButtonPressed() {
|
||||
this.mc.displayGuiScreen(new GuiMainPage(this.previousScreen));
|
||||
}
|
||||
|
||||
public boolean hasSearchBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasBookmarkButtons() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSmallFontSize() {
|
||||
return this.smallFontSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMediumFontSize() {
|
||||
return this.mediumFontSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLargeFontSize() {
|
||||
return this.largeFontSize;
|
||||
}
|
||||
|
||||
public void onSearchBarChanged(String searchBarText) {
|
||||
GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage;
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
if (this.hasPageLeftButton() && button == this.buttonLeft) {
|
||||
this.onPageLeftButtonPressed();
|
||||
} else if (this.hasPageRightButton() && button == this.buttonRight) {
|
||||
this.onPageRightButtonPressed();
|
||||
} else if (this.hasBackButton() && button == this.buttonBack) {
|
||||
this.onBackButtonPressed();
|
||||
}
|
||||
if (button == this.buttonTrials) {
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false));
|
||||
} else if (this.hasBookmarkButtons() && button instanceof BookmarkButton) {
|
||||
int index = ArrayUtils.indexOf(this.bookmarkButtons, button);
|
||||
if (index >= 0) {
|
||||
this.bookmarkButtons[index].onPressed();
|
||||
}
|
||||
} else {
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int key) throws IOException {
|
||||
if (key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused())) {
|
||||
this.mc.displayGuiScreen(this.previousScreen);
|
||||
} else if (this.hasSearchBar() & this.searchField.isFocused()) {
|
||||
String lastText = this.searchField.getText();
|
||||
|
||||
this.searchField.textboxKeyTyped(typedChar, key);
|
||||
|
||||
if (!lastText.equals(this.searchField.getText())) {
|
||||
this.onSearchBarChanged(this.searchField.getText());
|
||||
}
|
||||
} else {
|
||||
super.keyTyped(typedChar, key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale) {
|
||||
StringUtil.renderScaledAsciiString(this.fontRenderer, text, x, y, color, shadow, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length) {
|
||||
StringUtil.renderSplitScaledAsciiString(this.fontRenderer, text, x, y, color, shadow, scale, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GuiButton> getButtonList() {
|
||||
return this.buttonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGuiLeft() {
|
||||
return this.guiLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGuiTop() {
|
||||
return this.guiTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeX() {
|
||||
return this.xSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeY() {
|
||||
return this.ySize;
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.booklet.button.EntryButton;
|
||||
import de.ellpeck.actuallyadditions.booklet.entry.BookletEntryTrials;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEntry extends GuiBooklet {
|
||||
|
||||
//The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead.
|
||||
private final int entryPage;
|
||||
private final int pageAmount;
|
||||
private final IBookletEntry entry;
|
||||
private final List<IBookletChapter> chapters;
|
||||
private final String searchText;
|
||||
private final boolean focusSearch;
|
||||
|
||||
public GuiEntry(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) {
|
||||
super(previousScreen, parentPage);
|
||||
this.entryPage = entryPage;
|
||||
this.entry = entry;
|
||||
this.searchText = search;
|
||||
this.focusSearch = focusSearch;
|
||||
this.chapters = entry.getChaptersForDisplay(search);
|
||||
|
||||
if (!this.chapters.isEmpty()) {
|
||||
IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
|
||||
this.pageAmount = lastChap == null ? 1 : calcEntryPage(this.entry, lastChap, this.searchText) + 1;
|
||||
} else {
|
||||
this.pageAmount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public GuiEntry(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) {
|
||||
this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
|
||||
}
|
||||
|
||||
private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) {
|
||||
int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc);
|
||||
return index / (BUTTONS_PER_PAGE * 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreenPre(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(mouseX, mouseY, partialTicks);
|
||||
|
||||
String name = this.entry.getLocalizedName();
|
||||
this.fontRenderer.drawString(name, this.guiLeft + this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, this.guiTop - 1, 0xFFFFFF, true);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
String pageStrg = "Page " + (this.entryPage * 2 + i + 1) + "/" + this.pageAmount * 2;
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
if (this.hasSearchBar() && this.searchText != null) {
|
||||
this.searchField.setText(this.searchText);
|
||||
if (this.focusSearch) {
|
||||
this.searchField.setFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2;
|
||||
for (int x = 0; x < 2; x++) {
|
||||
for (int y = 0; y < BUTTONS_PER_PAGE; y++) {
|
||||
int id = y + x * BUTTONS_PER_PAGE;
|
||||
if (this.chapters.size() > id + idOffset) {
|
||||
IBookletChapter chapter = this.chapters.get(id + idOffset);
|
||||
this.buttonList.add(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
if (button instanceof EntryButton) {
|
||||
int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2;
|
||||
|
||||
if (this.chapters.size() > actualId) {
|
||||
IBookletChapter chapter = this.chapters.get(actualId);
|
||||
if (chapter != null) {
|
||||
IBookletPage[] pages = chapter.getAllPages();
|
||||
if (pages != null && pages.length > 0) {
|
||||
this.mc.displayGuiScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPageLeftButton() {
|
||||
return this.entryPage > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageLeftButtonPressed() {
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPageRightButton() {
|
||||
return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageRightButtonPressed() {
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackButtonPressed() {
|
||||
if (!isShiftKeyDown()) {
|
||||
this.mc.displayGuiScreen(this.parentPage);
|
||||
} else {
|
||||
super.onBackButtonPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areTrialsOpened() {
|
||||
return this.entry instanceof BookletEntryTrials;
|
||||
}
|
||||
}
|
|
@ -1,238 +0,0 @@
|
|||
/*
|
||||
* This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.booklet.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||
import de.ellpeck.actuallyadditions.booklet.button.EntryButton;
|
||||
import de.ellpeck.actuallyadditions.common.config.GuiConfiguration;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData.PlayerSave;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.common.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
//TODO Fix achievement button
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMainPage extends GuiBooklet {
|
||||
|
||||
private static final String[] QUOTES = new String[] { "Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best I’ve seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしい!ただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc" };
|
||||
|
||||
//private TexturedButton achievementButton;
|
||||
private TexturedButton configButton;
|
||||
|
||||
private GuiButton tutorialButton;
|
||||
private boolean showTutorial;
|
||||
|
||||
private String bookletName;
|
||||
private String bookletEdition;
|
||||
|
||||
private List<String> quote;
|
||||
private String quoteGuy;
|
||||
|
||||
public GuiMainPage(GuiScreen previousScreen) {
|
||||
super(previousScreen, null);
|
||||
}
|
||||
|
||||
private static List<IBookletEntry> getDisplayedEntries() {
|
||||
List<IBookletEntry> displayed = new ArrayList<>();
|
||||
|
||||
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
|
||||
if (entry.visibleOnFrontPage()) {
|
||||
displayed.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return displayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int flavor = 1;
|
||||
if (this.mc.world.rand.nextFloat() <= 0.1) {
|
||||
flavor = MathHelper.getInt(this.mc.world.rand, 2, 7);
|
||||
}
|
||||
this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
|
||||
|
||||
String usedQuote = QUOTES[this.mc.world.rand.nextInt(QUOTES.length)];
|
||||
String[] quoteSplit = usedQuote.split("@");
|
||||
if (quoteSplit.length == 2) {
|
||||
this.quote = this.fontRenderer.listFormattedStringToWidth(quoteSplit[0], 120);
|
||||
this.quoteGuy = quoteSplit[1];
|
||||
}
|
||||
|
||||
String playerName = this.mc.player.getName();
|
||||
if (playerName.equalsIgnoreCase("dqmhose")) {
|
||||
this.bookletEdition = "Pants Edition";
|
||||
} else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
|
||||
this.bookletEdition = "Illustrator's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("KittyVanCat")) {
|
||||
this.bookletEdition = "Cat's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("canitzp")) {
|
||||
this.bookletEdition = "P's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("direwolf20")) {
|
||||
this.bookletEdition = "Edition 20";
|
||||
} else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) {
|
||||
this.bookletEdition = "Derp's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("mezz")) {
|
||||
this.bookletEdition = "Just Enough Editions";
|
||||
} else if (playerName.equalsIgnoreCase("amadornes")) {
|
||||
this.bookletEdition = "Beard's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("raoul")) {
|
||||
this.bookletEdition = "Giraffe's Edition";
|
||||
} else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
|
||||
String[] colors = new String[15];
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
colors[i] = TextFormatting.fromColorIndex(this.mc.world.rand.nextInt(15)).toString() + TextFormatting.ITALIC;
|
||||
}
|
||||
this.bookletEdition = String.format("%sC%so%sl%so%sr%sf%su%sl %sE%sd%si%st%si%so%sn", (Object[]) colors);
|
||||
} else if (playerName.equalsIgnoreCase("oitsjustjose")) {
|
||||
this.bookletEdition = "oitsjustanedition";
|
||||
} else if (playerName.equalsIgnoreCase("xbony2")) {
|
||||
this.bookletEdition = "Naughty Edition";
|
||||
} else if (playerName.equalsIgnoreCase("themattabase")) {
|
||||
this.bookletEdition = "Withered Edition";
|
||||
} else if (playerName.equalsIgnoreCase("robsonld04")) {
|
||||
this.bookletEdition = "Modpack Edition";
|
||||
} else if (playerName.equalsIgnoreCase("snowshock35")) {
|
||||
this.bookletEdition = "Edition 35";
|
||||
} else if (playerName.equalsIgnoreCase("asiekierka")) {
|
||||
this.bookletEdition = "‽ Edition";
|
||||
} else if (playerName.equalsIgnoreCase("elucent")) {
|
||||
this.bookletEdition = "";
|
||||
} else {
|
||||
if (Util.isDevVersion()) {
|
||||
this.bookletEdition = "Dev's Edition";
|
||||
} else {
|
||||
this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> configText = new ArrayList<>();
|
||||
configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
|
||||
configText.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200));
|
||||
this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText);
|
||||
this.buttonList.add(this.configButton);
|
||||
|
||||
List<String> achievementText = new ArrayList<>();
|
||||
achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name"));
|
||||
achievementText.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200));
|
||||
//this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText);
|
||||
//this.buttonList.add(this.achievementButton);
|
||||
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
||||
if (!data.didBookTutorial) {
|
||||
this.showTutorial = true;
|
||||
|
||||
this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
|
||||
this.buttonList.add(this.tutorialButton);
|
||||
|
||||
this.configButton.visible = false;
|
||||
//this.achievementButton.visible = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BUTTONS_PER_PAGE; i++) {
|
||||
List<IBookletEntry> displayed = getDisplayedEntries();
|
||||
if (displayed.size() > i) {
|
||||
IBookletEntry entry = displayed.get(i);
|
||||
this.buttonList.add(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
if (button instanceof EntryButton) {
|
||||
List<IBookletEntry> displayed = getDisplayedEntries();
|
||||
if (displayed.size() > button.id) {
|
||||
IBookletEntry entry = displayed.get(button.id);
|
||||
if (entry != null) {
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*else if(button == this.achievementButton){
|
||||
GuiScreen achievements = new GuiAAAchievements(this, this.mc.player.getStatFileWriter());
|
||||
this.mc.displayGuiScreen(achievements);
|
||||
}*/
|
||||
else if (button == this.configButton) {
|
||||
GuiScreen config = new GuiConfiguration(this);
|
||||
this.mc.displayGuiScreen(config);
|
||||
} else if (this.showTutorial && button == this.tutorialButton) {
|
||||
if (this.hasBookmarkButtons()) {
|
||||
if (!isShiftKeyDown()) {
|
||||
for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) {
|
||||
this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0];
|
||||
}
|
||||
}
|
||||
this.showTutorial = false;
|
||||
this.tutorialButton.visible = false;
|
||||
|
||||
this.configButton.visible = true;
|
||||
//this.achievementButton.visible = true;
|
||||
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
||||
data.didBookTutorial = true;
|
||||
PacketHandlerHelper.sendPlayerDataToServer(false, 1);
|
||||
}
|
||||
} else {
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreenPre(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(mouseX, mouseY, partialTicks);
|
||||
|
||||
String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName);
|
||||
this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 19, 0);
|
||||
strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2");
|
||||
this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 19 + this.fontRenderer.FONT_HEIGHT, 0);
|
||||
|
||||
strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition;
|
||||
this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 40, 0);
|
||||
|
||||
if (this.showTutorial) {
|
||||
String text = TextFormatting.BLUE + "It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with " + ActuallyAdditions.NAME + "! \nIf you don't want this, shift-click the button.";
|
||||
this.renderSplitScaledAsciiString(text, this.guiLeft + 11, this.guiTop + 55, 0, false, this.getMediumFontSize(), 120);
|
||||
} else if (this.quote != null && !this.quote.isEmpty() && this.quoteGuy != null) {
|
||||
int quoteSize = this.quote.size();
|
||||
|
||||
for (int i = 0; i < quoteSize; i++) {
|
||||
this.renderScaledAsciiString(TextFormatting.ITALIC + this.quote.get(i), this.guiLeft + 25, this.guiTop + 90 + i * 8, 0, false, this.getMediumFontSize());
|
||||
}
|
||||
this.renderScaledAsciiString("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,274 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.ItemDisplay;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPage extends GuiBooklet {
|
||||
|
||||
public final IBookletPage[] pages = new IBookletPage[2];
|
||||
private final List<ItemDisplay> itemDisplays = new ArrayList<>();
|
||||
private int pageTimer;
|
||||
|
||||
private GuiButton buttonViewOnline;
|
||||
|
||||
public GuiPage(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) {
|
||||
super(previousScreen, parentPage);
|
||||
|
||||
this.pages[0] = page1;
|
||||
this.pages[1] = page2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
for (ItemDisplay display : this.itemDisplays) {
|
||||
display.onMousePress(mouseButton, mouseX, mouseY);
|
||||
}
|
||||
|
||||
for (IBookletPage page : this.pages) {
|
||||
if (page != null) {
|
||||
page.mouseClicked(this, mouseX, mouseY, mouseButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY, int state) {
|
||||
super.mouseReleased(mouseX, mouseY, state);
|
||||
|
||||
for (IBookletPage page : this.pages) {
|
||||
if (page != null) {
|
||||
page.mouseReleased(this, mouseX, mouseY, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
|
||||
for (IBookletPage page : this.pages) {
|
||||
if (page != null) {
|
||||
page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) throws IOException {
|
||||
if (button == this.buttonViewOnline) {
|
||||
List<String> links = this.getWebLinks();
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
for (String link : links) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(link));
|
||||
} catch (Exception e) {
|
||||
ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.actionPerformed(button);
|
||||
|
||||
for (IBookletPage page : this.pages) {
|
||||
if (page != null) {
|
||||
page.actionPerformed(this, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
this.itemDisplays.clear();
|
||||
super.initGui();
|
||||
|
||||
List<String> links = this.getWebLinks();
|
||||
if (links != null && !links.isEmpty()) {
|
||||
this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, -782822, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")));
|
||||
this.buttonList.add(this.buttonViewOnline);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.pages.length; i++) {
|
||||
IBookletPage page = this.pages[i];
|
||||
if (page != null) {
|
||||
page.initGui(this, this.guiLeft + 6 + i * 142, this.guiTop + 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getWebLinks() {
|
||||
List<String> links = new ArrayList<>();
|
||||
|
||||
for (IBookletPage page : this.pages) {
|
||||
if (page != null) {
|
||||
String link = page.getWebLink();
|
||||
if (link != null && !links.contains(link)) {
|
||||
links.add(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
|
||||
for (int i = 0; i < this.pages.length; i++) {
|
||||
IBookletPage page = this.pages[i];
|
||||
if (page != null) {
|
||||
page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer);
|
||||
}
|
||||
}
|
||||
|
||||
this.pageTimer++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreenPre(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(mouseX, mouseY, partialTicks);
|
||||
|
||||
if (this.pages[0] != null) {
|
||||
IBookletChapter chapter = this.pages[0].getChapter();
|
||||
String name = chapter.getLocalizedName();
|
||||
this.fontRenderer.drawString(name, this.guiLeft + this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, this.guiTop - 1, 0xFFFFFF, true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.pages.length; i++) {
|
||||
IBookletPage page = this.pages[i];
|
||||
if (page != null) {
|
||||
IBookletChapter chapter = this.pages[i].getChapter();
|
||||
String pageStrg = "Page " + (chapter.getPageIndex(this.pages[i]) + 1) + "/" + chapter.getAllPages().length;
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
for (ItemDisplay display : this.itemDisplays) {
|
||||
display.drawPre();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreenPost(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPost(mouseX, mouseY, partialTicks);
|
||||
|
||||
for (int i = 0; i < this.pages.length; i++) {
|
||||
IBookletPage page = this.pages[i];
|
||||
if (page != null) {
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
for (ItemDisplay display : this.itemDisplays) {
|
||||
display.drawPost(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
|
||||
for (ItemDisplay display : this.itemDisplays) {
|
||||
if (display.x == x && display.y == y && display.scale == scale) {
|
||||
display.stack = renderedStack;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPageLeftButton() {
|
||||
IBookletPage page = this.pages[0];
|
||||
if (page != null) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
if (chapter != null) { return chapter.getPageIndex(page) > 0; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageLeftButtonPressed() {
|
||||
IBookletPage page = this.pages[0];
|
||||
if (page != null) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
if (chapter != null) {
|
||||
IBookletPage[] pages = chapter.getAllPages();
|
||||
|
||||
int pageNumToOpen = chapter.getPageIndex(page) - 1;
|
||||
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
|
||||
this.mc.displayGuiScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPageRightButton() {
|
||||
IBookletPage page = this.pages[1];
|
||||
if (page != null) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
if (chapter != null) {
|
||||
int pageIndex = chapter.getPageIndex(page);
|
||||
int pageAmount = chapter.getAllPages().length;
|
||||
return pageIndex + 1 < pageAmount;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageRightButtonPressed() {
|
||||
IBookletPage page = this.pages[1];
|
||||
if (page != null) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
if (chapter != null) {
|
||||
IBookletPage[] pages = chapter.getAllPages();
|
||||
|
||||
int pageNumToOpen = chapter.getPageIndex(page) + 1;
|
||||
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
|
||||
this.mc.displayGuiScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackButtonPressed() {
|
||||
if (!isShiftKeyDown()) {
|
||||
this.mc.displayGuiScreen(this.parentPage);
|
||||
} else {
|
||||
super.onBackButtonPressed();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.misc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiEntry;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiMainPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiPage;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public final class BookletUtils {
|
||||
|
||||
public static IBookletPage findFirstPageForStack(ItemStack stack) {
|
||||
for (IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA) {
|
||||
List<ItemStack> stacks = NonNullList.create();
|
||||
page.getItemStacksForPage(stacks);
|
||||
if (stacks != null && !stacks.isEmpty()) {
|
||||
for (ItemStack pageStack : stacks) {
|
||||
if (ItemUtil.areItemsEqual(pageStack, stack, true)) { return page; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) {
|
||||
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
||||
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
GuiEntry entry = new GuiEntry(previousScreen, mainPage, chapter.getEntry(), chapter, "", false);
|
||||
|
||||
return createPageGui(previousScreen, entry, page);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
|
||||
IBookletChapter chapter = page.getChapter();
|
||||
|
||||
IBookletPage[] allPages = chapter.getAllPages();
|
||||
int pageIndex = chapter.getPageIndex(page);
|
||||
IBookletPage page1;
|
||||
IBookletPage page2;
|
||||
|
||||
if (page.shouldBeOnLeftSide()) {
|
||||
page1 = page;
|
||||
page2 = pageIndex >= allPages.length - 1 ? null : allPages[pageIndex + 1];
|
||||
} else {
|
||||
page1 = pageIndex <= 0 ? null : allPages[pageIndex - 1];
|
||||
page2 = page;
|
||||
}
|
||||
|
||||
return new GuiPage(previousScreen, parentPage, page1, page2);
|
||||
}
|
||||
|
||||
public static IBookletPage getBookletPageById(String id) {
|
||||
if (id != null) {
|
||||
for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) {
|
||||
for (IBookletPage page : chapter.getAllPages()) {
|
||||
if (id.equals(page.getIdentifier())) { return page; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
//TODO Achievement GUI?
|
||||
/*
|
||||
package de.ellpeck.actuallyadditions.booklet.misc;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.achievement.InitAchievements;
|
||||
import de.ellpeck.actuallyadditions.common.util.ModUtil;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.achievement.GuiAchievements;
|
||||
import net.minecraft.stats.StatisticsManager;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* (Partially excerpted from Botania by Vazkii with permission, thanks!)
|
||||
*
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAAAchievements extends GuiAchievements{
|
||||
|
||||
public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){
|
||||
super(screen, statistics);
|
||||
try{
|
||||
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 20);
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Something went wrong trying to open the Achievements GUI!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
try{
|
||||
this.buttonList.remove(1);
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Something went wrong trying to initialize the Achievements GUI!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int key) throws IOException{
|
||||
if(key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode()){
|
||||
this.mc.displayGuiScreen(this.parentScreen);
|
||||
}
|
||||
else{
|
||||
super.keyTyped(typedChar, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -1,191 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class BookletPage implements IBookletPage {
|
||||
|
||||
protected final HashMap<String, String> textReplacements = new HashMap<>();
|
||||
protected final int localizationKey;
|
||||
private final int priority;
|
||||
private final List<ItemStack> itemsForPage = new ArrayList<>();
|
||||
private final List<FluidStack> fluidsForPage = new ArrayList<>();
|
||||
protected IBookletChapter chapter;
|
||||
protected boolean hasNoText;
|
||||
|
||||
public BookletPage(int localizationKey) {
|
||||
this(localizationKey, 0);
|
||||
}
|
||||
|
||||
public BookletPage(int localizationKey, int priority) {
|
||||
this.localizationKey = localizationKey;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
list.addAll(this.itemsForPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFluidStacksForPage(List<FluidStack> list) {
|
||||
list.addAll(this.fluidsForPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletChapter getChapter() {
|
||||
return this.chapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChapter(IBookletChapter chapter) {
|
||||
this.chapter = chapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public String getInfoText() {
|
||||
if (this.hasNoText) { return null; }
|
||||
|
||||
String base = StringUtil.localize(this.getLocalizationKey());
|
||||
base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + "");
|
||||
base = base.replaceAll("<item>", TextFormatting.BLUE + "");
|
||||
base = base.replaceAll("<r>", TextFormatting.BLACK + "");
|
||||
base = base.replaceAll("<n>", "\n");
|
||||
base = base.replaceAll("<i>", TextFormatting.ITALIC + "");
|
||||
base = base.replaceAll("<tifisgrin>", TextFormatting.DARK_RED + "" + TextFormatting.UNDERLINE); //This is fucking important so go read it now
|
||||
|
||||
for (Map.Entry<String, String> entry : this.textReplacements.entrySet()) {
|
||||
base = base.replaceAll(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
@OnlyIn(Side.CLIENT)
|
||||
protected String getLocalizationKey() {
|
||||
return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Side.CLIENT)
|
||||
public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeOnLeftSide() {
|
||||
return (this.chapter.getPageIndex(this) + 1) % 2 != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.chapter.getIdentifier() + "." + this.chapter.getPageIndex(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebLink() {
|
||||
return "http://ellpeck.de/actaddmanual#" + this.chapter.getIdentifier();
|
||||
}
|
||||
|
||||
public BookletPage setNoText() {
|
||||
this.hasNoText = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPage addFluidToPage(Fluid fluid) {
|
||||
this.fluidsForPage.add(new FluidStack(fluid, 1));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPage addItemsToPage(Block... blocks) {
|
||||
for (Block block : blocks) {
|
||||
this.addItemsToPage(new ItemStack(block));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPage addItemsToPage(ItemStack... stacks) {
|
||||
Collections.addAll(this.itemsForPage, stacks);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookletPage addTextReplacement(String key, String value) {
|
||||
this.textReplacements.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookletPage addTextReplacement(String key, float value) {
|
||||
return this.addTextReplacement(key, Float.toString(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookletPage addTextReplacement(String key, int value) {
|
||||
return this.addTextReplacement(key, Integer.toString(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.util.ITooltipFlag.TooltipFlags;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDisplay {
|
||||
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final float scale;
|
||||
private final GuiPage gui;
|
||||
private final IBookletPage page;
|
||||
public ItemStack stack;
|
||||
|
||||
public ItemDisplay(GuiPage gui, int x, int y, float scale, ItemStack stack, boolean shouldTryTransfer) {
|
||||
this.gui = gui;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.scale = scale;
|
||||
this.stack = stack;
|
||||
this.page = shouldTryTransfer ? BookletUtils.findFirstPageForStack(stack) : null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawPre() {
|
||||
AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawPost(int mouseX, int mouseY) {
|
||||
if (this.isHovered(mouseX, mouseY)) {
|
||||
Minecraft mc = this.gui.mc;
|
||||
boolean flagBefore = mc.fontRenderer.getUnicodeFlag();
|
||||
mc.fontRenderer.setUnicodeFlag(false);
|
||||
|
||||
List<String> list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k) {
|
||||
if (k == 0) {
|
||||
list.set(k, this.stack.getItem().getForgeRarity(this.stack).getColor() + list.get(k));
|
||||
} else {
|
||||
list.set(k, TextFormatting.GRAY + list.get(k));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) {
|
||||
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".clickToSeeRecipe"));
|
||||
}
|
||||
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
|
||||
|
||||
mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||
}
|
||||
}
|
||||
|
||||
public void onMousePress(int button, int mouseX, int mouseY) {
|
||||
if (button == 0 && this.isHovered(mouseX, mouseY)) {
|
||||
if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) {
|
||||
this.gui.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
|
||||
GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page);
|
||||
this.gui.mc.displayGuiScreen(gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHovered(int mouseX, int mouseY) {
|
||||
return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 16 * this.scale && mouseY < this.y + 16 * this.scale;
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageCoffeeMachine extends BookletPage {
|
||||
|
||||
private final CoffeeIngredient ingredient;
|
||||
private final ItemStack outcome;
|
||||
private int counter = 0;
|
||||
private int rotate = 0;
|
||||
private final ItemStack[] stacks;
|
||||
|
||||
public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) {
|
||||
super(localizationKey);
|
||||
this.ingredient = ingredient;
|
||||
this.stacks = ingredient.getInput().getMatchingStacks();
|
||||
|
||||
this.outcome = new ItemStack(InitItems.itemCoffee);
|
||||
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize());
|
||||
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX + 5, startY + 51, 0, false, gui.getSmallFontSize(), 35);
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90);
|
||||
|
||||
if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
gui.addOrModifyItemRenderer(this.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false);
|
||||
|
||||
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX + 5 + 37, startY + 10 + 1, 1F, true);
|
||||
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffee), startX + 5 + 1, startY + 10 + 1, 1F, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
list.add(this.outcome);
|
||||
}
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.RefHelp;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import de.ellpeck.actuallyadditions.common.util.crafting.BlankRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class PageCrafting extends BookletPage {
|
||||
|
||||
private final List<IRecipe> recipes;
|
||||
private int recipeAt;
|
||||
private String recipeTypeLocKey;
|
||||
private boolean isWildcard;
|
||||
|
||||
public PageCrafting(int localizationKey, int priority, List<IRecipe> recipes) {
|
||||
super(localizationKey, priority);
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public PageCrafting(int localizationKey, List<IRecipe> recipes) {
|
||||
this(localizationKey, 0, recipes);
|
||||
}
|
||||
|
||||
public PageCrafting(int localizationKey, IRecipe... recipes) {
|
||||
this(localizationKey, 0, recipes);
|
||||
}
|
||||
|
||||
public PageCrafting(int localizationKey, int priority, IRecipe... recipes) {
|
||||
this(localizationKey, priority, Arrays.asList(recipes));
|
||||
}
|
||||
|
||||
public BookletPage setWildcard() {
|
||||
this.isWildcard = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0);
|
||||
|
||||
if (recipeTypeLocKey != null) gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
|
||||
super.updateScreen(gui, startX, startY, pageTimer);
|
||||
|
||||
if (pageTimer % 20 == 0) {
|
||||
this.findRecipe(gui, startX, startY);
|
||||
}
|
||||
}
|
||||
|
||||
private void findRecipe(GuiBookletBase gui, int startX, int startY) {
|
||||
if (!this.recipes.isEmpty()) {
|
||||
IRecipe recipe = this.recipes.get(this.recipeAt);
|
||||
if (recipe != null) {
|
||||
this.setupRecipe(gui, recipe, startX, startY);
|
||||
}
|
||||
|
||||
this.recipeAt++;
|
||||
if (this.recipeAt >= this.recipes.size()) {
|
||||
this.recipeAt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
this.findRecipe(gui, startX, startY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
if (!this.recipes.isEmpty()) {
|
||||
for (IRecipe recipe : this.recipes) {
|
||||
if (recipe != null) {
|
||||
ItemStack output = recipe.getRecipeOutput();
|
||||
if (StackUtil.isValid(output)) {
|
||||
ItemStack copy = output.copy();
|
||||
if (this.isWildcard) {
|
||||
copy.setItemDamage(Util.WILDCARD);
|
||||
}
|
||||
list.add(copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupRecipe(GuiBookletBase gui, IRecipe recipe, int startX, int startY) {
|
||||
Ingredient[] ings = new Ingredient[9];
|
||||
int width = 3;
|
||||
int height = 3;
|
||||
|
||||
if (recipe instanceof BlankRecipe) {
|
||||
this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled";
|
||||
gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX + 100, startY + 25, 1F, false);
|
||||
return;
|
||||
} else if (recipe instanceof ShapedRecipes) {
|
||||
ShapedRecipes shaped = (ShapedRecipes) recipe;
|
||||
width = shaped.recipeWidth;
|
||||
height = shaped.recipeHeight;
|
||||
ings = shaped.recipeItems.toArray(new Ingredient[shaped.recipeItems.size()]);
|
||||
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedRecipe";
|
||||
} else if (recipe instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
|
||||
for (int i = 0; i < shapeless.recipeItems.size(); i++) {
|
||||
ings[i] = shapeless.recipeItems.get(i);
|
||||
}
|
||||
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessRecipe";
|
||||
} else if (recipe instanceof ShapedOreRecipe) {
|
||||
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
|
||||
try {
|
||||
width = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
|
||||
height = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
|
||||
} catch (Exception e) {
|
||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to get the Crafting Recipe in the booklet to display!", e);
|
||||
}
|
||||
for (int i = 0; i < shaped.getIngredients().size(); i++) {
|
||||
ings[i] = shaped.getIngredients().get(i);
|
||||
}
|
||||
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedOreRecipe";
|
||||
} else if (recipe instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
|
||||
for (int i = 0; i < shapeless.getIngredients().size(); i++) {
|
||||
ings[i] = shapeless.getIngredients().get(i);
|
||||
}
|
||||
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe";
|
||||
}
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
Ingredient ing = ings[y * width + x];
|
||||
if (ing != null) {
|
||||
ItemStack[] stacks = ing.getMatchingStacks();
|
||||
if (stacks != null && stacks.length > 0) {
|
||||
ItemStack stack = stacks[0];
|
||||
if (StackUtil.isValid(stack)) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.setCount(1);
|
||||
if (copy.getItemDamage() == Util.WILDCARD) {
|
||||
copy.setItemDamage(0);
|
||||
}
|
||||
|
||||
gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX + 100, startY + 25, 1F, false);
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageCrusherRecipe extends BookletPage {
|
||||
|
||||
private final CrusherRecipe recipe;
|
||||
private int counter = 0;
|
||||
private int rotate = 0;
|
||||
private final ItemStack[] stacks;
|
||||
|
||||
public PageCrusherRecipe(int localizationKey, CrusherRecipe recipe) {
|
||||
super(localizationKey);
|
||||
this.recipe = recipe;
|
||||
this.stacks = recipe.getInput().getMatchingStacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
|
||||
|
||||
if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
if (this.recipe != null) {
|
||||
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.recipe.getOutputOne(), startX + 38 + 4, startY + 6 + 53, 1F, false);
|
||||
|
||||
if (StackUtil.isValid(this.recipe.getOutputTwo())) {
|
||||
gui.addOrModifyItemRenderer(this.recipe.getOutputTwo(), startX + 38 + 30, startY + 6 + 53, 1F, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
if (this.recipe != null) {
|
||||
list.add(this.recipe.getOutputOne());
|
||||
|
||||
if (StackUtil.isValid(this.recipe.getOutputTwo())) {
|
||||
list.add(this.recipe.getOutputTwo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageEmpowerer extends BookletPage {
|
||||
|
||||
private final EmpowererRecipe recipe;
|
||||
private int counter = 0;
|
||||
private int rotate = 0;
|
||||
ItemStack[] inputs;
|
||||
ItemStack[] stand1;
|
||||
ItemStack[] stand2;
|
||||
ItemStack[] stand3;
|
||||
ItemStack[] stand4;
|
||||
|
||||
public PageEmpowerer(int localizationKey, EmpowererRecipe recipe) {
|
||||
super(localizationKey);
|
||||
this.recipe = recipe;
|
||||
if (recipe != null) {
|
||||
this.inputs = recipe.getInput().getMatchingStacks();
|
||||
this.stand1 = recipe.getStandOne().getMatchingStacks();
|
||||
this.stand2 = recipe.getStandTwo().getMatchingStacks();
|
||||
this.stand3 = recipe.getStandThree().getMatchingStacks();
|
||||
this.stand4 = recipe.getStandFour().getMatchingStacks();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
|
||||
if (this.recipe != null) this.updateInputs(gui, startX, startY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
if (this.recipe != null) {
|
||||
gui.addOrModifyItemRenderer(this.stand1[0], startX + 5 + 26, startY + 10 + 1, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand2[0], startX + 5 + 1, startY + 10 + 26, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand3[0], startX + 5 + 51, startY + 10 + 26, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand4[0], startX + 5 + 26, startY + 10 + 51, 1F, true);
|
||||
|
||||
gui.addOrModifyItemRenderer(this.inputs[0], startX + 5 + 26, startY + 10 + 26, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 5 + 96, startY + 10 + 26, 1F, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateInputs(GuiBookletBase gui, int startX, int startY) {
|
||||
if (this.counter++ % 50 == 0) {
|
||||
this.rotate++;
|
||||
gui.addOrModifyItemRenderer(this.stand1[this.rotate % this.stand1.length], startX + 5 + 26, startY + 10 + 1, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand2[this.rotate % this.stand2.length], startX + 5 + 1, startY + 10 + 26, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand3[this.rotate % this.stand3.length], startX + 5 + 51, startY + 10 + 26, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.stand4[this.rotate % this.stand4.length], startX + 5 + 26, startY + 10 + 51, 1F, true);
|
||||
|
||||
gui.addOrModifyItemRenderer(this.inputs[this.rotate % this.inputs.length], startX + 5 + 26, startY + 10 + 26, 1F, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
if (this.recipe != null) {
|
||||
list.add(this.recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority() {
|
||||
return 20;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageFurnace extends BookletPage {
|
||||
|
||||
private final ItemStack input;
|
||||
private final ItemStack output;
|
||||
|
||||
public PageFurnace(int localizationKey, ItemStack output) {
|
||||
this(localizationKey, output, 0);
|
||||
}
|
||||
|
||||
public PageFurnace(int localizationKey, ItemStack output, int priority) {
|
||||
super(localizationKey, priority);
|
||||
this.output = output;
|
||||
this.input = getInputForOutput(output);
|
||||
}
|
||||
|
||||
private static ItemStack getInputForOutput(ItemStack output) {
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
|
||||
ItemStack stack = entry.getValue();
|
||||
if (StackUtil.isValid(stack)) {
|
||||
if (stack.isItemEqual(output)) { return entry.getKey(); }
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 57);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
list.add(this.output);
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.net.URI;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageLinkButton extends BookletPage {
|
||||
|
||||
public static int nextButtonId = 23782;
|
||||
private final int buttonId;
|
||||
|
||||
private final String link;
|
||||
|
||||
public PageLinkButton(int localizationKey, String link) {
|
||||
super(localizationKey);
|
||||
this.link = link;
|
||||
|
||||
this.buttonId = nextButtonId;
|
||||
nextButtonId++;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
gui.getButtonList().add(new GuiButton(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
|
||||
if (button.id == this.buttonId) {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(this.link));
|
||||
} catch (Exception e) {
|
||||
ActuallyAdditions.LOGGER.error("Couldn't open website from Link Button page!", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.actionPerformed(gui, button);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PagePicture extends BookletPage {
|
||||
|
||||
private final ResourceLocation resLoc;
|
||||
private final int yTextOffset;
|
||||
|
||||
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
|
||||
super(localizationKey, priority);
|
||||
this.resLoc = resLoc;
|
||||
this.yTextOffset = yTextOffset;
|
||||
}
|
||||
|
||||
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
|
||||
super(localizationKey);
|
||||
this.yTextOffset = yTextOffset;
|
||||
this.resLoc = resLoc;
|
||||
}
|
||||
|
||||
public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
|
||||
this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(this.resLoc);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageReconstructor extends BookletPage {
|
||||
|
||||
private final LensConversionRecipe recipe;
|
||||
private boolean isWildcard;
|
||||
private int counter = 0;
|
||||
private int rotate = 0;
|
||||
private ItemStack[] stacks;
|
||||
|
||||
public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
|
||||
super(localizationKey);
|
||||
this.recipe = recipe;
|
||||
if (recipe != null) this.stacks = recipe.getInput().getMatchingStacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
|
||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
|
||||
if (this.recipe != null) {
|
||||
if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
if (this.recipe != null) {
|
||||
gui.addOrModifyItemRenderer(this.stacks[0], startX + 30 + 1, startY + 10 + 13, 1F, true);
|
||||
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 30 + 47, startY + 10 + 13, 1F, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemStacksForPage(List<ItemStack> list) {
|
||||
super.getItemStacksForPage(list);
|
||||
|
||||
if (this.recipe != null) {
|
||||
ItemStack copy = this.recipe.getOutput().copy();
|
||||
if (this.isWildcard) {
|
||||
copy.setItemDamage(Util.WILDCARD);
|
||||
}
|
||||
list.add(copy);
|
||||
}
|
||||
}
|
||||
|
||||
public BookletPage setWildcard() {
|
||||
this.isWildcard = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority() {
|
||||
return 20;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageTextOnly extends BookletPage {
|
||||
|
||||
public PageTextOnly(int localizationKey, int priority) {
|
||||
super(localizationKey, priority);
|
||||
}
|
||||
|
||||
public PageTextOnly(int localizationKey) {
|
||||
super(localizationKey);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) {
|
||||
String text = page.getInfoText();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
renderTextToPage(gui, this, startX + 6, startY + 5);
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.booklet.page;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.common.data.PlayerData.PlayerSave;
|
||||
import de.ellpeck.actuallyadditions.common.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageTrials extends BookletPage {
|
||||
|
||||
private final int buttonId;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private GuiButton button;
|
||||
|
||||
public PageTrials(int localizationKey, boolean button, boolean text) {
|
||||
super(localizationKey);
|
||||
|
||||
if (!text) {
|
||||
this.setNoText();
|
||||
}
|
||||
|
||||
if (button) {
|
||||
this.buttonId = PageLinkButton.nextButtonId;
|
||||
PageLinkButton.nextButtonId++;
|
||||
} else {
|
||||
this.buttonId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||
super.initGui(gui, startX, startY);
|
||||
|
||||
if (this.buttonId >= 0) {
|
||||
this.button = new GuiButton(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, "");
|
||||
gui.getButtonList().add(this.button);
|
||||
this.updateButton();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected String getLocalizationKey() {
|
||||
return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
|
||||
if (this.buttonId >= 0 && button.id == this.buttonId) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||
String id = this.chapter.getIdentifier();
|
||||
|
||||
boolean completed = data.completedTrials.contains(id);
|
||||
if (completed) {
|
||||
data.completedTrials.remove(id);
|
||||
} else {
|
||||
data.completedTrials.add(id);
|
||||
}
|
||||
this.updateButton();
|
||||
|
||||
PacketHandlerHelper.sendPlayerDataToServer(false, 2);
|
||||
} else {
|
||||
super.actionPerformed(gui, button);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateButton() {
|
||||
if (this.buttonId >= 0 && this.button != null) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||
|
||||
boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
|
||||
if (completed) {
|
||||
this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name");
|
||||
} else {
|
||||
this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.client;
|
||||
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
public class ClientSetup {
|
||||
GuiUtils
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.common.config.ConfigurationHandler;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.CrusherCrafting;
|
||||
import de.ellpeck.actuallyadditions.common.data.WorldData;
|
||||
import de.ellpeck.actuallyadditions.common.entity.InitEntities;
|
||||
import de.ellpeck.actuallyadditions.common.event.CommonEvents;
|
||||
import de.ellpeck.actuallyadditions.common.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.common.gen.AAWorldGen;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemCoffee;
|
||||
import de.ellpeck.actuallyadditions.common.items.lens.LensMining;
|
||||
import de.ellpeck.actuallyadditions.common.items.lens.LensRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.common.items.lens.Lenses;
|
||||
import de.ellpeck.actuallyadditions.common.material.InitArmorMaterials;
|
||||
import de.ellpeck.actuallyadditions.common.material.InitToolMaterials;
|
||||
import de.ellpeck.actuallyadditions.common.misc.BannerHelper;
|
||||
import de.ellpeck.actuallyadditions.common.misc.DungeonLoot;
|
||||
import de.ellpeck.actuallyadditions.common.misc.apiimpl.LaserRelayConnectionHandler;
|
||||
import de.ellpeck.actuallyadditions.common.misc.apiimpl.MethodHandler;
|
||||
import de.ellpeck.actuallyadditions.common.network.PacketHandler;
|
||||
import de.ellpeck.actuallyadditions.common.proxy.IProxy;
|
||||
import de.ellpeck.actuallyadditions.common.recipe.EmpowererHandler;
|
||||
import de.ellpeck.actuallyadditions.common.recipe.HairyBallHandler;
|
||||
import de.ellpeck.actuallyadditions.common.recipe.TreasureChestHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.common.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.common.util.compat.CompatUtil;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryBuilder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(ActuallyAdditions.MODID)
|
||||
public class ActuallyAdditions {
|
||||
|
||||
public static final String MODID = ActuallyAdditionsAPI.MOD_ID;
|
||||
public static final String NAME = "Actually Additions";
|
||||
// public static final String VERSION = "@VERSION@";
|
||||
// public static final String GUIFACTORY = "de.ellpeck.actuallyadditions.common.config.GuiFactory";
|
||||
// public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)";
|
||||
// public static final boolean DEOBF = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(MODID);
|
||||
public static ActuallyAdditions INSTANCE;
|
||||
|
||||
public static boolean commonCapsLoaded = false;
|
||||
|
||||
// Creative Tab
|
||||
public static ItemGroup aaGroup = new ItemGroup(MODID) {
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(Items.PACKED_ICE); // placeholder until I've done the actual stuff @todo
|
||||
}
|
||||
};
|
||||
|
||||
public ActuallyAdditions() {
|
||||
INSTANCE = this;
|
||||
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
// Register registers
|
||||
InitBlocks.BLOCKS.register(bus);
|
||||
// items
|
||||
Lenses.LENSES.register(bus);
|
||||
|
||||
bus.addListener(this::setup);
|
||||
bus.addListener(this::clientSetup);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
|
||||
}
|
||||
|
||||
private void clientSetup(final FMLClientSetupEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStarted(FMLServerStartedEvent event) {
|
||||
// todo: come back to this if it's still needed after migrating the world save to a newer version
|
||||
|
||||
// MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
// if (server != null) {
|
||||
// World world = server.getEntityWorld();
|
||||
// if (world != null && !world.isRemote) {
|
||||
// WorldData.get(world, true).markDirty();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
WorldData.clear();
|
||||
}
|
||||
|
||||
|
||||
@SidedProxy(clientSide = "de.ellpeck.actuallyadditions.common.proxy.ClientProxy", serverSide = "de.ellpeck.actuallyadditions.common.proxy.ServerProxy")
|
||||
public static IProxy PROXY;
|
||||
|
||||
static {
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
ActuallyAdditions.LOGGER.info("Starting PreInitialization Phase...");
|
||||
|
||||
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
||||
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
||||
InitBooklet.preInit();
|
||||
CompatUtil.registerCraftingTweaks();
|
||||
|
||||
// commonCapsLoaded = Loader.isModLoaded("commoncapabilities");
|
||||
// MinecraftForge.EVENT_BUS.register(new RegistryHandler());
|
||||
|
||||
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
||||
PacketHandler.init();
|
||||
InitToolMaterials.init();
|
||||
InitArmorMaterials.init();
|
||||
InitFluids.init();
|
||||
new UpdateChecker();
|
||||
PROXY.preInit(event);
|
||||
|
||||
ActuallyAdditions.LOGGER.info("PreInitialization Finished.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
ActuallyAdditions.LOGGER.info("Starting Initialization Phase...");
|
||||
|
||||
BannerHelper.init();
|
||||
//InitAchievements.init();
|
||||
GuiHandler.init();
|
||||
AAWorldGen gen = new AAWorldGen();
|
||||
GameRegistry.registerWorldGenerator(gen, 10000);
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register(gen);
|
||||
TileEntityBase.init();
|
||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
||||
InitEntities.init();
|
||||
|
||||
PROXY.init(event);
|
||||
|
||||
RegistryHandler.BLOCKS_TO_REGISTER.clear();
|
||||
|
||||
ActuallyAdditions.LOGGER.info("Initialization Finished.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
ActuallyAdditions.LOGGER.info("Starting PostInitialization Phase...");
|
||||
|
||||
ItemCoffee.initIngredients();
|
||||
CrusherCrafting.init();
|
||||
HairyBallHandler.init();
|
||||
TreasureChestHandler.init();
|
||||
LensRecipeHandler.init();
|
||||
EmpowererHandler.init();
|
||||
LensMining.init();
|
||||
|
||||
InitBooklet.postInit();
|
||||
PROXY.postInit(event);
|
||||
|
||||
ConfigurationHandler.redefineConfigs();
|
||||
|
||||
ActuallyAdditions.LOGGER.info("PostInitialization Finished.");
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.render.ActualCompostModel;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.render.CompostModel;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.common.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.common.util.FluidStateMapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientRegistryHandler {
|
||||
|
||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
||||
|
||||
/**
|
||||
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
||||
*/
|
||||
private static void registerCustomFluidBlockRenderer(Fluid fluid) {
|
||||
Block block = fluid.getBlock();
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
||||
ModelBakery.registerItemVariants(item);
|
||||
ModelLoader.setCustomMeshDefinition(item, mapper);
|
||||
ModelLoader.setCustomStateMapper(block, mapper);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelRegistry(ModelRegistryEvent event) {
|
||||
for (Block block : RegistryHandler.BLOCKS_TO_REGISTER) {
|
||||
if (block instanceof IHasModel) {
|
||||
((IHasModel) block).registerRendering();
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()) {
|
||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
||||
}
|
||||
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidRefinedCanolaOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBake(ModelBakeEvent e) {
|
||||
ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal");
|
||||
CompostModel.compostBase = e.getModelRegistry().getObject(mrl);
|
||||
e.getModelRegistry().putObject(mrl, new ActualCompostModel());
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common;
|
||||
|
||||
//Class to wrap around the trainwreck that is the new registry system
|
||||
// @todo: remove this completely
|
||||
@Deprecated
|
||||
public class RegistryHandler {
|
||||
//
|
||||
// public static final List<Block> BLOCKS_TO_REGISTER = new ArrayList<>();
|
||||
// public static final List<Item> ITEMS_TO_REGISTER = new ArrayList<>();
|
||||
// public static final List<SoundEvent> SOUNDS_TO_REGISTER = new ArrayList<>();
|
||||
// public static final List<IRecipe> RECIPES_TO_REGISTER = new ArrayList<>();
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onBlockRegistry(Register<Block> event) {
|
||||
// InitBlocks.init();
|
||||
//
|
||||
// for (Block block : BLOCKS_TO_REGISTER) {
|
||||
// event.getRegistry().register(block);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onItemRegistry(Register<Item> event) {
|
||||
// InitItems.init();
|
||||
//
|
||||
// for (Item item : ITEMS_TO_REGISTER) {
|
||||
// event.getRegistry().register(item);
|
||||
// }
|
||||
// ITEMS_TO_REGISTER.clear();
|
||||
//
|
||||
// //Hack to make this register before recipes :>
|
||||
// InitOreDict.init();
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onVillagerRegistry(Register<VillagerProfession> event) {
|
||||
// InitVillager.init();
|
||||
//
|
||||
// if (ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.jamProfession);
|
||||
// if (ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.engineerProfession);
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onCraftingRegistry(Register<IRecipe> event) {
|
||||
// InitCrafting.init();
|
||||
//
|
||||
// for (IRecipe recipe : RECIPES_TO_REGISTER) {
|
||||
// event.getRegistry().register(recipe);
|
||||
// }
|
||||
// RECIPES_TO_REGISTER.clear();
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onSoundRegistry(Register<SoundEvent> event) {
|
||||
// SoundHandler.init();
|
||||
//
|
||||
// for (SoundEvent sound : SOUNDS_TO_REGISTER) {
|
||||
// event.getRegistry().register(sound);
|
||||
// }
|
||||
// SOUNDS_TO_REGISTER.clear();
|
||||
// }
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
//TODO Achievements -> Advancements?
|
||||
/*
|
||||
package de.ellpeck.actuallyadditions.common.achievement;
|
||||
import de.ellpeck.actuallyadditions.common.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class InitAchievements{
|
||||
|
||||
public static final ArrayList<Achievement> ACHIEVEMENT_LIST = new ArrayList<Achievement>();
|
||||
public static int pageNumber;
|
||||
public static AchievementPage theAchievementPage;
|
||||
|
||||
public static void init(){
|
||||
ModUtil.LOGGER.info("Initializing Achievements...");
|
||||
|
||||
for(int i = 0; i < TheAchievements.values().length; i++){
|
||||
ACHIEVEMENT_LIST.add(TheAchievements.values()[i].chieve);
|
||||
}
|
||||
|
||||
theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID), ACHIEVEMENT_LIST.toArray(new Achievement[ACHIEVEMENT_LIST.size()]));
|
||||
pageNumber = AchievementPage.getAchievementPages().size();
|
||||
AchievementPage.registerAchievementPage(theAchievementPage);
|
||||
}
|
||||
|
||||
public enum Type{
|
||||
CRAFTING,
|
||||
SMELTING,
|
||||
PICK_UP,
|
||||
MISC
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
|
@ -1,136 +0,0 @@
|
|||
//TODO Fix achievements
|
||||
/*
|
||||
package de.ellpeck.actuallyadditions.common.achievement;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.achievement.InitAchievements.Type;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.common.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.stats.StatisticsManager;
|
||||
import net.minecraft.util.JsonSerializableSet;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public enum TheAchievements{
|
||||
|
||||
OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, Type.MISC),
|
||||
NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 3, new ItemStack(InitBlocks.blockSmileyCloud), null, Type.MISC, true, 0),
|
||||
OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, Type.MISC),
|
||||
CRAFT_COAL_GEN("craftCoalGen", -2, 0, new ItemStack(InitBlocks.blockCoalGenerator), OPEN_BOOKLET),
|
||||
CRAFT_LEAF_GEN("craftLeafGen", -3, -2, new ItemStack(InitBlocks.blockLeafGenerator), CRAFT_COAL_GEN),
|
||||
CRAFT_RECONSTRUCTOR("craftReconstructor", -5, 0, new ItemStack(InitBlocks.blockAtomicReconstructor), CRAFT_COAL_GEN),
|
||||
MAKE_FIRST_CRYSTAL("makeCrystal", -4, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), CRAFT_RECONSTRUCTOR, Type.PICK_UP, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)),
|
||||
CRAFT_EMPOWERER("craftEmpowerer", -4, 4, new ItemStack(InitBlocks.blockEmpowerer), MAKE_FIRST_CRYSTAL),
|
||||
CRAFT_PHANTOMFACE("craftPhantomface", 2, 0, new ItemStack(InitBlocks.blockPhantomface), OPEN_BOOKLET),
|
||||
CRAFT_LIQUIFACE("craftLiquiface", 2, 2, new ItemStack(InitBlocks.blockPhantomLiquiface), CRAFT_PHANTOMFACE),
|
||||
CRAFT_ENERGYFACE("craftEnergyface", 4, -1, new ItemStack(InitBlocks.blockPhantomEnergyface), CRAFT_PHANTOMFACE),
|
||||
CRAFT_LASER_RELAY("craftLaserRelay", -7, -2, new ItemStack(InitBlocks.blockLaserRelay), CRAFT_RECONSTRUCTOR),
|
||||
CRAFT_LASER_RELAY_ITEM("craftLaserRelayItem", -9, -2, new ItemStack(InitBlocks.blockLaserRelayItem), CRAFT_LASER_RELAY, Type.PICK_UP),
|
||||
CRAFT_ITEM_INTERFACE("craftItemInterface", -11, -3, new ItemStack(InitBlocks.blockItemViewer), CRAFT_LASER_RELAY_ITEM),
|
||||
CRAFT_LASER_RELAY_ADVANCED("craftLaserRelayAdvanced", -7, -4, new ItemStack(InitBlocks.blockLaserRelayAdvanced), CRAFT_LASER_RELAY),
|
||||
CRAFT_LASER_RELAY_EXTREME("craftLaserRelayExtreme", -9, -4, new ItemStack(InitBlocks.blockLaserRelayExtreme), CRAFT_LASER_RELAY_ADVANCED),
|
||||
CRAFT_CRUSHER("craftCrusher", -8, 0, new ItemStack(InitBlocks.blockGrinder), CRAFT_RECONSTRUCTOR),
|
||||
CRAFT_DOUBLE_CRUSHER("craftDoubleCrusher", -10, 1, new ItemStack(InitBlocks.blockGrinderDouble), CRAFT_CRUSHER),
|
||||
PICK_UP_COFFEE("pickUpCoffee", -2, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_COAL_GEN, Type.PICK_UP),
|
||||
CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -1, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE),
|
||||
CRAFT_FIREWORK_BOX("craftFireworkBox", -4, -5, new ItemStack(InitBlocks.blockFireworkBox), null, Type.CRAFTING, true, 0),
|
||||
GET_UNPROBED("getUnProbed", -7, 3, new ItemStack(InitItems.itemPlayerProbe), null, Type.MISC, true, 0),
|
||||
|
||||
GET_CRYSTALS_MILESTONE("getCrystalsMilestone", 6, -3, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), null, Type.PICK_UP, true, 200, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)),
|
||||
OPEN_BOOKLET_MILESTONE("openBookletMilestone", 6, -1, new ItemStack(InitItems.itemBooklet), null, Type.MISC, true, 50),
|
||||
COMPLETE_TRIALS("completeTrials", 6, 1, new ItemStack(Items.GOLD_INGOT), null, Type.MISC, true, 0);
|
||||
|
||||
public final Achievement chieve;
|
||||
public final Type type;
|
||||
public final int progressToReach;
|
||||
public List<ItemStack> itemsToBeGotten;
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, ItemStack... specialItemsToBeGotten){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, Type.CRAFTING, false, 0, specialItemsToBeGotten);
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, boolean special, int progressToReach, ItemStack... specialItemsToBeGotten){
|
||||
this.type = type;
|
||||
this.progressToReach = progressToReach;
|
||||
|
||||
this.chieve = new Achievement("achievement."+ModUtil.MOD_ID+"."+name, ModUtil.MOD_ID+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.chieve);
|
||||
if(hasToHaveBefore == null){
|
||||
this.chieve.initIndependentStat();
|
||||
}
|
||||
if(special){
|
||||
this.chieve.setSpecial();
|
||||
}
|
||||
if(progressToReach > 0){
|
||||
this.chieve.setSerializableClazz(JsonSerializableSet.class);
|
||||
}
|
||||
this.chieve.registerStat();
|
||||
|
||||
if(specialItemsToBeGotten == null || specialItemsToBeGotten.length <= 0){
|
||||
this.itemsToBeGotten = Collections.singletonList(displayStack);
|
||||
}
|
||||
else{
|
||||
this.itemsToBeGotten = Arrays.asList(specialItemsToBeGotten);
|
||||
}
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, ItemStack... specialItemsToBeGotten){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten);
|
||||
}
|
||||
|
||||
public void get(EntityPlayer player){
|
||||
this.get(player, 1);
|
||||
}
|
||||
|
||||
public void get(EntityPlayer player, int amount){
|
||||
if(this.progressToReach > 0){
|
||||
this.updateStatus(player, amount);
|
||||
}
|
||||
else{
|
||||
player.addStat(this.chieve);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatus(EntityPlayer player, int amount){
|
||||
if(player instanceof EntityPlayerMP){
|
||||
|
||||
StatisticsManager manager = ((EntityPlayerMP)player).getStatFile();
|
||||
if(manager != null && !manager.hasAchievementUnlocked(this.chieve) && manager.canUnlockAchievement(this.chieve)){
|
||||
|
||||
JsonSerializableSet data = manager.getProgress(this.chieve);
|
||||
if(data == null){
|
||||
data = manager.setProgress(this.chieve, new JsonSerializableSet());
|
||||
}
|
||||
|
||||
int gottenSoFar = 0;
|
||||
for(String strg : data){
|
||||
try{
|
||||
int i = Integer.parseInt(strg);
|
||||
gottenSoFar += i;
|
||||
data.remove(strg);
|
||||
}
|
||||
catch(Exception e){
|
||||
data.remove(strg);
|
||||
}
|
||||
}
|
||||
|
||||
gottenSoFar += amount;
|
||||
if(gottenSoFar >= this.progressToReach){
|
||||
player.addStat(this.chieve);
|
||||
}
|
||||
else{
|
||||
data.add(Integer.toString(gottenSoFar));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -1,163 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MainWindow;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
||||
|
||||
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
|
||||
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
|
||||
|
||||
public BlockAtomicReconstructor() {
|
||||
super(STONE_PROPS.hardnessAndResistance(10f, 80f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit){
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
||||
if (reconstructor != null) {
|
||||
if (StackUtil.isValid(heldItem)) {
|
||||
Item item = heldItem.getItem();
|
||||
if (item instanceof ILensItem && !StackUtil.isValid(reconstructor.inv.getStackInSlot(0))) {
|
||||
ItemStack toPut = heldItem.copy();
|
||||
toPut.setCount(1);
|
||||
reconstructor.inv.setStackInSlot(0, toPut);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
//Shush, don't tell anyone!
|
||||
else if (ConfigIntValues.ELEVEN.getValue() == 11 && item == Items.MUSIC_DISC_11) {
|
||||
reconstructor.counter++;
|
||||
reconstructor.markDirty();
|
||||
}
|
||||
} else {
|
||||
ItemStack slot = reconstructor.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(slot)) {
|
||||
player.setHeldItem(hand, slot.copy());
|
||||
reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world){
|
||||
return new TileEntityAtomicReconstructor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, BlockRayTraceResult posHit, MainWindow window) {
|
||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getPos());
|
||||
if (tile instanceof TileEntityAtomicReconstructor) {
|
||||
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
||||
ITextComponent displayString;
|
||||
if (!StackUtil.isValid(slot)) {
|
||||
displayString = new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".noLens");
|
||||
} else {
|
||||
displayString = slot.getItem().getDisplayName(slot);
|
||||
|
||||
AssetUtil.renderStackToGui(slot, window.getScaledWidth() / 2 + 15, window.getScaledHeight() / 2 - 19, 1F);
|
||||
}
|
||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + displayString.getFormattedText(), window.getScaledWidth() / 2 + 35, window.getScaledHeight() / 2 - 15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||
builder.add(BlockStateProperties.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rot){
|
||||
return state.with(BlockStateProperties.FACING, rot.rotate(state.get(BlockStateProperties.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, Mirror mirrorIn){
|
||||
return this.rotate(state, mirrorIn.toRotation(state.get(BlockStateProperties.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(BlockState state){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) {
|
||||
TileEntity t = world.getTileEntity(pos);
|
||||
int i = 0;
|
||||
if (t instanceof TileEntityAtomicReconstructor) {
|
||||
i = ((TileEntityAtomicReconstructor) t).getEnergy();
|
||||
}
|
||||
return MathHelper.clamp(i / 20000, 0, 15);
|
||||
}
|
||||
|
||||
public class BlockItem extends net.minecraft.item.BlockItem {
|
||||
private long lastSysTime;
|
||||
private int toPick1;
|
||||
|
||||
private int toPick2;
|
||||
|
||||
public BlockItem() {
|
||||
super(BlockAtomicReconstructor.this, new Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag){
|
||||
long sysTime = System.currentTimeMillis();
|
||||
|
||||
if (this.lastSysTime + 3000 < sysTime) {
|
||||
this.lastSysTime = sysTime;
|
||||
if (world != null) {
|
||||
this.toPick1 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_1) + 1;
|
||||
this.toPick2 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_2) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
String base = String.format("tile.%s.%s.info", ActuallyAdditions.MODID, BlockAtomicReconstructor.this.getRegistryName().getPath());
|
||||
tooltip.add(new TranslationTextComponent(String.format("%s1.%s", base, this.toPick1)).appendSibling(new TranslationTextComponent(String.format("%s2.%s", base, this.toPick2))));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemBattery;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityBatteryBox;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBatteryBox extends BlockContainerBase {
|
||||
|
||||
public static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
|
||||
public BlockBatteryBox() {
|
||||
super(STONE_PROPS_WITH_HARDNESS.harvestLevel(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context){
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBatteryBox) {
|
||||
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (StackUtil.isValid(stack)) {
|
||||
if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) {
|
||||
box.inv.setStackInSlot(0, stack.copy());
|
||||
player.setHeldItem(hand, StackUtil.getEmpty());
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
} else {
|
||||
ItemStack inSlot = box.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(inSlot)) {
|
||||
player.setHeldItem(hand, inSlot.copy());
|
||||
box.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world){
|
||||
return new TileEntityBatteryBox();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityBioReactor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBioReactor extends BlockContainerBase {
|
||||
|
||||
public BlockBioReactor() {
|
||||
super(STONE_PROPS.hardnessAndResistance(2f, 10.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world){
|
||||
return new TileEntityBioReactor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit){
|
||||
if (!world.isRemote) {
|
||||
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
||||
// todo open gui:
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockBushBase;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockBlackLotus extends BlockBushBase {
|
||||
|
||||
public BlockBlackLotus() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityBreaker;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityPlacer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockBreaker extends BlockContainerBase {
|
||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||
private final boolean isPlacer;
|
||||
|
||||
public BlockBreaker(boolean isPlacer) {
|
||||
super(STONE_PROPS);
|
||||
this.isPlacer = isPlacer;
|
||||
|
||||
setDefaultState(getStateContainer().getBaseState().with(FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.SUCCESS; }
|
||||
if (!world.isRemote) {
|
||||
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
||||
if (breaker != null) {
|
||||
// todo: come back to this once we have guis
|
||||
// NetworkHooks.openGui(player, new SimpleNamedContainerProvider(());
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(FACING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
// @todo: might be wrong
|
||||
return getDefaultState().with(FACING, context.getFace().getOpposite());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
// return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
// return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
// }
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityCanolaPress;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockCanolaPress extends BlockContainerBase {
|
||||
|
||||
public BlockCanolaPress() {
|
||||
super(STONE_PROPS);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isFullCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new TileEntityCanolaPress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
if (!this.tryUseItemOnTank(player, hand, press.tank)) {
|
||||
// todo: add back
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityCoalGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCoalGenerator extends BlockContainerBase {
|
||||
public BlockCoalGenerator() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE)
|
||||
.tickRandomly());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isFullCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new TileEntityCoalGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityCoalGenerator) {
|
||||
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// todo: check count and speed params
|
||||
world.spawnParticle(ParticleTypes.SMOKE, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, i,0.0D, 0.0D, 0.0D, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
// todo: add back
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
// return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
// return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
// }
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityCoffeeMachine;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockCoffeeMachine extends BlockContainerBase {
|
||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
// private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 1 - 0.0625 * 2, 1 - 0.0625);
|
||||
private static final VoxelShape SHAPE = Block.makeCuboidShape(1, 0, 1, 15, 14, 15); // might be wrong, correct is above
|
||||
|
||||
public BlockCoffeeMachine() {
|
||||
super(STONE_PROPS);
|
||||
|
||||
setDefaultState(getStateContainer().getBaseState().with(FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isFullCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
||||
if (machine != null) {
|
||||
if (!this.tryUseItemOnTank(player, hand, machine.tank)) {
|
||||
// todo: add back
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new TileEntityCoffeeMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(FACING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
// return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
// return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
// }
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockColoredLamp extends Block {
|
||||
|
||||
// todo: replace with flattered versions
|
||||
// public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
||||
// public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
||||
public final boolean isOn;
|
||||
|
||||
public BlockColoredLamp(boolean isOn) {
|
||||
super(Block.Properties.create(Material.REDSTONE_LIGHT)
|
||||
.hardnessAndResistance(0.5f, 3.0f)
|
||||
.harvestTool(ToolType.PICKAXE));
|
||||
|
||||
this.isOn = isOn;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Item getItemDropped(Block block) {
|
||||
// return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int damageDropped(BlockState state) {
|
||||
// return this.getMetaFromState(state);
|
||||
// }
|
||||
|
||||
|
||||
// todo: re-implement
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
// ItemStack stack = player.getHeldItem(hand);
|
||||
// //Turning On
|
||||
// if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) {
|
||||
// world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||
// world.notifyLightSet(pos);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (StackUtil.isValid(stack)) {
|
||||
// //Changing Colors
|
||||
// int[] oreIDs = OreDictionary.getOreIDs(stack);
|
||||
// if (oreIDs.length > 0) {
|
||||
// for (int oreID : oreIDs) {
|
||||
// String name = OreDictionary.getOreName(oreID);
|
||||
// TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||
// if (color != null) {
|
||||
// if (this.getMetaFromState(state) != color.ordinal()) {
|
||||
// if (!world.isRemote) {
|
||||
// world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
|
||||
// if (!player.capabilities.isCreativeMode) {
|
||||
// player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
// for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
||||
// list.add(new ItemStack(this, 1, j));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public int getLightValue(BlockState state) {
|
||||
return this.isOn ? 15 : 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void registerRendering() {
|
||||
// for (int i = 0; i < ALL_LAMP_TYPES.length; i++) {
|
||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_LAMP_TYPES[i].regName);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState() {
|
||||
// return new BlockStateContainer(this, TYPE);
|
||||
// }
|
||||
//
|
||||
// public static class TheItemBlock extends BlockItem {
|
||||
//
|
||||
// public TheItemBlock(Block block) {
|
||||
// super(block);
|
||||
// this.setHasSubtypes(true);
|
||||
// this.setMaxDamage(0);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getItemStackDisplayName(ItemStack stack) {
|
||||
// if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; }
|
||||
// if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : "");
|
||||
// else return super.getItemStackDisplayName(stack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getTranslationKey(ItemStack stack) {
|
||||
// return InitBlocks.blockColoredLamp.getTranslationKey() + "_" + ALL_LAMP_TYPES[stack.getItemDamage()].regName;
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
// todo: remove
|
||||
//package de.ellpeck.actuallyadditions.common.blocks;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
//import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
//import de.ellpeck.actuallyadditions.common.tile.TileEntityCompost;
|
||||
//import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
||||
//import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
//import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
//import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.block.SoundType;
|
||||
//import net.minecraft.block.material.Material;
|
||||
//import net.minecraft.block.state.BlockStateContainer;
|
||||
//import net.minecraft.block.state.IBlockState;
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.ScaledResolution;
|
||||
//import net.minecraft.entity.Entity;
|
||||
//import net.minecraft.entity.player.EntityPlayer;
|
||||
//import net.minecraft.item.EnumRarity;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.state.IProperty;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.BlockRenderLayer;
|
||||
//import net.minecraft.util.EnumFacing;
|
||||
//import net.minecraft.util.EnumHand;
|
||||
//import net.minecraft.util.math.AxisAlignedBB;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.util.math.RayTraceResult;
|
||||
//import net.minecraft.util.text.TextFormatting;
|
||||
//import net.minecraft.world.IBlockAccess;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.common.ToolType;
|
||||
//import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
//import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
//import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
//import net.minecraftforge.fml.relauncher.Side;
|
||||
//import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
//import org.apache.commons.lang3.tuple.Pair;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||
//
|
||||
// protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
|
||||
// protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
||||
// protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
||||
// protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
// protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
||||
// private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 11 * 0.0625, 1 - 0.0625);
|
||||
//
|
||||
// public BlockCompost() {
|
||||
// super(Block.Properties.create(Material.WOOD)
|
||||
// .hardnessAndResistance(0.5f, 5.0f)
|
||||
// .harvestTool(ToolType.AXE)
|
||||
// .sound(SoundType.WOOD));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
// return AABB;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Deprecated
|
||||
// public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
// addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
|
||||
// addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
||||
// addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
||||
// addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
||||
// addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isFullCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||
// ItemStack stackPlayer = player.getHeldItem(hand);
|
||||
// if (!world.isRemote) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof TileEntityCompost) {
|
||||
// TileEntityCompost compost = (TileEntityCompost) tile;
|
||||
// ItemStack slot = compost.inv.getStackInSlot(0);
|
||||
// CompostRecipe recipeIn = TileEntityCompost.getRecipeForInput(slot);
|
||||
// if (!StackUtil.isValid(slot) || recipeIn != null) {
|
||||
// if (StackUtil.isValid(stackPlayer)) {
|
||||
// CompostRecipe recipeHand = TileEntityCompost.getRecipeForInput(stackPlayer);
|
||||
// if (recipeHand != null && (recipeIn == null || recipeIn == recipeHand)) {
|
||||
// int maxAdd = stackPlayer.getCount();
|
||||
//
|
||||
// if (!StackUtil.isValid(slot)) {
|
||||
// ItemStack stackToAdd = stackPlayer.copy();
|
||||
// stackToAdd.setCount(maxAdd);
|
||||
// compost.inv.setStackInSlot(0, stackToAdd);
|
||||
// player.inventory.decrStackSize(player.inventory.currentItem, maxAdd);
|
||||
// return true;
|
||||
// } else {
|
||||
// ItemStack stackIn = slot.copy();
|
||||
// if (stackIn.getCount() < slot.getMaxStackSize()) {
|
||||
// int sizeAdded = Math.min(maxAdd, slot.getMaxStackSize() - stackIn.getCount());
|
||||
// stackIn.grow(sizeAdded);
|
||||
// compost.inv.setStackInSlot(0, stackIn);
|
||||
// player.inventory.decrStackSize(player.inventory.currentItem, sizeAdded);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (!StackUtil.isValid(stackPlayer)) {
|
||||
// player.setHeldItem(hand, slot.copy());
|
||||
// compost.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
// return true;
|
||||
// } else if (ItemUtil.canBeStacked(stackPlayer, slot)) {
|
||||
// int addedStackSize = Math.min(slot.getCount(), stackPlayer.getMaxStackSize() - stackPlayer.getCount());
|
||||
// ItemStack stackToAdd = stackPlayer.copy();
|
||||
// stackToAdd.grow(addedStackSize);
|
||||
// player.setHeldItem(hand, stackToAdd);
|
||||
// compost.inv.getStackInSlot(0).shrink(addedStackSize);
|
||||
// return true;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// tile.markDirty();
|
||||
// world.notifyBlockUpdate(pos, this.getDefaultState(), this.getDefaultState(), 3);
|
||||
// }
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TileEntity createNewTileEntity(World world, int meta) {
|
||||
// return new TileEntityCompost();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.UNCOMMON;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||
// TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||
// if (tile instanceof TileEntityCompost) {
|
||||
// ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
||||
// String strg;
|
||||
// if (!StackUtil.isValid(slot)) {
|
||||
// strg = "Empty";
|
||||
// } else {
|
||||
// strg = slot.getDisplayName();
|
||||
//
|
||||
// AssetUtil.renderStackToGui(slot, resolution.getScaledWidth() / 2 + 15, resolution.getScaledHeight() / 2 - 29, 1F);
|
||||
// }
|
||||
// minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState() {
|
||||
// return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { COMPOST_PROP });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
// TileEntity te = world.getTileEntity(pos);
|
||||
// if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
||||
// TileEntityCompost compost = (TileEntityCompost) te;
|
||||
// return ((IExtendedBlockState) state).withProperty(COMPOST_PROP, Pair.of(compost.getCurrentDisplay(), compost.getHeight()));
|
||||
// }
|
||||
// return state;
|
||||
// }
|
||||
//
|
||||
// public BlockRenderLayer getBlockLayer() {
|
||||
// return BlockRenderLayer.CUTOUT;
|
||||
// }
|
||||
//
|
||||
// public static CompostProperty COMPOST_PROP = new CompostProperty();
|
||||
//
|
||||
// @SuppressWarnings("rawtypes")
|
||||
// private static class CompostProperty implements IProperty<Pair> {
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "compost";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isValid(Pair value) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Class<Pair> getType() {
|
||||
// return Pair.class;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String valueToString(Pair value) {
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
|
@ -1,96 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCrystal extends Block {
|
||||
|
||||
public static final TheCrystals[] ALL_CRYSTALS = TheCrystals.values();
|
||||
private static final PropertyEnum<TheCrystals> TYPE = PropertyEnum.create("type", TheCrystals.class);
|
||||
|
||||
private final boolean isEmpowered;
|
||||
|
||||
public BlockCrystal(boolean isEmpowered) {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
|
||||
this.isEmpowered = isEmpowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int j = 0; j < ALL_CRYSTALS.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockItemBase getItemBlock() {
|
||||
return new TheItemBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
for (int i = 0; i < ALL_CRYSTALS.length; i++) {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_CRYSTALS[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_CRYSTALS[stack.getItemDamage()].name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return this.block instanceof BlockCrystal && ((BlockCrystal) this.block).isEmpowered;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.common.util.IColorProvidingBlock;
|
||||
import de.ellpeck.actuallyadditions.common.util.IColorProvidingItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockCrystalCluster extends Block implements IColorProvidingBlock, IColorProvidingItem {
|
||||
|
||||
private final TheCrystals crystal;
|
||||
|
||||
public BlockCrystalCluster(TheCrystals crystal) {
|
||||
super(Properties.create(Material.GLASS)
|
||||
.hardnessAndResistance(0.25f, 1.0f)
|
||||
.sound(SoundType.GLASS)
|
||||
.lightValue(7));
|
||||
|
||||
this.crystal = crystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context){
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||
builder.add(BlockStateProperties.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rot){
|
||||
return state.with(BlockStateProperties.FACING, rot.rotate(state.get(BlockStateProperties.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, Mirror mirror){
|
||||
return this.rotate(state, mirror.toRotation(state.get(BlockStateProperties.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getBlockColor() {
|
||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||
}
|
||||
|
||||
/* todo canitzp: realise block drops with loot tables
|
||||
@Override
|
||||
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||
return InitItems.itemCrystalShard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder){
|
||||
return Collections.singletonList(new ItemStack(InitItems.itemCrystalShard, new Random().nextInt(5) + 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(BlockState state) {
|
||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player){
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
return true;
|
||||
}*/
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityDirectionalBreaker;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||
|
||||
public BlockDirectionalBreaker() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityDirectionalBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
if (!world.isRemote) {
|
||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos);
|
||||
if (breaker != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DIRECTIONAL_BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityDisplayStand;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockDisplayStand extends BlockContainerBase {
|
||||
|
||||
public BlockDisplayStand() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileEntityDisplayStand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (!world.isRemote) {
|
||||
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
|
||||
if (stand != null) {
|
||||
ItemStack display = stand.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(heldItem)) {
|
||||
if (!StackUtil.isValid(display)) {
|
||||
ItemStack toPut = heldItem.copy();
|
||||
toPut.setCount(1);
|
||||
stand.inv.setStackInSlot(0, toPut);
|
||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||
return true;
|
||||
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
||||
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||
if (maxTransfer > 0) {
|
||||
heldItem.grow(maxTransfer);
|
||||
ItemStack newDisplay = display.copy();
|
||||
newDisplay.shrink(maxTransfer);
|
||||
stand.inv.setStackInSlot(0, newDisplay);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StackUtil.isValid(display)) {
|
||||
player.setHeldItem(hand, display.copy());
|
||||
stand.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
if (face == EnumFacing.DOWN) return BlockFaceShape.SOLID;
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityDropper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockDropper extends BlockContainerBase {
|
||||
|
||||
public BlockDropper() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityDropper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
if (!world.isRemote) {
|
||||
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
||||
if (dropper != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DROPPER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityEmpowerer;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockEmpowerer extends BlockContainerBase {
|
||||
|
||||
public BlockEmpowerer() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileEntityEmpowerer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
if (!world.isRemote) {
|
||||
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
||||
if (empowerer != null) {
|
||||
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
||||
if (StackUtil.isValid(heldItem)) {
|
||||
if (!StackUtil.isValid(stackThere) && TileEntityEmpowerer.isPossibleInput(heldItem)) {
|
||||
ItemStack toPut = heldItem.copy();
|
||||
toPut.setCount(1);
|
||||
empowerer.inv.setStackInSlot(0, toPut);
|
||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||
return true;
|
||||
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
||||
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||
if (maxTransfer > 0) {
|
||||
player.setHeldItem(hand, StackUtil.grow(heldItem, maxTransfer));
|
||||
ItemStack newStackThere = stackThere.copy();
|
||||
newStackThere = StackUtil.shrink(newStackThere, maxTransfer);
|
||||
empowerer.inv.setStackInSlot(0, newStackThere);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StackUtil.isValid(stackThere)) {
|
||||
player.setHeldItem(hand, stackThere.copy());
|
||||
empowerer.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityEnergizer;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityEnervator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockEnergizer extends BlockContainerBase {
|
||||
|
||||
private final boolean isEnergizer;
|
||||
|
||||
public BlockEnergizer(boolean isEnergizer) {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(2.0f, 100f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
|
||||
this.isEnergizer = isEnergizer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
if (this.isEnergizer) {
|
||||
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
||||
if (energizer != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
} else {
|
||||
TileEntityEnervator energizer = (TileEntityEnervator) world.getTileEntity(pos);
|
||||
if (energizer != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFarmer;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFarmer extends BlockContainerBase {
|
||||
|
||||
public BlockFarmer() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFarmer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
||||
if (farmer != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FARMER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFeeder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFeeder extends BlockContainerBase {
|
||||
|
||||
public BlockFeeder() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(0.5f, 6.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFeeder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
||||
if (feeder != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFermentingBarrel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFermentingBarrel extends BlockContainerBase {
|
||||
|
||||
public BlockFermentingBarrel() {
|
||||
super(Block.Properties.create(Material.WOOD)
|
||||
.hardnessAndResistance(0.5f, 5.0f)
|
||||
.harvestTool(ToolType.AXE)
|
||||
.sound(SoundType.WOOD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFermentingBarrel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
||||
if (press != null) {
|
||||
if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFireworkBox;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFireworkBox extends BlockContainerBase {
|
||||
|
||||
public BlockFireworkBox() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return true;
|
||||
} else if (!world.isRemote) {
|
||||
TileEntityFireworkBox grinder = (TileEntityFireworkBox) world.getTileEntity(pos);
|
||||
if (grinder != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FIREWORK_BOX.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFireworkBox();
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFishingNet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFishingNet extends BlockContainerBase {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
|
||||
|
||||
public BlockFishingNet() {
|
||||
super(Block.Properties.create(Material.WOOD)
|
||||
.hardnessAndResistance(0.5f, 3.0f)
|
||||
.harvestTool(ToolType.AXE)
|
||||
.sound(SoundType.WOOD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFishingNet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFluidCollector;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFluidPlacer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFluidCollector extends BlockContainerBase {
|
||||
|
||||
private final boolean isPlacer;
|
||||
|
||||
public BlockFluidCollector(boolean isPlacer) {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
|
||||
this.isPlacer = isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||
if (!world.isRemote) {
|
||||
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
||||
if (collector != null) {
|
||||
if (!this.tryUseItemOnTank(player, hand, collector.tank)) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFurnaceDouble extends BlockContainerBase {
|
||||
|
||||
public static final PropertyBool IS_ON = PropertyBool.create("on");
|
||||
|
||||
public BlockFurnaceDouble() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE)
|
||||
.tickRandomly());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFurnaceDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
if (state.getValue(IS_ON)) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
||||
if (furnace != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return state.getValue(IS_ON) ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean isOn = meta >= 4;
|
||||
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta - 4 : meta);
|
||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||
return state.getValue(IS_ON) ? meta + 4 : meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockHorizontal.FACING, IS_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockItemBase getItemBlock() {
|
||||
return new TheItemBlock(this);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".previouslyDoubleFurnace"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityFurnaceSolar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockFurnaceSolar extends BlockContainerBase {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6 * 0.0625, 1);
|
||||
|
||||
public BlockFurnaceSolar() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityFurnaceSolar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockGeneric extends Block {
|
||||
|
||||
public BlockGeneric() {
|
||||
this(Material.ROCK, SoundType.STONE, 1.5F, 10.0F, ToolType.PICKAXE, 0);
|
||||
}
|
||||
|
||||
public BlockGeneric(Material material, SoundType sound, float hardness, float resistance, ToolType harvestTool, int harvestLevel) {
|
||||
super(Properties.create(material)
|
||||
.hardnessAndResistance(hardness, resistance)
|
||||
.harvestTool(harvestTool)
|
||||
.harvestLevel(harvestLevel)
|
||||
.sound(sound));
|
||||
}
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
// todo: delete. I'm not allowed to port this one haha
|
||||
//package de.ellpeck.actuallyadditions.common.blocks;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
//import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
//import de.ellpeck.actuallyadditions.common.blocks.base.ItemBlockBase;
|
||||
//import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
//import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
//import de.ellpeck.actuallyadditions.common.tile.TileEntityGiantChest;
|
||||
//import de.ellpeck.actuallyadditions.common.tile.TileEntityGiantChestLarge;
|
||||
//import de.ellpeck.actuallyadditions.common.tile.TileEntityGiantChestMedium;
|
||||
//import de.ellpeck.actuallyadditions.common.util.ItemStackHandlerAA;
|
||||
//import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
//import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
//import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.block.SoundType;
|
||||
//import net.minecraft.block.material.Material;
|
||||
//import net.minecraft.block.state.IBlockState;
|
||||
//import net.minecraft.client.util.ITooltipFlag;
|
||||
//import net.minecraft.entity.EntityLivingBase;
|
||||
//import net.minecraft.entity.player.EntityPlayer;
|
||||
//import net.minecraft.item.EnumRarity;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.nbt.NBTTagList;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.EnumFacing;
|
||||
//import net.minecraft.util.EnumHand;
|
||||
//import net.minecraft.util.NonNullList;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.util.text.TextFormatting;
|
||||
//import net.minecraft.world.IBlockAccess;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.common.ToolType;
|
||||
//import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class BlockGiantChest extends BlockContainerBase {
|
||||
//
|
||||
// public final int type;
|
||||
//
|
||||
// public BlockGiantChest(int type) {
|
||||
// super(Block.Properties.create(Material.WOOD)
|
||||
// .hardnessAndResistance(0.5f, 15.0f)
|
||||
// .harvestTool(ToolType.AXE)
|
||||
// .sound(SoundType.STONE));
|
||||
//
|
||||
// this.type = type;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TileEntity createNewTileEntity(World world, int par2) {
|
||||
// switch (this.type) {
|
||||
// case 1:
|
||||
// return new TileEntityGiantChestMedium();
|
||||
// case 2:
|
||||
// return new TileEntityGiantChestLarge();
|
||||
// default:
|
||||
// return new TileEntityGiantChest();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isFullCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube(IBlockState state) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
// if (!world.isRemote) {
|
||||
// TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
||||
// if (chest != null) {
|
||||
// chest.fillWithLoot(player);
|
||||
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.EPIC;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
// if (stack.getTagCompound() != null) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof TileEntityGiantChest) {
|
||||
// NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||
// IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
||||
//
|
||||
// for (int i = 0; i < list.tagCount(); i++) {
|
||||
// NBTTagCompound compound = list.getCompoundTagAt(i);
|
||||
// if (compound != null && compound.hasKey("id")) {
|
||||
// inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
// super.getDrops(drops, world, pos, state, fortune);
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof TileEntityGiantChest) {
|
||||
// ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
||||
// int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
||||
// if (place >= 0) {
|
||||
// NBTTagList list = new NBTTagList();
|
||||
// for (int i = 0; i < slots.getSlots(); i++) {
|
||||
// //Destroy the keeper
|
||||
// if (i != place) {
|
||||
// NBTTagCompound compound = new NBTTagCompound();
|
||||
// if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
||||
// slots.getStackInSlot(i).writeToNBT(compound);
|
||||
// }
|
||||
// list.appendTag(compound);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (list.tagCount() > 0) {
|
||||
// ItemStack stackInQuestion = drops.get(0);
|
||||
// if (StackUtil.isValid(stackInQuestion)) {
|
||||
// if (stackInQuestion.getTagCompound() == null) {
|
||||
// stackInQuestion.setTagCompound(new NBTTagCompound());
|
||||
// }
|
||||
// stackInQuestion.getTagCompound().setTag("Items", list);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldDropInventory(World world, BlockPos pos) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// return !(tile instanceof TileEntityGiantChest) || !ItemUtil.contains(((TileEntityGiantChest) tile).inv.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new TheItemBlock(this);
|
||||
// }
|
||||
//
|
||||
// public static class TheItemBlock extends ItemBlockBase {
|
||||
//
|
||||
// public TheItemBlock(Block block) {
|
||||
// super(block);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
// int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
|
||||
// if (type == 2) {
|
||||
// tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
||||
// } else if (type == 0) {
|
||||
// tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChest.desc"));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTShareTag(ItemStack stack) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,97 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGreenhouseGlass extends Block {
|
||||
|
||||
public BlockGreenhouseGlass() {
|
||||
super(Block.Properties.create(Material.GLASS)
|
||||
.hardnessAndResistance(0.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.GLASS)
|
||||
.tickRandomly());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightOpacity(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
IBlockState otherState = world.getBlockState(pos.offset(side));
|
||||
Block block = otherState.getBlock();
|
||||
|
||||
return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
if (world.isRemote) return;
|
||||
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
||||
Triple<BlockPos, IBlockState, IGrowable> trip = firstBlock(world, pos);
|
||||
boolean once = false;
|
||||
if (trip != null) for (int i = 0; i < 3; i++) {
|
||||
IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
||||
if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
||||
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
||||
once = true;
|
||||
}
|
||||
}
|
||||
if (once) world.playEvent(2005, trip.getMiddle().isOpaqueCube() ? trip.getLeft().up() : trip.getLeft(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public Triple<BlockPos, IBlockState, IGrowable> firstBlock(World world, BlockPos glassPos) {
|
||||
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
||||
while (true) {
|
||||
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
||||
if (mut.getY() < 0) return null;
|
||||
IBlockState state = world.getBlockState(mut);
|
||||
if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) {
|
||||
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityGrinder;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityGrinderDouble;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGrinder extends BlockContainerBase {
|
||||
|
||||
private final boolean isDouble;
|
||||
|
||||
public BlockGrinder(boolean isDouble) {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
|
||||
this.isDouble = isDouble;
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.5F);
|
||||
this.setResistance(10.0F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
double xRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||
double zRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||
world.spawnParticle(EnumParticleTypes.CRIT, (double) pos.getX() + 0.4F, (double) pos.getY() + 0.8F, (double) pos.getZ() + 0.4F, xRand, 0.5D, zRand);
|
||||
}
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
||||
if (grinder != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean isOn = meta == 1;
|
||||
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockFurnaceDouble.IS_ON);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityHeatCollector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockHeatCollector extends BlockContainerBase {
|
||||
|
||||
public BlockHeatCollector() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(2.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityHeatCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityInputter;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityInputterAdvanced;
|
||||
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.common.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockInputter extends BlockContainerBase {
|
||||
|
||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
||||
|
||||
public final boolean isAdvanced;
|
||||
|
||||
public BlockInputter(boolean isAdvanced) {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE)
|
||||
.tickRandomly());
|
||||
|
||||
this.isAdvanced = isAdvanced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
||||
if (inputter != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockItemBase getItemBlock() {
|
||||
return new TheItemBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends BlockItem {
|
||||
|
||||
private final Random rand = new Random();
|
||||
private long lastSysTime;
|
||||
private int toPick;
|
||||
|
||||
public TheItemBlock(Block block) {
|
||||
super(block);
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
return this.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
if (Util.isClient()) {
|
||||
long sysTime = System.currentTimeMillis();
|
||||
|
||||
if (this.lastSysTime + 5000 < sysTime) {
|
||||
this.lastSysTime = sysTime;
|
||||
this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS) + 1;
|
||||
}
|
||||
|
||||
return StringUtil.localize(this.getTranslationKey() + ".name") + " (" + StringUtil.localize("tile." + ActuallyAdditions.MODID + ".block_inputter.add." + this.toPick + ".name") + ")";
|
||||
} else return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemRepairer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class BlockItemRepairer extends BlockContainerBase {
|
||||
|
||||
public BlockItemRepairer() {
|
||||
super(Block.Properties.create(Material.ROCK)
|
||||
.hardnessAndResistance(20.0f, 15.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE)
|
||||
.tickRandomly());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityItemRepairer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
||||
if (repairer != null) {
|
||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockItemViewer extends BlockContainerBase {
|
||||
|
||||
public BlockItemViewer() {
|
||||
super(Properties.create(Material.ROCK)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new TileEntityItemViewer();
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewerHopping;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
||||
public class BlockItemViewerHopping extends BlockItemViewer {
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP);
|
||||
|
||||
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D);
|
||||
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
||||
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
||||
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
||||
|
||||
public BlockItemViewerHopping() {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileEntityItemViewerHopping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
EnumFacing opp = facing.getOpposite();
|
||||
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
||||
}
|
||||
|
||||
@Override //was isFullyOpaque, not sure if correct change.
|
||||
public boolean isNormalCube(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
||||
}
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLampPowerer extends Block {
|
||||
|
||||
public BlockLampPowerer() {
|
||||
super(Block.Properties.create(Material.REDSTONE_LIGHT)
|
||||
.hardnessAndResistance(1.5f, 10.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
this.updateLamp(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
this.updateLamp(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
private void updateLamp(World world, BlockPos pos) {
|
||||
if (!world.isRemote) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
||||
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof BlockColoredLamp) {
|
||||
boolean isOn = ((BlockColoredLamp) block).isOn;
|
||||
if (powered) {
|
||||
if (!isOn) {
|
||||
world.setBlockState(pos, InitBlocks.blockColoredLampOn.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
||||
}
|
||||
} else {
|
||||
if (isOn) {
|
||||
world.setBlockState(pos, InitBlocks.blockColoredLamp.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateSurrounding(world, pos, powered, updatedAlready);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
||||
for (EnumFacing side : EnumFacing.values()) {
|
||||
BlockPos offset = pos.offset(side);
|
||||
if (!updatedAlready.contains(offset)) {
|
||||
updatedAlready.add(pos);
|
||||
this.updateLampsAtPos(world, offset, powered, updatedAlready);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue