Compare commits

..

No commits in common. "a6b359e1a7a09eeffc23b02dcc878ef059097f9c" and "9b11bf3245008ba96e40ccfd8d941915f60a8290" have entirely different histories.

86 changed files with 4481 additions and 4570 deletions

View file

@ -134,7 +134,7 @@ public final class ActuallyAdditionsAPI {
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) * @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) { public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
CRUSHER_RECIPES.add(new CrushingRecipe(Ingredient.of(input), outputOne, 1.0f, outputTwo.isEmpty() CRUSHER_RECIPES.add(new CrushingRecipe(Ingredient.of(input), outputOne, outputTwo.isEmpty()
? ItemStack.EMPTY ? ItemStack.EMPTY
: outputTwo, outputTwoChance)); : outputTwo, outputTwoChance));
} }
@ -148,7 +148,7 @@ public final class ActuallyAdditionsAPI {
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) * @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) { public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
CRUSHER_RECIPES.add(new CrushingRecipe(input, outputOne, 1.0f, outputTwo.isEmpty() CRUSHER_RECIPES.add(new CrushingRecipe(input, outputOne, outputTwo.isEmpty()
? ItemStack.EMPTY ? ItemStack.EMPTY
: outputTwo, outputTwoChance)); : outputTwo, outputTwoChance));
} }

View file

@ -168,7 +168,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.save(consumer); .save(consumer);
// Item Interface // Item Interface
Recipe.shaped(ActuallyBlocks.ITEM_INTERFACE.getItem()) Recipe.shaped(ActuallyBlocks.ITEM_VIEWER.getItem())
.pattern("OBO", "RCR", "OBO") .pattern("OBO", "RCR", "OBO")
.define('B', Tags.Items.DUSTS_REDSTONE) .define('B', Tags.Items.DUSTS_REDSTONE)
.define('O', ActuallyItems.COIL.get()) .define('O', ActuallyItems.COIL.get())
@ -177,7 +177,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.save(consumer); .save(consumer);
// Hopping Item Interface // Hopping Item Interface
Recipe.shapeless(ActuallyBlocks.ITEM_INTERFACE_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_INTERFACE.get()).save(consumer); Recipe.shapeless(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_VIEWER.get()).save(consumer);
} }

View file

@ -1,17 +1,11 @@
package de.ellpeck.actuallyadditions.data; package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache; import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe; import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider; import net.minecraft.data.RecipeProvider;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -21,12 +15,11 @@ public class CrushingRecipeGenerator extends RecipeProvider {
} }
@Override @Override
protected void saveAdvancement(@Nonnull DirectoryCache p_208310_1_, @Nonnull JsonObject p_208310_2_, @Nonnull Path p_208310_3_) { protected void saveAdvancement(DirectoryCache p_208310_1_, JsonObject p_208310_2_, Path p_208310_3_) {
} }
@Override @Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) { protected void buildShapelessRecipes(Consumer<IFinishedRecipe> p_200404_1_) {
consumer.accept(new CrushingRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "bone_crusher"),
Ingredient.of(Items.BONE), Items.BONE_MEAL, 6, 1.0f , Items.AIR, 0, 0.0f));
} }
} }

View file

@ -19,6 +19,7 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider; import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
import sun.plugin.dom.exception.InvalidStateException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@ -113,10 +114,10 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
public static class EmpoweringBuilder { public static class EmpoweringBuilder {
private final Item result; private final Item result;
private final Ingredient base; private final Ingredient base;
private List<Ingredient> modifiers = new ArrayList<>();
private final int energy; private final int energy;
private final int time; private final int time;
private final int color; private final int color;
private final List<Ingredient> modifiers = new ArrayList<>();
public EmpoweringBuilder(IItemProvider resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) { public EmpoweringBuilder(IItemProvider resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) {
result = resultIn.asItem(); result = resultIn.asItem();
@ -136,14 +137,12 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
modifiers.add(Ingredient.of(input)); modifiers.add(Ingredient.of(input));
return this; return this;
} }
public EmpoweringBuilder addModifier(ItemStack input) { public EmpoweringBuilder addModifier(ItemStack input) {
if (modifiers.size() >= 4) if (modifiers.size() >= 4)
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.getItem().getRegistryName()); throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.getItem().getRegistryName());
modifiers.add(Ingredient.of(input)); modifiers.add(Ingredient.of(input));
return this; return this;
} }
public EmpoweringBuilder addModifier(ITag<Item> input) { public EmpoweringBuilder addModifier(ITag<Item> input) {
if (modifiers.size() >= 4) if (modifiers.size() >= 4)
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.toString()); throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.toString());
@ -156,11 +155,10 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString()); throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
consumer.accept(new EmpowererRecipe.FinishedRecipe(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color)); consumer.accept(new EmpowererRecipe.FinishedRecipe(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
} }
public void save(Consumer<IFinishedRecipe> consumer, String name) { public void save(Consumer<IFinishedRecipe> consumer, String name) {
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name); ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
if (modifiers.size() != 4) if (modifiers.size() != 4)
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res); throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res.toString());
consumer.accept(new EmpowererRecipe.FinishedRecipe(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color)); consumer.accept(new EmpowererRecipe.FinishedRecipe(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
} }
} }

View file

@ -9,7 +9,6 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import net.minecraft.data.*; import net.minecraft.data.*;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
@ -17,7 +16,6 @@ import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
import net.minecraftforge.common.crafting.NBTIngredient; import net.minecraftforge.common.crafting.NBTIngredient;
import net.minecraftforge.fml.RegistryObject;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
@ -31,9 +29,6 @@ public class ItemRecipeGenerator extends RecipeProvider {
@Override @Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) { protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
generateEquipment(consumer);
generatePaxels(consumer);
//Goggles //Goggles
Recipe.shaped(ActuallyItems.ENGINEER_GOGGLES.get()) Recipe.shaped(ActuallyItems.ENGINEER_GOGGLES.get())
.pattern(" R ") .pattern(" R ")
@ -388,8 +383,6 @@ public class ItemRecipeGenerator extends RecipeProvider {
.define('C', ActuallyItems.COIL_ADVANCED.get()) .define('C', ActuallyItems.COIL_ADVANCED.get())
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get())); .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
// //
// //Magnet Ring // //Magnet Ring
// RecipeHandler.addOreDictRecipe(new ItemStack(InitItems.itemMagnetRing), "RIB", "IOI", "BIR", 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 'B', new ItemStack(Items.DYE, 1, 4), 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())); // RecipeHandler.addOreDictRecipe(new ItemStack(InitItems.itemMagnetRing), "RIB", "IOI", "BIR", 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 'B', new ItemStack(Items.DYE, 1, 4), 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()));
@ -465,120 +458,11 @@ public class ItemRecipeGenerator extends RecipeProvider {
// GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), new ItemStack(Items.COAL), 1F); // GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), new ItemStack(Items.COAL), 1F);
} }
protected void generateEquipment(Consumer<IFinishedRecipe> consumer) {
addToolAndArmorRecipes(consumer, ActuallyItems.BLACK_QUARTZ, ActuallyItems.PICKAXE_QUARTZ, ActuallyItems.SWORD_QUARTZ, ActuallyItems.AXE_QUARTZ, ActuallyItems.SHOVEL_QUARTZ, ActuallyItems.HOE_QUARTZ, ActuallyItems.HELM_QUARTZ, ActuallyItems.CHEST_QUARTZ, ActuallyItems.PANTS_QUARTZ, ActuallyItems.BOOTS_QUARTZ);
addToolAndArmorRecipes(consumer, ActuallyItems.RESTONIA_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_RESTONIA, ActuallyItems.SWORD_CRYSTAL_RESTONIA, ActuallyItems.AXE_CRYSTAL_RESTONIA, ActuallyItems.SHOVEL_CRYSTAL_RESTONIA, ActuallyItems.HOE_CRYSTAL_RESTONIA, ActuallyItems.HELM_CRYSTAL_RESTONIA, ActuallyItems.CHEST_CRYSTAL_RESTONIA, ActuallyItems.PANTS_CRYSTAL_RESTONIA, ActuallyItems.BOOTS_CRYSTAL_RESTONIA);
addToolAndArmorRecipes(consumer, ActuallyItems.EMERADIC_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_EMERADIC, ActuallyItems.SWORD_CRYSTAL_EMERADIC, ActuallyItems.AXE_CRYSTAL_EMERADIC, ActuallyItems.SHOVEL_CRYSTAL_EMERADIC, ActuallyItems.HOE_CRYSTAL_EMERADIC, ActuallyItems.HELM_CRYSTAL_EMERADIC, ActuallyItems.CHEST_CRYSTAL_EMERADIC, ActuallyItems.PANTS_CRYSTAL_EMERADIC, ActuallyItems.BOOTS_CRYSTAL_EMERADIC);
addToolAndArmorRecipes(consumer, ActuallyItems.ENORI_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_ENORI, ActuallyItems.SWORD_CRYSTAL_ENORI, ActuallyItems.AXE_CRYSTAL_ENORI, ActuallyItems.SHOVEL_CRYSTAL_ENORI, ActuallyItems.HOE_CRYSTAL_ENORI, ActuallyItems.HELM_CRYSTAL_ENORI, ActuallyItems.CHEST_CRYSTAL_ENORI, ActuallyItems.PANTS_CRYSTAL_ENORI, ActuallyItems.BOOTS_CRYSTAL_ENORI);
addToolAndArmorRecipes(consumer, ActuallyItems.DIAMATINE_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_DIAMATINE, ActuallyItems.SWORD_CRYSTAL_DIAMATINE, ActuallyItems.AXE_CRYSTAL_DIAMATINE, ActuallyItems.SHOVEL_CRYSTAL_DIAMATINE, ActuallyItems.HOE_CRYSTAL_DIAMATINE, ActuallyItems.HELM_CRYSTAL_DIAMATINE, ActuallyItems.CHEST_CRYSTAL_DIAMATINE, ActuallyItems.PANTS_CRYSTAL_DIAMATINE, ActuallyItems.BOOTS_CRYSTAL_DIAMATINE);
addToolAndArmorRecipes(consumer, ActuallyItems.PALIS_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_PALIS, ActuallyItems.SWORD_CRYSTAL_PALIS, ActuallyItems.AXE_CRYSTAL_PALIS, ActuallyItems.SHOVEL_CRYSTAL_PALIS, ActuallyItems.HOE_CRYSTAL_PALIS, ActuallyItems.HELM_CRYSTAL_PALIS, ActuallyItems.CHEST_CRYSTAL_PALIS, ActuallyItems.PANTS_CRYSTAL_PALIS, ActuallyItems.BOOTS_CRYSTAL_PALIS);
addToolAndArmorRecipes(consumer, ActuallyItems.VOID_CRYSTAL, ActuallyItems.PICKAXE_CRYSTAL_VOID, ActuallyItems.SWORD_CRYSTAL_VOID, ActuallyItems.AXE_CRYSTAL_VOID, ActuallyItems.SHOVEL_CRYSTAL_VOID, ActuallyItems.HOE_CRYSTAL_VOID, ActuallyItems.HELM_CRYSTAL_VOID, ActuallyItems.CHEST_CRYSTAL_VOID, ActuallyItems.PANTS_CRYSTAL_VOID, ActuallyItems.BOOTS_CRYSTAL_VOID);
}
protected void generatePaxels(Consumer<IFinishedRecipe> consumer) {
addPaxel(consumer, ActuallyItems.WOODEN_PAXEL, Items.WOODEN_AXE, Items.WOODEN_PICKAXE, Items.WOODEN_SWORD, Items.WOODEN_SHOVEL, Items.WOODEN_HOE);
addPaxel(consumer, ActuallyItems.STONE_PAXEL, Items.STONE_AXE, Items.STONE_PICKAXE, Items.STONE_SWORD, Items.STONE_SHOVEL, Items.STONE_HOE);
addPaxel(consumer, ActuallyItems.IRON_PAXEL, Items.IRON_AXE, Items.IRON_PICKAXE, Items.IRON_SWORD, Items.IRON_SHOVEL, Items.IRON_HOE);
addPaxel(consumer, ActuallyItems.GOLD_PAXEL, Items.GOLDEN_AXE, Items.GOLDEN_PICKAXE, Items.GOLDEN_SWORD, Items.GOLDEN_SHOVEL, Items.GOLDEN_HOE);
addPaxel(consumer, ActuallyItems.DIAMOND_PAXEL, Items.DIAMOND_AXE, Items.DIAMOND_PICKAXE, Items.DIAMOND_SWORD, Items.DIAMOND_SHOVEL, Items.DIAMOND_HOE);
addPaxel(consumer, ActuallyItems.NETHERITE_PAXEL, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE);
addPaxel(consumer, ActuallyItems.QUARTZ_PAXEL, ActuallyItems.AXE_QUARTZ, ActuallyItems.PICKAXE_QUARTZ, ActuallyItems.SWORD_QUARTZ, ActuallyItems.SHOVEL_QUARTZ, ActuallyItems.HOE_QUARTZ);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_RESTONIA, ActuallyItems.AXE_CRYSTAL_RESTONIA, ActuallyItems.PICKAXE_CRYSTAL_RESTONIA, ActuallyItems.SWORD_CRYSTAL_RESTONIA, ActuallyItems.SHOVEL_CRYSTAL_RESTONIA, ActuallyItems.HOE_CRYSTAL_RESTONIA);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_EMERADIC, ActuallyItems.AXE_CRYSTAL_EMERADIC, ActuallyItems.PICKAXE_CRYSTAL_EMERADIC, ActuallyItems.SWORD_CRYSTAL_EMERADIC, ActuallyItems.SHOVEL_CRYSTAL_EMERADIC, ActuallyItems.HOE_CRYSTAL_EMERADIC);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_PALIS, ActuallyItems.AXE_CRYSTAL_PALIS, ActuallyItems.PICKAXE_CRYSTAL_PALIS, ActuallyItems.SWORD_CRYSTAL_PALIS, ActuallyItems.SHOVEL_CRYSTAL_PALIS, ActuallyItems.HOE_CRYSTAL_PALIS);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_DIAMATINE, ActuallyItems.AXE_CRYSTAL_DIAMATINE, ActuallyItems.PICKAXE_CRYSTAL_DIAMATINE, ActuallyItems.SWORD_CRYSTAL_DIAMATINE, ActuallyItems.SHOVEL_CRYSTAL_DIAMATINE, ActuallyItems.HOE_CRYSTAL_DIAMATINE);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_VOID, ActuallyItems.AXE_CRYSTAL_VOID, ActuallyItems.PICKAXE_CRYSTAL_VOID, ActuallyItems.SWORD_CRYSTAL_VOID, ActuallyItems.SHOVEL_CRYSTAL_VOID, ActuallyItems.HOE_CRYSTAL_VOID);
addPaxel(consumer, ActuallyItems.PAXEL_CRYSTAL_ENORI, ActuallyItems.AXE_CRYSTAL_ENORI, ActuallyItems.PICKAXE_CRYSTAL_ENORI, ActuallyItems.SWORD_CRYSTAL_ENORI, ActuallyItems.SHOVEL_CRYSTAL_ENORI, ActuallyItems.HOE_CRYSTAL_ENORI);
}
public static void addPaxel(Consumer<IFinishedRecipe> consumer, RegistryObject<Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
Recipe.shapeless(output.get())
.requires(axe)
.requires(pickaxe)
.requires(sword)
.requires(shovel)
.requires(hoe)
.save(consumer);
}
public static void addPaxel(Consumer<IFinishedRecipe> consumer, RegistryObject<Item> output, RegistryObject<Item> axe, RegistryObject<Item> pickaxe, RegistryObject<Item> sword, RegistryObject<Item> shovel, RegistryObject<Item> hoe) {
Recipe.shapeless(output.get())
.requires(axe.get())
.requires(pickaxe.get())
.requires(sword.get())
.requires(shovel.get())
.requires(hoe.get())
.save(consumer);
}
@Override @Override
protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) {
//Nope... //Nope...
} }
public static void addToolAndArmorRecipes(Consumer<IFinishedRecipe> consumer, RegistryObject<Item> base, RegistryObject<Item> pickaxe, RegistryObject<Item> sword, RegistryObject<Item> axe, RegistryObject<Item> shovel, RegistryObject<Item> hoe, RegistryObject<Item> helm, RegistryObject<Item> chest, RegistryObject<Item> pants, RegistryObject<Item> boots) {
//Pickaxe
Recipe.shaped(pickaxe.get())
.pattern("EEE", " S ", " S ")
.define('E', base.get())
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer);
//Sword
Recipe.shaped(sword.get())
.pattern("E", "E", "S")
.define('E', base.get())
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer);
//Axe
Recipe.shaped(axe.get())
.pattern("EE", "ES", " S")
.define('E', base.get())
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer);
//Shovel
Recipe.shaped(shovel.get())
.pattern("E", "S", "S")
.define('E', base.get())
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer);
//Hoe
Recipe.shaped(hoe.get())
.pattern("EE", " S", " S")
.define('E', base.get())
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer);
//Helm
Recipe.shaped(helm.get())
.pattern("OOO", "O O")
.define('O', base.get())
.save(consumer);
//Chest
Recipe.shaped(chest.get())
.pattern("O O", "OOO", "OOO")
.define('O', base.get())
.save(consumer);
//Legs
Recipe.shaped(pants.get())
.pattern("OOO", "O O", "O O")
.define('O', base.get())
.save(consumer);
//Boots
Recipe.shaped(boots.get())
.pattern("O O", "O O")
.define('O', base.get())
.save(consumer);
}
public static class Recipe { public static class Recipe {
public static ItemRecipeGenerator.Recipe.Shapeless shapeless(IItemProvider result) { public static ItemRecipeGenerator.Recipe.Shapeless shapeless(IItemProvider result) {
return new ItemRecipeGenerator.Recipe.Shapeless(result); return new ItemRecipeGenerator.Recipe.Shapeless(result);

View file

@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient; import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.event.CommonEvents; import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
@ -34,23 +34,18 @@ import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler; import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader; import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent; import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -76,10 +71,6 @@ public class ActuallyAdditions {
} }
}; };
public static final Logger LOGGER = LogManager.getLogger(NAME); public static final Logger LOGGER = LogManager.getLogger(NAME);
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, "entities");
public static final RegistryObject<EntityType<EntityWorm>> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, EntityClassification.CREATURE).build(MODID + ":worm"));
@Deprecated @Deprecated
public static ActuallyAdditions INSTANCE; public static ActuallyAdditions INSTANCE;
@ -96,7 +87,6 @@ public class ActuallyAdditions {
ActuallyBlocks.TILES.register(eventBus); ActuallyBlocks.TILES.register(eventBus);
ActuallyRecipes.init(eventBus); ActuallyRecipes.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus); ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
MinecraftForge.EVENT_BUS.addListener(this::serverStarted); MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
MinecraftForge.EVENT_BUS.addListener(this::serverStopped); MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
@ -109,10 +99,6 @@ public class ActuallyAdditions {
eventBus.addListener(this::clientSetup); eventBus.addListener(this::clientSetup);
} }
private static void reloadEvent(AddReloadListenerEvent event) {
event.addListener(new ResourceReloader(event.getDataPackRegistries()));
}
private void setup(FMLCommonSetupEvent event) { private void setup(FMLCommonSetupEvent event) {
PacketHandler.init(); PacketHandler.init();
@ -133,6 +119,11 @@ public class ActuallyAdditions {
HairyBallHandler.init(); HairyBallHandler.init();
LensRecipeHandler.init(); LensRecipeHandler.init();
LensMining.init(); LensMining.init();
InitBooklet.init();
}
private static void reloadEvent(AddReloadListenerEvent event){
event.addListener(new ResourceReloader(event.getDataPackRegistries()));
} }
private void clientSetup(FMLClientSetupEvent event) { private void clientSetup(FMLClientSetupEvent event) {

View file

@ -21,6 +21,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
@ -155,9 +156,9 @@ public final class ActuallyBlocks {
// Interface Blocks // Interface Blocks
public static final AABlockReg<BlockPlayerInterface, AABlockItem, TileEntityPlayerInterface> PLAYER_INTERFACE = new AABlockReg<>("player_interface", BlockPlayerInterface::new, public static final AABlockReg<BlockPlayerInterface, AABlockItem, TileEntityPlayerInterface> PLAYER_INTERFACE = new AABlockReg<>("player_interface", BlockPlayerInterface::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlayerInterface::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlayerInterface::new);
public static final AABlockReg<BlockItemInterface, AABlockItem, TileEntityItemInterface> ITEM_INTERFACE = new AABlockReg<>("item_viewer", BlockItemInterface::new, public static final AABlockReg<BlockItemInterface, AABlockItem, TileEntityItemInterface> ITEM_VIEWER = new AABlockReg<>("item_viewer", BlockItemInterface::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterface::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterface::new);
public static final AABlockReg<BlockItemInterfaceHopping, AABlockItem, TileEntityItemInterfaceHopping> ITEM_INTERFACE_HOPPING = new AABlockReg<>("item_viewer_hopping", BlockItemInterfaceHopping::new, public static final AABlockReg<BlockItemInterfaceHopping, AABlockItem, TileEntityItemInterfaceHopping> ITEM_VIEWER_HOPPING = new AABlockReg<>("item_viewer_hopping", BlockItemInterfaceHopping::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterfaceHopping::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterfaceHopping::new);
// Phantom stuff // Phantom stuff

View file

@ -16,6 +16,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -26,6 +27,9 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraft.block.AbstractBlock.Properties;
public class BlockFermentingBarrel extends BlockContainerBase { public class BlockFermentingBarrel extends BlockContainerBase {
@ -43,11 +47,9 @@ public class BlockFermentingBarrel extends BlockContainerBase {
if (!world.isClientSide) { if (!world.isClientSide) {
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getBlockEntity(pos); TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getBlockEntity(pos);
if (press != null) { if (press != null) {
/* if (!this.tryUseItemOnTank(player, hand, press.tanks.canolaTank) && !this.tryUseItemOnTank(player, hand, press.tanks.oilTank)) { if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) {
NetworkHooks.openGui((ServerPlayerEntity) player, press, pos); NetworkHooks.openGui((ServerPlayerEntity) player, press, pos);
} }
*/
} }
return ActionResultType.PASS; return ActionResultType.PASS;
} }

View file

@ -41,12 +41,12 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
@Override @Override
public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
return this.openGui(worldIn, player, pos, TileEntityVerticalDigger.class); return this.openGui(worldIn, player, pos, TileEntityMiner.class);
} }
@Override @Override
public TileEntity newBlockEntity(IBlockReader world) { public TileEntity newBlockEntity(IBlockReader world) {
return new TileEntityVerticalDigger(); return new TileEntityMiner();
} }
@Override @Override
@ -56,8 +56,8 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
return; return;
} }
TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos());
if (tile instanceof TileEntityVerticalDigger) { if (tile instanceof TileEntityMiner) {
TileEntityVerticalDigger miner = (TileEntityVerticalDigger) tile; TileEntityMiner miner = (TileEntityMiner) tile;
String info = miner.checkY == 0 String info = miner.checkY == 0
? "Done Mining!" ? "Done Mining!"
: miner.checkY == -1 : miner.checkY == -1

View file

@ -8,6 +8,8 @@ import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.block.AbstractBlock.Properties;
/** /**
* Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do. * Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do.
*/ */
@ -26,7 +28,7 @@ public abstract class FullyDirectionalBlock extends BlockBase {
} }
public BlockState getBaseConstructorState() { public BlockState getBaseConstructorState() {
return this.stateDefinition.getOwner().defaultBlockState().setValue(FACING, Direction.NORTH); return this.stateContainer.getBaseState().with(FACING, Direction.NORTH);
} }
@Override @Override

View file

@ -1,300 +1,300 @@
///* /*
// * This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft. * This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet; package de.ellpeck.actuallyadditions.mod.booklet;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
//import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
//import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.page.*; import de.ellpeck.actuallyadditions.mod.booklet.page.*;
//import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
//import de.ellpeck.actuallyadditions.mod.crafting.*; import de.ellpeck.actuallyadditions.mod.crafting.*;
//import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
//import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
//import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats; import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
//import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting; import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
//import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
//import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
//import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.tile.*;
//import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
//import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
//import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.item.Items; import net.minecraft.item.Items;
//import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
//import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
//import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
//import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
//import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.FluidUtil;
//
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.Arrays; import java.util.Arrays;
//import java.util.Collections; import java.util.Collections;
//import java.util.List; import java.util.List;
//
//public final class InitBooklet { public final class InitBooklet {
//
// public static BookletChapter[] chaptersIntroduction = new BookletChapter[11]; public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
//
// public static void init() { public static void init() {
// ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant(); ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
// ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials"); ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
//
// ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant(); ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
// ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction"); ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
// ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial(); ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial();
// ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF"); ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF");
// ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF"); ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF");
// ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF"); ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF");
// ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF"); ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF");
// ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF"); ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF");
// ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc"); ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
// ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial(); ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
//
// initChapters(); initChapters();
//
// int chapCount = 0; int chapCount = 0;
// int pageCount = 0; int pageCount = 0;
// int infoCount = 0; int infoCount = 0;
// for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) { for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
// for (IBookletChapter chapter : entry.getAllChapters()) { for (IBookletChapter chapter : entry.getAllChapters()) {
// if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) { if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
// ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter); ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
// chapCount++; chapCount++;
//
// for (IBookletPage page : chapter.getAllPages()) { for (IBookletPage page : chapter.getAllPages()) {
// pageCount++; pageCount++;
//
// List<ItemStack> items = new ArrayList<>(); List<ItemStack> items = new ArrayList<>();
// page.getItemStacksForPage(items); page.getItemStacksForPage(items);
// List<FluidStack> fluids = new ArrayList<>(); List<FluidStack> fluids = new ArrayList<>();
// page.getFluidStacksForPage(fluids); page.getFluidStacksForPage(fluids);
//
// if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) { if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
// if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) { if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
// ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page); ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
// infoCount++; infoCount++;
// } }
// } }
// } }
// } }
// } }
// } }
//
// Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> { Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> {
// Integer prio1 = entry1.getSortingPriority(); Integer prio1 = entry1.getSortingPriority();
// Integer prio2 = entry2.getSortingPriority(); Integer prio2 = entry2.getSortingPriority();
// return prio2.compareTo(prio1); return prio2.compareTo(prio1);
// }); });
// Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> { Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> {
// Integer prio1 = chapter1.getSortingPriority(); Integer prio1 = chapter1.getSortingPriority();
// Integer prio2 = chapter2.getSortingPriority(); Integer prio2 = chapter2.getSortingPriority();
// return prio2.compareTo(prio1); return prio2.compareTo(prio1);
// }); });
// Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> { Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> {
// Integer prio1 = page1.getSortingPriority(); Integer prio1 = page1.getSortingPriority();
// Integer prio2 = page2.getSortingPriority(); Integer prio2 = page2.getSortingPriority();
// return prio2.compareTo(prio1); 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!"); 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() { private static void initChapters() {
// /* /*
// //Getting Started //Getting Started
// chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText()); chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), 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.get(), 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(); // chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc.get(), 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(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
// ArrayList<BookletPage> crystalPages = new ArrayList<>(); 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())); 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++) { 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 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_CRYSTALS).setNoText());
// crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).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[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(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial(); chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
// chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.COAL_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue()), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText()); chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.COAL_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue()), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
// ArrayList<BookletPage> empowererPages = new ArrayList<>(); 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))); 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++) { 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 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_CRYSTALS).setNoText());
// empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText()); empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
// new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.EMPOWERER.get()), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial(); new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.EMPOWERER.get()), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
// new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.COIL.get()), 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()); new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.COIL.get()), 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(); chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant();
//
// //Miscellaneous //Miscellaneous
// new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WORM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WORM.get())), new PagePicture(2, "page_worms", 145)).setImportant(); new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WORM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WORM.get())), 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("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(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER.get()), 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("crystalClusters", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER.get()), 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.BLUE_BANNER, 1), new PageTextOnly(1)); new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BLUE_BANNER, 1), new PageTextOnly(1));
// new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText()); new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText());
// chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.BLACK_QUARTZ.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", AAWorldGen.QUARTZ_MIN).addTextReplacement("<highest>", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.itemBlackQuartz.get())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.BLACK_QUARTZ.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", AAWorldGen.QUARTZ_MIN).addTextReplacement("<highest>", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.itemBlackQuartz.get())), 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(ActuallyBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial(); // new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial();
// new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.TINY_COAL.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText()); new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.TINY_COAL.get()), 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<>(); ArrayList<BookletPage> lampPages = new ArrayList<>();
// lampPages.add(new PageTextOnly(lampPages.size() + 1)); lampPages.add(new PageTextOnly(lampPages.size() + 1));
// 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()); lampPages.add(new PageCrafting(lampPages.size() + 1, BlockCrafting.recipePowerer).setWildcard().setNoText());
// for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) { for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
// lampPages.add(new PageCrafting(lampPages.size() + 1, recipe).setNoText()); lampPages.add(new PageCrafting(lampPages.size() + 1, recipe).setNoText());
// } }
// new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockColoredLampOn.get(), 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()])); new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockColoredLampOn.get(), 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()]));
// new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.ENDER_STAR.get()), new PageCrafting(1, ItemCrafting.recipeEnderStar)); new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.ENDER_STAR.get()), new PageCrafting(1, ItemCrafting.recipeEnderStar));
// new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.SPAWNER_SHARD.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SPAWNER_SHARD.get()))); new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.SPAWNER_SHARD.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SPAWNER_SHARD.get())));
// // new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest.get()), new PagePicture(1, "page_treasure_chest", 150).addItemsToPage(new ItemStack(InitBlocks.blockTreasureChest.get())), new PageTextOnly(2)).setSpecial(); // new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest.get()), new PagePicture(1, "page_treasure_chest", 150).addItemsToPage(new ItemStack(InitBlocks.blockTreasureChest.get())), new PageTextOnly(2)).setSpecial();
// new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.HAIRY_BALL.get()), new PagePicture(1, "page_fur_balls", 110).addItemsToPage(new ItemStack(ActuallyItems.HAIRY_BALL.get())), new PageTextOnly(2)).setSpecial(); new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.HAIRY_BALL.get()), new PagePicture(1, "page_fur_balls", 110).addItemsToPage(new ItemStack(ActuallyItems.HAIRY_BALL.get())), new PageTextOnly(2)).setSpecial();
// // new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockBlackLotus.get())), new PageCrafting(2, ItemCrafting.recipeBlackDye)); // new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockBlackLotus.get())), new PageCrafting(2, ItemCrafting.recipeBlackDye));
// new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WATER_BOWL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WATER_BOWL.get()))); new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WATER_BOWL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WATER_BOWL.get())));
// new BookletChapter("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial(); new BookletChapter("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial();
//
// //Reconstruction //Reconstruction
// chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.LENS.get()), new PageTextOnly(1)).setImportant(); chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.LENS.get()), new PageTextOnly(1)).setImportant();
// new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial(); new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial();
// new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText()); new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText());
// new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.COLOR_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText()); new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.COLOR_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText());
// new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DAMAGE_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText()); new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DAMAGE_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText());
// new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MORE_DAMAGE_LENS.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText()); new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MORE_DAMAGE_LENS.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText());
// new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.EXPLOSION_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText()); new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.EXPLOSION_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText());
// new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial(); new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial();
// new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MINING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", ConfigIntValues.MINING_LENS_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant(); new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MINING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", ConfigIntValues.MINING_LENS_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant();
//
// //Laser Relays //Laser Relays
// chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_WRENCH.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<range>", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant(); chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_WRENCH.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<range>", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant();
// new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY.get()), 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("laserRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY.get()), 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(ActuallyBlocks.LASER_RELAY_FLUIDS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText()); new BookletChapter("fluidLaser", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_FLUIDS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText());
// new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial(); new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial();
// new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText()); new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText());
// new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard()); new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard());
// new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText()); new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText());
// new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_INVISIBILITY.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant(); new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_INVISIBILITY.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant();
// new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_RANGE.get()), new PageTextOnly(1).addTextReplacement("<def>", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("<upgraded>", TileEntityLaserRelay.MAX_DISTANCE_RANGED), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeRange).setNoText()).setImportant(); new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_RANGE.get()), 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 //No RF Using Blocks
// new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.BREAKER.get()), 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("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.BREAKER.get()), 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(ActuallyBlocks.DROPPER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText()); new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.DROPPER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText());
// new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), 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("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), 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(ActuallyBlocks.PHANTOM_REDSTONEFACE.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText()); new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_REDSTONEFACE.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
// new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText()); new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_BREAKER.get()), 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(ActuallyBlocks.INPUTTER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial(); new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.INPUTTER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
// new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.XP_SOLIDIFIER.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get())), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant(); new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.XP_SOLIDIFIER.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get())), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant();
// new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.GREENHOUSE_GLASS.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass)); new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.GREENHOUSE_GLASS.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
// new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.FEEDER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText()); new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.FEEDER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
// new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.blockGiantChest.get()), 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("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.blockGiantChest.get()), 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(ActuallyBlocks.RANGED_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText()); new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.RANGED_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText());
//
// //RF Using Blocks //RF Using Blocks
// new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FIREWORK_BOX.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial(); new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FIREWORK_BOX.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial();
// new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.BATTERY_BOX.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial(); new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.BATTERY_BOX.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial();
// new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FARMER.get()), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())), 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("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FARMER.get()), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())), 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(ActuallyBlocks.VERTICAL_DIGGER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.VERTICAL_DIGGER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
// new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.COFFEE_MACHINE.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.COFFEE_BEANS.get())).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.COFFEE.get())), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.COFFEE_MACHINE.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.COFFEE_BEANS.get())).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.COFFEE.get())), 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<IBookletPage> list = new ArrayList<>();
// list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE)); list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE));
// list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText()); list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
// list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText()); list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
// if (CrusherCrafting.recipeIronHorseArmor != null) { if (CrusherCrafting.recipeIronHorseArmor != null) {
// list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText()); list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
// } }
// if (CrusherCrafting.recipeGoldHorseArmor != null) { if (CrusherCrafting.recipeGoldHorseArmor != null) {
// list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText()); list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
// } }
// if (CrusherCrafting.recipeDiamondHorseArmor != null) { if (CrusherCrafting.recipeDiamondHorseArmor != null) {
// list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText()); list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
// } }
//
// new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.CRUSHER_DOUBLE.get()), list.toArray(new IBookletPage[0])); new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.CRUSHER_DOUBLE.get()), list.toArray(new IBookletPage[0]));
// new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.POWERED_FURNACE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityPoweredFurnace.ENERGY_USE)); new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.POWERED_FURNACE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityPoweredFurnace.ENERGY_USE));
// new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()), 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("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()), 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(ActuallyBlocks.ENERGIZER.get()), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.ENERGIZER.get()), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));
// // new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer.get()), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE)); // new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer.get()), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE));
// new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LONG_RANGE_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLongRangeBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityLongRangeBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LONG_RANGE_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLongRangeBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityLongRangeBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
// new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.PLAYER_INTERFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial(); new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.PLAYER_INTERFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
// new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DISPLAY_STAND.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial(); new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DISPLAY_STAND.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
// new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.SHOCK_SUPPRESSOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor)); new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.SHOCK_SUPPRESSOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
//
// //RF Generating Blocks //RF Generating Blocks
// // new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.blockFurnaceSolar.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText()); // new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.blockFurnaceSolar.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
// new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.HEAT_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("<min>", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText()); new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.HEAT_COLLECTOR.get()), 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(ActuallyBlocks.FERMENTING_BARREL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.CANOLA.get())).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())).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("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.FERMENTING_BARREL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.CANOLA.get())).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())).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(ActuallyBlocks.LEAF_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_AREA.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant(); new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.LEAF_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_AREA.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
// new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.BIOREACTOR.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial(); new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.BIOREACTOR.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial();
//
// //No RF Using Items //No RF Using Items
// chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.ENGINEER_GOGGLES.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant(); chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.ENGINEER_GOGGLES.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant();
// new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.BAG.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant(); new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.BAG.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
// new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.WINGS_OF_THE_BATS.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.BAT_WING.get())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial(); new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.WINGS_OF_THE_BATS.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.BAT_WING.get())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
// new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(ActuallyItems.FOOD.get(), 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(ActuallyItems.FOOD.get(), 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText()); new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(ActuallyItems.FOOD.get(), 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(ActuallyItems.FOOD.get(), 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText());
// new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.LEAF_BLOWER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant(); new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.LEAF_BLOWER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant();
// new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial(); new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
// ArrayList<BookletPage> aiotPages = new ArrayList<>(); ArrayList<BookletPage> aiotPages = new ArrayList<>();
// aiotPages.add(new PageTextOnly(aiotPages.size() + 1)); aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
// for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) { for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
// aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText()); aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText());
// } }
// new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.emeraldPaxel.get()), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant(); new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.emeraldPaxel.get()), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
//
// new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.JAM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.JAM.get(), 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3)); new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.JAM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.JAM.get(), 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3));
//
// ArrayList<BookletPage> potionRingPages = new ArrayList<>(); ArrayList<BookletPage> potionRingPages = new ArrayList<>();
// potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1)); potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
// for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) { for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
// potionRingPages.add(new PageCrafting(potionRingPages.size() + 1, recipe).setNoText()); potionRingPages.add(new PageCrafting(potionRingPages.size() + 1, recipe).setNoText());
// } }
// new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.POTION_RING.get()), potionRingPages.toArray(new BookletPage[potionRingPages.size()])); new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.POTION_RING.get()), potionRingPages.toArray(new BookletPage[potionRingPages.size()]));
// new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant(); new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
//
// //RF Using Items //RF Using Items
// new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.DRILL.get(), 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("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.DRILL.get(), 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(ActuallyItems.FILLING_WAND.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial(); new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.FILLING_WAND.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial();
// new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.TELE_STAFF.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant(); new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.TELE_STAFF.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant();
// new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.MAGNET_RING.get()), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.MAGNET_RING.get()), new PageCrafting(1, ItemCrafting.recipeMagnetRing));
// new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.GROWTH_RING.get()), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.GROWTH_RING.get()), new PageCrafting(1, ItemCrafting.recipeGrowthRing));
// new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.WATER_REMOVAL_RING.get()), new PageCrafting(1, ItemCrafting.recipeWaterRing)); new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.WATER_REMOVAL_RING.get()), new PageCrafting(1, ItemCrafting.recipeWaterRing));
// new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.BATTERY_TRIPLE.get()), 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()); new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.BATTERY_TRIPLE.get()), 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 //Updates and infos
// new BookletChapter("changelog", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.CLOCK), new PageLinkButton(1, UpdateChecker.CHANGELOG_LINK)); 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("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd"));
// new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get(), 1), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant(); new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get(), 1), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant();
// new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageLinkButton(1, "http://ellpeck.de")); new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageLinkButton(1, "http://ellpeck.de"));
//
// //Trials //Trials
// chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial(); chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial();
// new BookletChapterTrials("crystalProduction", new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get()), false); new BookletChapterTrials("crystalProduction", new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get()), false);
// new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false); new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false);
// new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, FluidAttributes.BUCKET_VOLUME)), false); new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, FluidAttributes.BUCKET_VOLUME)), false);
// new BookletChapterTrials("autoDisenchanter", new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), false); new BookletChapterTrials("autoDisenchanter", new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), false);
// new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false); new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false);
// new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false); new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
// new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false); new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false);
//
// */ */
// } }
//} }

View file

@ -1,119 +1,119 @@
///* /*
// * This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft. * This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button; package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
//import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.List; import java.util.List;
//import java.util.stream.Collectors; import java.util.stream.Collectors;
//
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public class BookmarkButton extends Button { public class BookmarkButton extends Button {
//
// private final GuiBooklet booklet; private final GuiBooklet booklet;
// public IBookletPage assignedPage; public IBookletPage assignedPage;
//
// public BookmarkButton(int x, int y, GuiBooklet booklet) { public BookmarkButton(int x, int y, GuiBooklet booklet) {
// super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> { super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> {
// BookmarkButton button = (BookmarkButton) btn; BookmarkButton button = (BookmarkButton) btn;
// if (button.assignedPage != null) { if (button.assignedPage != null) {
// if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
// button.assignedPage = null; button.assignedPage = null;
// } else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) { } else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) {
// GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage); GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage);
// Minecraft.getInstance().setScreen(gui); Minecraft.getInstance().setScreen(gui);
// } }
// } else { } else {
// if (button.booklet instanceof GuiPage) { if (button.booklet instanceof GuiPage) {
// button.assignedPage = ((GuiPage) button.booklet).pages[0]; button.assignedPage = ((GuiPage) button.booklet).pages[0];
// } }
// } }
// }); });
// this.booklet = booklet; this.booklet = booklet;
// } }
//
// @Override @Override
// public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
// if (this.visible) { if (this.visible) {
// Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GlStateManager._color4f(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager._color4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height; this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height;
// int offset = this.isHovered int offset = this.isHovered
// ? 1 ? 1
// : 0; : 0;
//
// GlStateManager._enableBlend(); GlStateManager._enableBlend();
// GlStateManager._blendFuncSeparate(770, 771, 1, 0); GlStateManager._blendFuncSeparate(770, 771, 1, 0);
// GlStateManager._blendFunc(770, 771); GlStateManager._blendFunc(770, 771);
// int renderHeight = 25; int renderHeight = 25;
// this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null
// ? 0 ? 0
// : 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight); : 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight);
//
// // TODO: FIX THIS // TODO: FIX THIS
// // this.mouseDragged(minecraft, mouseX, mouseY); // this.mouseDragged(minecraft, mouseX, mouseY);
//
// if (this.assignedPage != null) { if (this.assignedPage != null) {
// ItemStack display = this.assignedPage.getChapter().getDisplayItemStack(); ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
// if (StackUtil.isValid(display)) { if (StackUtil.isValid(display)) {
// GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
// AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F); AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
// GlStateManager._popMatrix(); GlStateManager._popMatrix();
// } }
// } }
// } }
// } }
//
// public void drawHover(MatrixStack stack, int mouseX, int mouseY) { public void drawHover(MatrixStack stack, int mouseX, int mouseY) {
// if (this.isMouseOver(mouseX, mouseY)) { if (this.isMouseOver(mouseX, mouseY)) {
// List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
//
// if (this.assignedPage != null) { if (this.assignedPage != null) {
// IBookletChapter chapter = this.assignedPage.getChapter(); IBookletChapter chapter = this.assignedPage.getChapter();
//
// list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1)); list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc")); list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
// list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc")); list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
// } else { } else {
// list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name")); list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
//
// if (this.booklet instanceof GuiPage) { if (this.booklet instanceof GuiPage) {
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc")); list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
// } else { } else {
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc")); list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
// } }
// } }
//
// Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
// GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.screen.width, mc.screen.height, -1, mc.font); GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.screen.width, mc.screen.height, -1, mc.font);
// } }
// } }
//} }

View file

@ -1,67 +1,67 @@
///* /*
// * This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft. * This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button; package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public class EntryButton extends Button { public class EntryButton extends Button {
//
// private final GuiBookletBase gui; private final GuiBookletBase gui;
// private final ItemStack stackToRender; private final ItemStack stackToRender;
//
// public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, 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); super(id, x, y, width, height, text);
// this.gui = gui; this.gui = gui;
// StackUtil.isValid(stackToRender); StackUtil.isValid(stackToRender);
// this.stackToRender = stackToRender; this.stackToRender = stackToRender;
// } }
//
// @Override @Override
// public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) { public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
// if (this.visible) { if (this.visible) {
// GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color3arg(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; this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
// GlStateManager._enableBlend(); GlStateManager._enableBlend();
// GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
// GlStateManager._blendFunc(770, 771); GlStateManager._blendFunc(770, 771);
// this.mouseDragged(minecraft, mouseX, mouseY); this.mouseDragged(minecraft, mouseX, mouseY);
//
// int textOffsetX = 0; int textOffsetX = 0;
// if (StackUtil.isValid(this.stackToRender)) { if (StackUtil.isValid(this.stackToRender)) {
// GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
// AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F); AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
// GlStateManager._popMatrix(); GlStateManager._popMatrix();
// textOffsetX = 10; textOffsetX = 10;
// } }
//
// float scale = this.gui.getMediumFontSize(); float scale = this.gui.getMediumFontSize();
//
// if (this.hovered) { if (this.hovered) {
// GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
// AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.font.width(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel); AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.font.width(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
// GlStateManager._popMatrix(); GlStateManager._popMatrix();
// } }
//
// StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale); StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale);
// } }
// } }
//} }

View file

@ -1,52 +1,52 @@
///* /*
// * This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft. * This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button; package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//
//import net.minecraft.client.gui.widget.button.Button.IPressable; import net.minecraft.client.gui.widget.button.Button.IPressable;
//
//public class TrialsButton extends TexturedButton { public class TrialsButton extends TexturedButton {
//
// private final boolean isTrials; private final boolean isTrials;
//
// public TrialsButton(GuiBooklet gui, IPressable action) { public TrialsButton(GuiBooklet gui, IPressable action) {
// super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action); super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action);
// this.isTrials = gui.areTrialsOpened(); this.isTrials = gui.areTrialsOpened();
// this.active = !this.isTrials; this.active = !this.isTrials;
// } }
//
// @Override @Override
// public void drawButton(Minecraft minecraft, int x, int y, float f) { public void drawButton(Minecraft minecraft, int x, int y, float f) {
// super.drawButton(minecraft, x, y, f); super.drawButton(minecraft, x, y, f);
//
// if (this.visible) { if (this.visible) {
// if (this.isHovered || this.isTrials) { if (this.isHovered || this.isTrials) {
// this.drawCenteredString(minecraft.font, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632); this.drawCenteredString(minecraft.font, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632);
// } }
// } }
// } }
//
// @Override @Override
// protected int getHoverState(boolean mouseOver) { protected int getHoverState(boolean mouseOver) {
// if (mouseOver || this.isTrials) { if (mouseOver || this.isTrials) {
// return 2; return 2;
// } else if (!this.active) { } else if (!this.active) {
// return 0; return 0;
// } else { } else {
// return 1; return 1;
// } }
// } }
//} }

View file

@ -1,110 +1,110 @@
///* /*
// * This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter; package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class BookletChapter implements IBookletChapter { public class BookletChapter implements IBookletChapter {
//
// public final IBookletPage[] pages; public final IBookletPage[] pages;
// public final IBookletEntry entry; public final IBookletEntry entry;
// public final ItemStack displayStack; public final ItemStack displayStack;
// private final String identifier; private final String identifier;
// private final int priority; private final int priority;
// public TextFormatting color; public TextFormatting color;
//
// public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// this(identifier, entry, displayStack, 0, pages); this(identifier, entry, displayStack, 0, pages);
// } }
//
// public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) { public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
// this.pages = pages; this.pages = pages;
// this.identifier = identifier; this.identifier = identifier;
// this.entry = entry; this.entry = entry;
// this.displayStack = displayStack; this.displayStack = displayStack;
// if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) { if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) {
// displayStack = ItemStack.EMPTY; displayStack = ItemStack.EMPTY;
// } }
// this.priority = priority; this.priority = priority;
// this.color = TextFormatting.RESET; this.color = TextFormatting.RESET;
//
// this.entry.addChapter(this); this.entry.addChapter(this);
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// page.setChapter(this); page.setChapter(this);
// } }
// } }
//
// @Override @Override
// public IBookletPage[] getAllPages() { public IBookletPage[] getAllPages() {
// return this.pages; return this.pages;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedName() { public String getLocalizedName() {
// return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name"); return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedNameWithFormatting() { public String getLocalizedNameWithFormatting() {
// return this.color + this.getLocalizedName(); return this.color + this.getLocalizedName();
// } }
//
// @Override @Override
// public IBookletEntry getEntry() { public IBookletEntry getEntry() {
// return this.entry; return this.entry;
// } }
//
// @Override @Override
// public ItemStack getDisplayItemStack() { public ItemStack getDisplayItemStack() {
// return this.displayStack; return this.displayStack;
// } }
//
// @Override @Override
// public String getIdentifier() { public String getIdentifier() {
// return this.identifier; return this.identifier;
// } }
//
// @Override @Override
// public int getPageIndex(IBookletPage page) { public int getPageIndex(IBookletPage page) {
// for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {
// if (this.pages[i] == page) { if (this.pages[i] == page) {
// return i; return i;
// } }
// } }
// return -1; return -1;
// } }
//
// @Override @Override
// public int getSortingPriority() { public int getSortingPriority() {
// return this.priority; return this.priority;
// } }
//
// public BookletChapter setImportant() { public BookletChapter setImportant() {
// this.color = TextFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
// return this; return this;
// } }
//
// public BookletChapter setSpecial() { public BookletChapter setSpecial() {
// this.color = TextFormatting.DARK_PURPLE; this.color = TextFormatting.DARK_PURPLE;
// return this; return this;
// } }
//} }

View file

@ -1,46 +1,46 @@
///* /*
// * This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter; package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.Arrays; import java.util.Arrays;
//import java.util.List; import java.util.List;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
//import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage; import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine; import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
//import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//
//public class BookletChapterCoffee extends BookletChapter { public class BookletChapterCoffee extends BookletChapter {
//
// public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// super(identifier, entry, displayStack, getPages(pages)); super(identifier, entry, displayStack, getPages(pages));
// } }
//
// private static IBookletPage[] getPages(IBookletPage... pages) { private static IBookletPage[] getPages(IBookletPage... pages) {
// List<IBookletPage> allPages = new ArrayList<>(); List<IBookletPage> allPages = new ArrayList<>();
// allPages.addAll(Arrays.asList(pages)); allPages.addAll(Arrays.asList(pages));
//
// for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) { for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
// BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient); BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
// if (!(ingredient instanceof ItemCoffee.MilkIngredient)) { if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
// page.setNoText(); page.setNoText();
// } }
// allPages.add(page); allPages.add(page);
// } }
//
// return allPages.toArray(new IBookletPage[allPages.size()]); return allPages.toArray(new IBookletPage[allPages.size()]);
// } }
//} }

View file

@ -1,40 +1,40 @@
///* /*
// * This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter; package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import java.util.ArrayList;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import java.util.Arrays;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe; import java.util.List;
//import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
//import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import net.minecraft.item.ItemStack; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
// import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
//import java.util.ArrayList; import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
//import java.util.Arrays; import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
//import java.util.List; import net.minecraft.item.ItemStack;
//
//public class BookletChapterCrusher extends BookletChapter { public class BookletChapterCrusher extends BookletChapter {
//
// public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// super(identifier, entry, displayStack, getPages(pages)); super(identifier, entry, displayStack, getPages(pages));
// } }
//
// private static IBookletPage[] getPages(IBookletPage... pages) { private static IBookletPage[] getPages(IBookletPage... pages) {
// List<IBookletPage> allPages = new ArrayList<>(); List<IBookletPage> allPages = new ArrayList<>();
// allPages.addAll(Arrays.asList(pages)); allPages.addAll(Arrays.asList(pages));
//
// for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) { for (CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES) {
// allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText()); allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
// } }
//
// return allPages.toArray(new IBookletPage[allPages.size()]); return allPages.toArray(new IBookletPage[allPages.size()]);
// } }
//} }

View file

@ -1,48 +1,48 @@
///* /*
// * This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter; package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials; import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class BookletChapterTrials extends BookletChapter { public class BookletChapterTrials extends BookletChapter {
//
// public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) { public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
// super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText)); super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedName() { public String getLocalizedName() {
// return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name"); return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedNameWithFormatting() { public String getLocalizedNameWithFormatting() {
// PlayerEntity player = Minecraft.getInstance().player; PlayerEntity player = Minecraft.getInstance().player;
// PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
// boolean completed = data.completedTrials.contains(this.getIdentifier()); boolean completed = data.completedTrials.contains(this.getIdentifier());
//
// return (completed return (completed
// ? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
// : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName(); : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
// } }
//} }

View file

@ -1,162 +1,162 @@
///* /*
// * This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.entry; package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
//
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.List; import java.util.List;
//import java.util.Locale; import java.util.Locale;
//
//public class BookletEntry implements IBookletEntry { public class BookletEntry implements IBookletEntry {
//
// private final String identifier; private final String identifier;
// private final int priority; private final int priority;
// private final List<IBookletChapter> chapters = new ArrayList<>(); private final List<IBookletChapter> chapters = new ArrayList<>();
// private TextFormatting color; private TextFormatting color;
//
// public BookletEntry(String identifier) { public BookletEntry(String identifier) {
// this(identifier, 0); this(identifier, 0);
// } }
//
// public BookletEntry(String identifier, int prio) { public BookletEntry(String identifier, int prio) {
// this.identifier = identifier; this.identifier = identifier;
// this.priority = prio; this.priority = prio;
// ActuallyAdditionsAPI.addBookletEntry(this); ActuallyAdditionsAPI.addBookletEntry(this);
//
// this.color = TextFormatting.RESET; this.color = TextFormatting.RESET;
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// private static boolean fitsFilter(IBookletPage page, String searchBarText) { private static boolean fitsFilter(IBookletPage page, String searchBarText) {
// Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
//
// List<ItemStack> items = new ArrayList<>(); List<ItemStack> items = new ArrayList<>();
// page.getItemStacksForPage(items); page.getItemStacksForPage(items);
// if (!items.isEmpty()) { if (!items.isEmpty()) {
// for (ItemStack stack : items) { for (ItemStack stack : items) {
// if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
// List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
// ? ITooltipFlag.TooltipFlags.ADVANCED ? ITooltipFlag.TooltipFlags.ADVANCED
// : ITooltipFlag.TooltipFlags.NORMAL); : ITooltipFlag.TooltipFlags.NORMAL);
// for (String strg : tooltip) { for (String strg : tooltip) {
// if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
// return true; return true;
// } }
// } }
// } }
// } }
// } }
//
// List<FluidStack> fluids = new ArrayList<>(); List<FluidStack> fluids = new ArrayList<>();
// page.getFluidStacksForPage(fluids); page.getFluidStacksForPage(fluids);
// if (!fluids.isEmpty()) { if (!fluids.isEmpty()) {
// for (FluidStack stack : fluids) { for (FluidStack stack : fluids) {
// if (stack != null) { if (stack != null) {
// String strg = stack.getLocalizedName(); String strg = stack.getLocalizedName();
// if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
// return true; return true;
// } }
// } }
// } }
// } }
//
// return false; return false;
// } }
//
// @Override @Override
// public List<IBookletChapter> getAllChapters() { public List<IBookletChapter> getAllChapters() {
// return this.chapters; return this.chapters;
// } }
//
// @Override @Override
// public String getIdentifier() { public String getIdentifier() {
// return this.identifier; return this.identifier;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedName() { public String getLocalizedName() {
// return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name"); return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getLocalizedNameWithFormatting() { public String getLocalizedNameWithFormatting() {
// return this.color + this.getLocalizedName(); return this.color + this.getLocalizedName();
// } }
//
// @Override @Override
// public void addChapter(IBookletChapter chapter) { public void addChapter(IBookletChapter chapter) {
// this.chapters.add(chapter); this.chapters.add(chapter);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public List<IBookletChapter> getChaptersForDisplay(String searchBarText) { public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
// if (searchBarText != null && !searchBarText.isEmpty()) { if (searchBarText != null && !searchBarText.isEmpty()) {
// String search = searchBarText.toLowerCase(Locale.ROOT); String search = searchBarText.toLowerCase(Locale.ROOT);
//
// List<IBookletChapter> fittingChapters = new ArrayList<>(); List<IBookletChapter> fittingChapters = new ArrayList<>();
// for (IBookletChapter chapter : this.getAllChapters()) { for (IBookletChapter chapter : this.getAllChapters()) {
// if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) { if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) {
// fittingChapters.add(chapter); fittingChapters.add(chapter);
// } else { } else {
// for (IBookletPage page : chapter.getAllPages()) { for (IBookletPage page : chapter.getAllPages()) {
// if (fitsFilter(page, search)) { if (fitsFilter(page, search)) {
// fittingChapters.add(chapter); fittingChapters.add(chapter);
// break; break;
// } }
// } }
// } }
// } }
//
// return fittingChapters; return fittingChapters;
// } else { } else {
// return this.getAllChapters(); return this.getAllChapters();
// } }
// } }
//
// @Override @Override
// public int getSortingPriority() { public int getSortingPriority() {
// return this.priority; return this.priority;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public boolean visibleOnFrontPage() { public boolean visibleOnFrontPage() {
// return true; return true;
// } }
//
// public BookletEntry setImportant() { public BookletEntry setImportant() {
// this.color = TextFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
// return this; return this;
// } }
//
// public BookletEntry setSpecial() { public BookletEntry setSpecial() {
// this.color = TextFormatting.DARK_PURPLE; this.color = TextFormatting.DARK_PURPLE;
// return this; return this;
// } }
//
//} }

View file

@ -1,33 +1,33 @@
///* /*
// * This file ("BookletEntryAllItems.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletEntryAllItems.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.entry; package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
//import java.util.List; import java.util.List;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//
//public class BookletEntryAllItems extends BookletEntry { public class BookletEntryAllItems extends BookletEntry {
//
// public BookletEntryAllItems(String identifier) { public BookletEntryAllItems(String identifier) {
// super(identifier, -Integer.MAX_VALUE); super(identifier, -Integer.MAX_VALUE);
// } }
//
// @Override @Override
// public void addChapter(IBookletChapter chapter) { public void addChapter(IBookletChapter chapter) {
//
// } }
//
// @Override @Override
// public List<IBookletChapter> getAllChapters() { public List<IBookletChapter> getAllChapters() {
// return ActuallyAdditionsAPI.ALL_CHAPTERS; return ActuallyAdditionsAPI.ALL_CHAPTERS;
// } }
//} }

View file

@ -1,23 +1,23 @@
///* /*
// * This file ("BookletEntryTrials.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletEntryTrials.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.entry; package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
//public class BookletEntryTrials extends BookletEntry { public class BookletEntryTrials extends BookletEntry {
//
// public BookletEntryTrials(String identifier) { public BookletEntryTrials(String identifier) {
// super(identifier, -Integer.MAX_VALUE); super(identifier, -Integer.MAX_VALUE);
// } }
//
// @Override @Override
// public boolean visibleOnFrontPage() { public boolean visibleOnFrontPage() {
// return false; return false;
// } }
//} }

View file

@ -1,369 +1,369 @@
///* /*
// * This file ("GuiBooklet.java") is part of the Actually Additions mod for Minecraft. * This file ("GuiBooklet.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui; package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
//import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton; import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
//import de.ellpeck.actuallyadditions.mod.booklet.button.TrialsButton; import de.ellpeck.actuallyadditions.mod.booklet.button.TrialsButton;
//import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.gui.IGuiEventListener; import net.minecraft.client.gui.IGuiEventListener;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.TextFieldWidget;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
//import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.util.Arrays; import java.util.Arrays;
//import java.util.List; import java.util.List;
//import java.util.stream.Collectors; import java.util.stream.Collectors;
//
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public abstract class GuiBooklet extends GuiBookletBase { public abstract class GuiBooklet extends GuiBookletBase {
//
// public static final int BUTTONS_PER_PAGE = 12; 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_GUI = AssetUtil.getBookletGuiLocation("gui_booklet");
// public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets"); public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets");
// protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12]; protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12];
// public Screen previousScreen; public Screen previousScreen;
// public GuiBookletBase parentPage; public GuiBookletBase parentPage;
// public TextFieldWidget searchField; public TextFieldWidget searchField;
// protected int xSize; protected int xSize;
// protected int ySize; protected int ySize;
// protected int guiLeft; protected int guiLeft;
// protected int guiTop; protected int guiTop;
// private Button buttonLeft; private Button buttonLeft;
// private Button buttonRight; private Button buttonRight;
// private Button buttonBack; private Button buttonBack;
//
// private Button buttonTrials; private Button buttonTrials;
//
// private float smallFontSize; private float smallFontSize;
// private float mediumFontSize; private float mediumFontSize;
// private float largeFontSize; private float largeFontSize;
//
// public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) { public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) {
// super(StringTextComponent.EMPTY); super(StringTextComponent.EMPTY);
//
// this.previousScreen = previousScreen; this.previousScreen = previousScreen;
// this.parentPage = parentPage; this.parentPage = parentPage;
//
// this.xSize = 281; this.xSize = 281;
// this.ySize = 180; this.ySize = 180;
// } }
//
// private static float getFontSize(String lang, ConfigIntValues config, float defaultValue) { private static float getFontSize(String lang, ConfigIntValues config, float defaultValue) {
// int conf = config.getValue(); int conf = config.getValue();
// if (conf <= 0) { if (conf <= 0) {
// try { try {
// return Float.parseFloat(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".fontSize." + lang)); return Float.parseFloat(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".fontSize." + lang));
// } catch (Exception e) { } catch (Exception e) {
// return defaultValue; return defaultValue;
// } }
// } else { } else {
// return conf / 100F; return conf / 100F;
// } }
// } }
//
@Override
public void init() {
super.init();
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, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, btn -> this.onPageLeftButtonPressed());
this.addButton(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, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, btn -> this.onPageRightButtonPressed());
this.addButton(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, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, btn -> this.onBackButtonPressed());
this.addButton(this.buttonBack);
}
if (this.hasSearchBar()) {
this.searchField = new TextFieldWidget(this.font, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12, StringTextComponent.EMPTY);
this.searchField.setMaxLength(50);
this.searchField.setBordered(false);
this.children.add(this.searchField);
}
if (this.hasBookmarkButtons()) {
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().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(xStart + i * 16, this.guiTop + this.ySize, this);
this.addButton(this.bookmarkButtons[i]);
if (data.bookmarks[i] != null) {
this.bookmarkButtons[i].assignedPage = data.bookmarks[i];
}
}
}
this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false)));
this.addButton(this.buttonTrials);
}
@Override
public void removed() {
super.removed();
//Don't cache the parent GUI, otherwise it opens again when you close the cached book!
this.previousScreen = null;
if (this.getMinecraft().player == null) {
return;
}
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().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 render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.drawScreenPre(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.drawScreenPost(matrixStack, mouseX, mouseY, partialTicks);
}
public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
GlStateManager._color4f(1F, 1F, 1F, 1F);
this.getMinecraft().getTextureManager().bind(RES_LOC_GUI);
blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512);
if (this.hasSearchBar()) {
this.getMinecraft().getTextureManager().bind(RES_LOC_GADGETS);
this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14);
// boolean unicodeBefore = this.font.getUnicodeFlag();
// this.font.setUnicodeFlag(true);
if (!this.searchField.isFocused() && (this.searchField.getValue() == null || this.searchField.getValue().isEmpty())) {
this.font.draw(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF);
}
this.searchField.render(matrices, mouseX, mouseY, partialTicks);
// this.font.setUnicodeFlag(unicodeBefore);
}
}
public void drawScreenPost(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
for (IGuiEventListener button : this.children) {
if (button instanceof BookmarkButton) {
((BookmarkButton) button).drawHover(matrixStack, mouseX, mouseY);
} else if (button instanceof TexturedButton) {
((TexturedButton) button).drawHover(matrixStack, mouseX, mouseY);
}
}
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return super.mouseClicked(mouseX, mouseY, button);
}
// TODO: Ensure replacement works
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
if (delta < 0) {
if (this.hasPageRightButton()) {
this.onPageRightButtonPressed();
}
} else if (delta > 0) {
if (this.hasPageLeftButton()) {
this.onPageLeftButtonPressed();
}
}
return super.mouseScrolled(mouseX, mouseY, delta);
}
// @Override // @Override
// public void init() { // public void handleMouseInput() throws IOException {
// super.init(); // int wheel = Mouse.getEventDWheel();
// // if (wheel != 0) {
// this.guiLeft = (this.width - this.xSize) / 2; // if (wheel < 0) {
// 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, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, btn -> this.onPageLeftButtonPressed());
// this.addButton(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, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, btn -> this.onPageRightButtonPressed());
// this.addButton(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, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, btn -> this.onBackButtonPressed());
// this.addButton(this.buttonBack);
// }
//
// if (this.hasSearchBar()) {
// this.searchField = new TextFieldWidget(this.font, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12, StringTextComponent.EMPTY);
// this.searchField.setMaxLength(50);
// this.searchField.setBordered(false);
// this.children.add(this.searchField);
// }
//
// if (this.hasBookmarkButtons()) {
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().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(xStart + i * 16, this.guiTop + this.ySize, this);
// this.addButton(this.bookmarkButtons[i]);
//
// if (data.bookmarks[i] != null) {
// this.bookmarkButtons[i].assignedPage = data.bookmarks[i];
// }
// }
// }
//
// this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false)));
// this.addButton(this.buttonTrials);
// }
//
// @Override
// public void removed() {
// super.removed();
//
// //Don't cache the parent GUI, otherwise it opens again when you close the cached book!
// this.previousScreen = null;
//
// if (this.getMinecraft().player == null) {
// return;
// }
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().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 render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
// this.drawScreenPre(matrixStack, mouseX, mouseY, partialTicks);
// super.render(matrixStack, mouseX, mouseY, partialTicks);
// this.drawScreenPost(matrixStack, mouseX, mouseY, partialTicks);
// }
//
// public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
// GlStateManager._color4f(1F, 1F, 1F, 1F);
// this.getMinecraft().getTextureManager().bind(RES_LOC_GUI);
// blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512);
//
// if (this.hasSearchBar()) {
// this.getMinecraft().getTextureManager().bind(RES_LOC_GADGETS);
// this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14);
//
// // boolean unicodeBefore = this.font.getUnicodeFlag();
// // this.font.setUnicodeFlag(true);
//
// if (!this.searchField.isFocused() && (this.searchField.getValue() == null || this.searchField.getValue().isEmpty())) {
// this.font.draw(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF);
// }
//
// this.searchField.render(matrices, mouseX, mouseY, partialTicks);
//
// // this.font.setUnicodeFlag(unicodeBefore);
// }
// }
//
// public void drawScreenPost(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
// for (IGuiEventListener button : this.children) {
// if (button instanceof BookmarkButton) {
// ((BookmarkButton) button).drawHover(matrixStack, mouseX, mouseY);
// } else if (button instanceof TexturedButton) {
// ((TexturedButton) button).drawHover(matrixStack, mouseX, mouseY);
// }
// }
// }
//
// @Override
// public boolean mouseClicked(double mouseX, double mouseY, int button) {
// return super.mouseClicked(mouseX, mouseY, button);
// }
//
// // TODO: Ensure replacement works
// @Override
// public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
// if (delta < 0) {
// if (this.hasPageRightButton()) { // if (this.hasPageRightButton()) {
// this.onPageRightButtonPressed(); // this.onPageRightButtonPressed();
// } // }
// } else if (delta > 0) { // } else if (wheel > 0) {
// if (this.hasPageLeftButton()) { // if (this.hasPageLeftButton()) {
// this.onPageLeftButtonPressed(); // this.onPageLeftButtonPressed();
// } // }
// } // }
// return super.mouseScrolled(mouseX, mouseY, delta);
// } // }
// // super.handleMouseInput();
// // @Override // }
// // public void handleMouseInput() throws IOException {
// // int wheel = Mouse.getEventDWheel();
// // if (wheel != 0) { @Override
// // if (wheel < 0) { public void tick() {
// // if (this.hasPageRightButton()) { if (this.hasSearchBar()) {
// // this.onPageRightButtonPressed(); this.searchField.tick();
// // } }
// // } else if (wheel > 0) { }
// // if (this.hasPageLeftButton()) {
// // this.onPageLeftButtonPressed(); @Override
// // } public boolean isPauseScreen() {
// // } return false;
// // } }
// // super.handleMouseInput();
// // } 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.getMinecraft().setScreen(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;
}
// TODO: Check if not being used
public void onSearchBarChanged(String searchBarText) {
GuiBookletBase parent = !(this instanceof GuiEntry)
? this
: this.parentPage;
this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
}
// TODO: ensure typing still works
// @Override // @Override
// public void tick() { // protected void keyTyped(char typedChar, int key) throws IOException {
// if (this.hasSearchBar()) { // if (key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused())) {
// this.searchField.tick(); // this.mc.displayGuiScreen(this.previousScreen);
// } // } else if (this.hasSearchBar() & this.searchField.isFocused()) {
// } // String lastText = this.searchField.getText();
// //
// @Override // this.searchField.textboxKeyTyped(typedChar, key);
// public boolean isPauseScreen() { //
// return false; // if (!lastText.equals(this.searchField.getText())) {
// } // this.onSearchBarChanged(this.searchField.getText());
// // }
// public boolean hasPageLeftButton() { // } else {
// return false; // super.keyTyped(typedChar, key);
// }
//
// 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.getMinecraft().setScreen(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;
// }
//
// // TODO: Check if not being used
// public void onSearchBarChanged(String searchBarText) {
// GuiBookletBase parent = !(this instanceof GuiEntry)
// ? this
// : this.parentPage;
// this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
// }
//
// // TODO: ensure typing still works
//
// // @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.font, 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.font, text, x, y, color, shadow, scale, length);
// }
//
// @Override
// public List<IGuiEventListener> getButtonList() {
// return this.children.stream().filter(e -> e instanceof Button).collect(Collectors.toList());
// }
//
// @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;
// } // }
// } // }
@Override
public void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale) {
StringUtil.renderScaledAsciiString(this.font, 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.font, text, x, y, color, shadow, scale, length);
}
@Override
public List<IGuiEventListener> getButtonList() {
return this.children.stream().filter(e -> e instanceof Button).collect(Collectors.toList());
}
@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;
}
}

View file

@ -1,170 +1,170 @@
///* /*
// * This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft. * This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui; package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.io.IOException; import java.io.IOException;
//import java.util.List; import java.util.List;
//
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public class GuiEntry extends GuiBooklet { 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. //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 entryPage;
// private final int pageAmount; private final int pageAmount;
// private final IBookletEntry entry; private final IBookletEntry entry;
// private final List<IBookletChapter> chapters; private final List<IBookletChapter> chapters;
// private final String searchText; private final String searchText;
// private final boolean focusSearch; private final boolean focusSearch;
//
// public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) { public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) {
// super(previousScreen, parentPage); super(previousScreen, parentPage);
// this.entryPage = entryPage; this.entryPage = entryPage;
// this.entry = entry; this.entry = entry;
// this.searchText = search; this.searchText = search;
// this.focusSearch = focusSearch; this.focusSearch = focusSearch;
// this.chapters = entry.getChaptersForDisplay(search); this.chapters = entry.getChaptersForDisplay(search);
//
// if (!this.chapters.isEmpty()) { if (!this.chapters.isEmpty()) {
// IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1); IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
// this.pageAmount = lastChap == null this.pageAmount = lastChap == null
// ? 1 ? 1
// : calcEntryPage(this.entry, lastChap, this.searchText) + 1; : calcEntryPage(this.entry, lastChap, this.searchText) + 1;
// } else { } else {
// this.pageAmount = 1; this.pageAmount = 1;
// } }
// } }
//
// public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) { public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) {
// this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch); this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
// } }
//
// private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) { private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) {
// int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc); int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc);
// return index / (BUTTONS_PER_PAGE * 2); return index / (BUTTONS_PER_PAGE * 2);
// } }
//
// @Override @Override
// public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(matrices, mouseX, mouseY, partialTicks); super.drawScreenPre(matrices, mouseX, mouseY, partialTicks);
//
// String name = this.entry.getLocalizedName(); String name = this.entry.getLocalizedName();
// this.font.draw(matrices, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF); this.font.draw(matrices, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF);
//
// for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
// String pageStrg = "Page " + (this.entryPage * 2 + i + 1) + "/" + this.pageAmount * 2; 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()); this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
// } }
// } }
//
// @Override @Override
// public void init() { public void init() {
// super.init(); super.init();
//
// if (this.hasSearchBar() && this.searchText != null) { if (this.hasSearchBar() && this.searchText != null) {
// this.searchField.setValue(this.searchText); this.searchField.setValue(this.searchText);
// if (this.focusSearch) { if (this.focusSearch) {
// this.searchField.setFocus(true); this.searchField.setFocus(true);
// } }
// } }
//
// int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2; int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2;
// for (int x = 0; x < 2; x++) { for (int x = 0; x < 2; x++) {
// for (int y = 0; y < BUTTONS_PER_PAGE; y++) { for (int y = 0; y < BUTTONS_PER_PAGE; y++) {
// int id = y + x * BUTTONS_PER_PAGE; int id = y + x * BUTTONS_PER_PAGE;
// if (this.chapters.size() > id + idOffset) { if (this.chapters.size() > id + idOffset) {
// IBookletChapter chapter = this.chapters.get(id + idOffset); IBookletChapter chapter = this.chapters.get(id + idOffset);
// this.addButton(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack())); this.addButton(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
// } else { } else {
// return; return;
// } }
// } }
// } }
// } }
///* /*
// @Override @Override
// protected void actionPerformed(Button button) throws IOException { protected void actionPerformed(Button button) throws IOException {
// if (button instanceof EntryButton) { if (button instanceof EntryButton) {
// int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2; int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2;
//
// if (this.chapters.size() > actualId) { if (this.chapters.size() > actualId) {
// IBookletChapter chapter = this.chapters.get(actualId); IBookletChapter chapter = this.chapters.get(actualId);
// if (chapter != null) { if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages(); IBookletPage[] pages = chapter.getAllPages();
// if (pages != null && pages.length > 0) { if (pages != null && pages.length > 0) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0])); this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0]));
// } }
// } }
// } }
// } else { } else {
// super.actionPerformed(button); super.actionPerformed(button);
// } }
// } }
//
// */ */
//
// @Override @Override
// public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
//
// } }
//
// @Override @Override
// public boolean hasPageLeftButton() { public boolean hasPageLeftButton() {
// return this.entryPage > 0; return this.entryPage > 0;
// } }
//
// @Override @Override
// public void onPageLeftButtonPressed() { public void onPageLeftButtonPressed() {
// this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused())); this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused()));
// } }
//
// @Override @Override
// public boolean hasPageRightButton() { public boolean hasPageRightButton() {
// return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1; return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1;
// } }
//
// @Override @Override
// public void onPageRightButtonPressed() { public void onPageRightButtonPressed() {
// this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused())); this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused()));
// } }
//
// @Override @Override
// public boolean hasBackButton() { public boolean hasBackButton() {
// return true; return true;
// } }
//
// @Override @Override
// public void onBackButtonPressed() { public void onBackButtonPressed() {
// if (!hasShiftDown()) { if (!hasShiftDown()) {
// this.minecraft.setScreen(this.parentPage); this.minecraft.setScreen(this.parentPage);
// } else { } else {
// super.onBackButtonPressed(); super.onBackButtonPressed();
// } }
// } }
//
// @Override @Override
// public boolean areTrialsOpened() { public boolean areTrialsOpened() {
// return this.entry instanceof BookletEntryTrials; return this.entry instanceof BookletEntryTrials;
// } }
//} }

View file

@ -1,240 +1,240 @@
///* /*
// * This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft. * This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui; package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet; import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.io.IOException; import java.io.IOException;
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.List; import java.util.List;
//
////TODO Fix achievement button //TODO Fix achievement button
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public class GuiMainPage extends GuiBooklet { 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 Ive 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 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 Ive 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 achievementButton;
// private TexturedButton configButton; private TexturedButton configButton;
//
// private Button tutorialButton; private Button tutorialButton;
// private boolean showTutorial; private boolean showTutorial;
//
// private String bookletName; private String bookletName;
// private String bookletEdition; private String bookletEdition;
//
// private List<String> quote; private List<String> quote;
// private String quoteGuy; private String quoteGuy;
//
// public GuiMainPage(Screen previousScreen) { public GuiMainPage(Screen previousScreen) {
// super(previousScreen, null); super(previousScreen, null);
// } }
//
// private static List<IBookletEntry> getDisplayedEntries() { private static List<IBookletEntry> getDisplayedEntries() {
// List<IBookletEntry> displayed = new ArrayList<>(); List<IBookletEntry> displayed = new ArrayList<>();
//
// for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) { for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
// if (entry.visibleOnFrontPage()) { if (entry.visibleOnFrontPage()) {
// displayed.add(entry); displayed.add(entry);
// } }
// } }
//
// return displayed; return displayed;
// } }
//
// @Override @Override
// public void init() { public void init() {
// super.init(); super.init();
//
// int flavor = 1; int flavor = 1;
// if (this.getMinecraft().level.random.nextFloat() <= 0.1) { if (this.getMinecraft().level.random.nextFloat() <= 0.1) {
// flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7); flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7);
// } }
// this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor; this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
//
// String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)]; String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)];
// String[] quoteSplit = usedQuote.split("@"); String[] quoteSplit = usedQuote.split("@");
// if (quoteSplit.length == 2) { if (quoteSplit.length == 2) {
// //this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut //this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut
// this.quoteGuy = quoteSplit[1]; this.quoteGuy = quoteSplit[1];
// } }
//
// String playerName = this.getMinecraft().player.getName().getString(); String playerName = this.getMinecraft().player.getName().getString();
// if (playerName.equalsIgnoreCase("dqmhose")) { if (playerName.equalsIgnoreCase("dqmhose")) {
// this.bookletEdition = "Pants Edition"; this.bookletEdition = "Pants Edition";
// } else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) { } else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
// this.bookletEdition = "Illustrator's Edition"; this.bookletEdition = "Illustrator's Edition";
// } else if (playerName.equalsIgnoreCase("KittyVanCat")) { } else if (playerName.equalsIgnoreCase("KittyVanCat")) {
// this.bookletEdition = "Cat's Edition"; this.bookletEdition = "Cat's Edition";
// } else if (playerName.equalsIgnoreCase("canitzp")) { } else if (playerName.equalsIgnoreCase("canitzp")) {
// this.bookletEdition = "P's Edition"; this.bookletEdition = "P's Edition";
// } else if (playerName.equalsIgnoreCase("direwolf20")) { } else if (playerName.equalsIgnoreCase("direwolf20")) {
// this.bookletEdition = "Edition 20"; this.bookletEdition = "Edition 20";
// } else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) { } else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) {
// this.bookletEdition = "Derp's Edition"; this.bookletEdition = "Derp's Edition";
// } else if (playerName.equalsIgnoreCase("mezz")) { } else if (playerName.equalsIgnoreCase("mezz")) {
// this.bookletEdition = "Just Enough Editions"; this.bookletEdition = "Just Enough Editions";
// } else if (playerName.equalsIgnoreCase("amadornes")) { } else if (playerName.equalsIgnoreCase("amadornes")) {
// this.bookletEdition = "Beard's Edition"; this.bookletEdition = "Beard's Edition";
// } else if (playerName.equalsIgnoreCase("raoul")) { } else if (playerName.equalsIgnoreCase("raoul")) {
// this.bookletEdition = "Giraffe's Edition"; this.bookletEdition = "Giraffe's Edition";
// } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) { } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
// String[] colors = new String[15]; String[] colors = new String[15];
// for (int i = 0; i < colors.length; i++) { for (int i = 0; i < colors.length; i++) {
// colors[i] = TextFormatting.getById(this.getMinecraft().level.random.nextInt(15)).toString() + TextFormatting.ITALIC; colors[i] = TextFormatting.getById(this.getMinecraft().level.random.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); 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")) { } else if (playerName.equalsIgnoreCase("oitsjustjose")) {
// this.bookletEdition = "oitsjustanedition"; this.bookletEdition = "oitsjustanedition";
// } else if (playerName.equalsIgnoreCase("xbony2")) { } else if (playerName.equalsIgnoreCase("xbony2")) {
// this.bookletEdition = "Naughty Edition"; this.bookletEdition = "Naughty Edition";
// } else if (playerName.equalsIgnoreCase("themattabase")) { } else if (playerName.equalsIgnoreCase("themattabase")) {
// this.bookletEdition = "Withered Edition"; this.bookletEdition = "Withered Edition";
// } else if (playerName.equalsIgnoreCase("robsonld04")) { } else if (playerName.equalsIgnoreCase("robsonld04")) {
// this.bookletEdition = "Modpack Edition"; this.bookletEdition = "Modpack Edition";
// } else if (playerName.equalsIgnoreCase("snowshock35")) { } else if (playerName.equalsIgnoreCase("snowshock35")) {
// this.bookletEdition = "Edition 35"; this.bookletEdition = "Edition 35";
// } else if (playerName.equalsIgnoreCase("asiekierka")) { } else if (playerName.equalsIgnoreCase("asiekierka")) {
// this.bookletEdition = "‽ Edition"; this.bookletEdition = "‽ Edition";
// } else if (playerName.equalsIgnoreCase("elucent")) { } else if (playerName.equalsIgnoreCase("elucent")) {
// this.bookletEdition = ""; this.bookletEdition = "";
// } else { } else {
// if (Util.isDevVersion()) { if (Util.isDevVersion()) {
// this.bookletEdition = "Dev's Edition"; this.bookletEdition = "Dev's Edition";
// } else { } else {
// this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion(); this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion();
// } }
// } }
//
// List<String> configText = new ArrayList<>(); List<String> configText = new ArrayList<>();
// configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
// //configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); //TODO wut //configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); //TODO wut
// this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, btn -> { this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, btn -> {
// }); });
// this.addButton(this.configButton); this.addButton(this.configButton);
//
// List<String> achievementText = new ArrayList<>(); List<String> achievementText = new ArrayList<>();
// achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name")); achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name"));
// //achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); //TODO wut //achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); //TODO wut
// //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText);
// //this.addButton(this.achievementButton); //this.addButton(this.achievementButton);
//
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
// if (!data.didBookTutorial) { if (!data.didBookTutorial) {
// this.showTutorial = true; this.showTutorial = true;
//
// //this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3"); //this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
// this.addButton(this.tutorialButton); this.addButton(this.tutorialButton);
//
// this.configButton.visible = false; this.configButton.visible = false;
// //this.achievementButton.visible = false; //this.achievementButton.visible = false;
// } }
//
// for (int i = 0; i < BUTTONS_PER_PAGE; i++) { for (int i = 0; i < BUTTONS_PER_PAGE; i++) {
// List<IBookletEntry> displayed = getDisplayedEntries(); List<IBookletEntry> displayed = getDisplayedEntries();
// if (displayed.size() > i) { if (displayed.size() > i) {
// IBookletEntry entry = displayed.get(i); IBookletEntry entry = displayed.get(i);
// this.addButton(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY)); this.addButton(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY));
// } else { } else {
// return; return;
// } }
// } }
// } }
///* /*
// @Override @Override
// protected void actionPerformed(GuiButton button) throws IOException { protected void actionPerformed(GuiButton button) throws IOException {
// if (button instanceof EntryButton) { if (button instanceof EntryButton) {
// List<IBookletEntry> displayed = getDisplayedEntries(); List<IBookletEntry> displayed = getDisplayedEntries();
// if (displayed.size() > button.id) { if (displayed.size() > button.id) {
// IBookletEntry entry = displayed.get(button.id); IBookletEntry entry = displayed.get(button.id);
// if (entry != null) { if (entry != null) {
// this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
// } }
// } }
// } }
// /*else if(button == this.achievementButton){ /*else if(button == this.achievementButton){
// GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter()); GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter());
// this.getMinecraft().displayGuiScreen(achievements); this.getMinecraft().displayGuiScreen(achievements);
// }*/ }*/
// /* /*
// else if (button == this.configButton) { else if (button == this.configButton) {
// GuiScreen config = new GuiConfiguration(this); GuiScreen config = new GuiConfiguration(this);
// this.getMinecraft().setScreen(config); this.getMinecraft().setScreen(config);
// } else if (this.showTutorial && button == this.tutorialButton) { } else if (this.showTutorial && button == this.tutorialButton) {
// if (this.hasBookmarkButtons()) { if (this.hasBookmarkButtons()) {
// if (!isShiftKeyDown()) { if (!isShiftKeyDown()) {
// for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) { for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) {
// this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0]; this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0];
// } }
// } }
// this.showTutorial = false; this.showTutorial = false;
// this.tutorialButton.visible = false; this.tutorialButton.visible = false;
//
// this.configButton.visible = true; this.configButton.visible = true;
// //this.achievementButton.visible = true; //this.achievementButton.visible = true;
//
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
// data.didBookTutorial = true; data.didBookTutorial = true;
// PacketHandlerHelper.sendPlayerDataToServer(false, 1); PacketHandlerHelper.sendPlayerDataToServer(false, 1);
// } }
// } else { } else {
// super.actionPerformed(button); super.actionPerformed(button);
// } }
// } }
// */ */
// @Override @Override
// public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(stack, mouseX, mouseY, partialTicks); super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
// String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName); String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName);
// this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19, 0); this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19, 0);
// strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2"); strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2");
// this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19 + this.font.lineHeight, 0); this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19 + this.font.lineHeight, 0);
//
// strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition; strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition;
// this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 40, 0); this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 40, 0);
//
// if (this.showTutorial) { 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."; 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); 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) { } else if (this.quote != null && !this.quote.isEmpty() && this.quoteGuy != null) {
// int quoteSize = this.quote.size(); int quoteSize = this.quote.size();
//
// for (int i = 0; i < quoteSize; i++) { 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(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()); this.renderScaledAsciiString("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize());
// } }
// } }
//
// @Override @Override
// public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
//
// } }
//} }

View file

@ -1,289 +1,289 @@
///* /*
// * This file ("GuiPage.java") is part of the Actually Additions mod for Minecraft. * This file ("GuiPage.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui; package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
//import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
//import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay; import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.awt.*; import java.awt.*;
//import java.io.IOException; import java.io.IOException;
//import java.net.URI; import java.net.URI;
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.Collections; import java.util.Collections;
//import java.util.List; import java.util.List;
//
//@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
//public class GuiPage extends GuiBooklet { public class GuiPage extends GuiBooklet {
//
// public final IBookletPage[] pages = new IBookletPage[2]; public final IBookletPage[] pages = new IBookletPage[2];
// private final List<ItemDisplay> itemDisplays = new ArrayList<>(); private final List<ItemDisplay> itemDisplays = new ArrayList<>();
// private int pageTimer; private int pageTimer;
//
// private Button buttonViewOnline; private Button buttonViewOnline;
//
// public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) { public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) {
// super(previousScreen, parentPage); super(previousScreen, parentPage);
//
// this.pages[0] = page1; this.pages[0] = page1;
// this.pages[1] = page2; this.pages[1] = page2;
// } }
//
// @Override @Override
// public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// super.mouseClicked(mouseX, mouseY, mouseButton); super.mouseClicked(mouseX, mouseY, mouseButton);
//
// for (ItemDisplay display : this.itemDisplays) { for (ItemDisplay display : this.itemDisplays) {
// display.onMousePress(mouseButton, mouseX, mouseY); display.onMousePress(mouseButton, mouseX, mouseY);
// } }
//
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// if (page != null) { if (page != null) {
// page.mouseClicked(this, mouseX, mouseY, mouseButton); page.mouseClicked(this, mouseX, mouseY, mouseButton);
// } }
// } }
// } }
//
// @Override @Override
// public void mouseReleased(int mouseX, int mouseY, int state) { public void mouseReleased(int mouseX, int mouseY, int state) {
// super.mouseReleased(mouseX, mouseY, state); super.mouseReleased(mouseX, mouseY, state);
//
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// if (page != null) { if (page != null) {
// page.mouseReleased(this, mouseX, mouseY, state); page.mouseReleased(this, mouseX, mouseY, state);
// } }
// } }
// } }
//
// @Override @Override
// public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
// super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
//
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// if (page != null) { if (page != null) {
// page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick); page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
// } }
// } }
// } }
///* /*
// @Override @Override
// public void actionPerformed(GuiButton button) throws IOException { public void actionPerformed(GuiButton button) throws IOException {
// if (button == this.buttonViewOnline) { if (button == this.buttonViewOnline) {
// List<String> links = this.getWebLinks(); List<String> links = this.getWebLinks();
// if (Desktop.isDesktopSupported()) { if (Desktop.isDesktopSupported()) {
// for (String link : links) { for (String link : links) {
// try { try {
// Desktop.getDesktop().browse(new URI(link)); Desktop.getDesktop().browse(new URI(link));
// } catch (Exception e) { } catch (Exception e) {
// ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e); ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e);
// } }
// } }
// } }
// } else { } else {
// super.actionPerformed(button); super.actionPerformed(button);
//
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// if (page != null) { if (page != null) {
// page.actionPerformed(this, button); page.actionPerformed(this, button);
// } }
// } }
// } }
// } }
// */ */
// @Override @Override
// public void init() { public void init() {
// this.itemDisplays.clear(); this.itemDisplays.clear();
// super.init(); super.init();
//
// List<String> links = this.getWebLinks(); List<String> links = this.getWebLinks();
// if (links != null && !links.isEmpty()) { if (links != null && !links.isEmpty()) {
// this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, 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")), btn -> { this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, 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")), btn -> {
// }); });
// this.addButton(this.buttonViewOnline); this.addButton(this.buttonViewOnline);
// } }
//
// for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i]; IBookletPage page = this.pages[i];
// if (page != null) { if (page != null) {
// page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7); page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7);
// } }
// } }
// } }
//
// private List<String> getWebLinks() { private List<String> getWebLinks() {
// List<String> links = new ArrayList<>(); List<String> links = new ArrayList<>();
//
// for (IBookletPage page : this.pages) { for (IBookletPage page : this.pages) {
// if (page != null) { if (page != null) {
// String link = page.getWebLink(); String link = page.getWebLink();
// if (link != null && !links.contains(link)) { if (link != null && !links.contains(link)) {
// links.add(link); links.add(link);
// } }
// } }
// } }
//
// return links; return links;
// } }
//
// @Override @Override
// public void tick() { public void tick() {
// super.tick(); super.tick();
//
// for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i]; IBookletPage page = this.pages[i];
// if (page != null) { if (page != null) {
// page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer); page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer);
// } }
// } }
//
// this.pageTimer++; this.pageTimer++;
// } }
//
// @Override @Override
// public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(stack, mouseX, mouseY, partialTicks); super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
// if (this.pages[0] != null) { if (this.pages[0] != null) {
// IBookletChapter chapter = this.pages[0].getChapter(); IBookletChapter chapter = this.pages[0].getChapter();
// String name = chapter.getLocalizedName(); String name = chapter.getLocalizedName();
// this.font.draw(stack, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF); this.font.draw(stack, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF);
// } }
//
// for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i]; IBookletPage page = this.pages[i];
// if (page != null) { if (page != null) {
// IBookletChapter chapter = this.pages[i].getChapter(); IBookletChapter chapter = this.pages[i].getChapter();
// String pageStrg = "Page " + (chapter.getPageIndex(this.pages[i]) + 1) + "/" + chapter.getAllPages().length; 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()); this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
//
// RenderSystem.color3f(1f, 1f, 1f); RenderSystem.color3f(1f, 1f, 1f);
// page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
// } }
// } }
// for (ItemDisplay display : this.itemDisplays) { for (ItemDisplay display : this.itemDisplays) {
// display.drawPre(); display.drawPre();
// } }
// } }
//
// @Override @Override
// public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPost(stack, mouseX, mouseY, partialTicks); super.drawScreenPost(stack, mouseX, mouseY, partialTicks);
//
// for (int i = 0; i < this.pages.length; i++) { for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i]; IBookletPage page = this.pages[i];
// if (page != null) { if (page != null) {
// RenderSystem.color3f(1F, 1F, 1F); RenderSystem.color3f(1F, 1F, 1F);
// page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
// } }
// } }
// for (ItemDisplay display : this.itemDisplays) { for (ItemDisplay display : this.itemDisplays) {
// display.drawPost(mouseX, mouseY); display.drawPost(mouseX, mouseY);
// } }
// } }
//
// @Override @Override
// public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
// for (ItemDisplay display : this.itemDisplays) { for (ItemDisplay display : this.itemDisplays) {
// if (display.x == x && display.y == y && display.scale == scale) { if (display.x == x && display.y == y && display.scale == scale) {
// display.stack = renderedStack; display.stack = renderedStack;
// return; return;
// } }
// } }
//
// this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer)); this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer));
// } }
//
// @Override @Override
// public boolean hasPageLeftButton() { public boolean hasPageLeftButton() {
// IBookletPage page = this.pages[0]; IBookletPage page = this.pages[0];
// if (page != null) { if (page != null) {
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
// if (chapter != null) { if (chapter != null) {
// return chapter.getPageIndex(page) > 0; return chapter.getPageIndex(page) > 0;
// } }
// } }
// return false; return false;
// } }
//
// @Override @Override
// public void onPageLeftButtonPressed() { public void onPageLeftButtonPressed() {
// IBookletPage page = this.pages[0]; IBookletPage page = this.pages[0];
// if (page != null) { if (page != null) {
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
// if (chapter != null) { if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages(); IBookletPage[] pages = chapter.getAllPages();
//
// int pageNumToOpen = chapter.getPageIndex(page) - 1; int pageNumToOpen = chapter.getPageIndex(page) - 1;
// if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) { if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen])); this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
// } }
// } }
// } }
// } }
//
// @Override @Override
// public boolean hasPageRightButton() { public boolean hasPageRightButton() {
// IBookletPage page = this.pages[1]; IBookletPage page = this.pages[1];
// if (page != null) { if (page != null) {
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
// if (chapter != null) { if (chapter != null) {
// int pageIndex = chapter.getPageIndex(page); int pageIndex = chapter.getPageIndex(page);
// int pageAmount = chapter.getAllPages().length; int pageAmount = chapter.getAllPages().length;
// return pageIndex + 1 < pageAmount; return pageIndex + 1 < pageAmount;
// } }
// } }
// return false; return false;
// } }
//
// @Override @Override
// public void onPageRightButtonPressed() { public void onPageRightButtonPressed() {
// IBookletPage page = this.pages[1]; IBookletPage page = this.pages[1];
// if (page != null) { if (page != null) {
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
// if (chapter != null) { if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages(); IBookletPage[] pages = chapter.getAllPages();
//
// int pageNumToOpen = chapter.getPageIndex(page) + 1; int pageNumToOpen = chapter.getPageIndex(page) + 1;
// if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) { if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen])); this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
// } }
// } }
// } }
// } }
//
// @Override @Override
// public boolean hasBackButton() { public boolean hasBackButton() {
// return true; return true;
// } }
//
// @Override @Override
// public void onBackButtonPressed() { public void onBackButtonPressed() {
// if (!hasShiftDown()) { if (!hasShiftDown()) {
// this.minecraft.setScreen(this.parentPage); this.minecraft.setScreen(this.parentPage);
// } else { } else {
// super.onBackButtonPressed(); super.onBackButtonPressed();
// } }
// } }
//} }

View file

@ -1,92 +1,92 @@
///* /*
// * This file ("BookletUtils.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletUtils.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.misc; package de.ellpeck.actuallyadditions.mod.booklet.misc;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiEntry; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiEntry;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
//import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
//import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.util.List; import java.util.List;
//
//public final class BookletUtils { public final class BookletUtils {
//
// public static IBookletPage findFirstPageForStack(ItemStack stack) { public static IBookletPage findFirstPageForStack(ItemStack stack) {
// for (IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA) { for (IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA) {
// List<ItemStack> stacks = NonNullList.create(); List<ItemStack> stacks = NonNullList.create();
// page.getItemStacksForPage(stacks); page.getItemStacksForPage(stacks);
// if (stacks != null && !stacks.isEmpty()) { if (stacks != null && !stacks.isEmpty()) {
// for (ItemStack pageStack : stacks) { for (ItemStack pageStack : stacks) {
// if (ItemUtil.areItemsEqual(pageStack, stack, true)) { if (ItemUtil.areItemsEqual(pageStack, stack, true)) {
// return page; return page;
// } }
// } }
// } }
// } }
// return null; return null;
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) { public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) {
// GuiMainPage mainPage = new GuiMainPage(previousScreen); GuiMainPage mainPage = new GuiMainPage(previousScreen);
//
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
// GuiEntry entry = new GuiEntry(previousScreen, mainPage, chapter.getEntry(), chapter, "", false); GuiEntry entry = new GuiEntry(previousScreen, mainPage, chapter.getEntry(), chapter, "", false);
//
// return createPageGui(previousScreen, entry, page); return createPageGui(previousScreen, entry, page);
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) { public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
// IBookletChapter chapter = page.getChapter(); IBookletChapter chapter = page.getChapter();
//
// IBookletPage[] allPages = chapter.getAllPages(); IBookletPage[] allPages = chapter.getAllPages();
// int pageIndex = chapter.getPageIndex(page); int pageIndex = chapter.getPageIndex(page);
// IBookletPage page1; IBookletPage page1;
// IBookletPage page2; IBookletPage page2;
//
// if (page.shouldBeOnLeftSide()) { if (page.shouldBeOnLeftSide()) {
// page1 = page; page1 = page;
// page2 = pageIndex >= allPages.length - 1 page2 = pageIndex >= allPages.length - 1
// ? null ? null
// : allPages[pageIndex + 1]; : allPages[pageIndex + 1];
// } else { } else {
// page1 = pageIndex <= 0 page1 = pageIndex <= 0
// ? null ? null
// : allPages[pageIndex - 1]; : allPages[pageIndex - 1];
// page2 = page; page2 = page;
// } }
//
// return new GuiPage(previousScreen, parentPage, page1, page2); return new GuiPage(previousScreen, parentPage, page1, page2);
// } }
//
// public static IBookletPage getBookletPageById(String id) { public static IBookletPage getBookletPageById(String id) {
// if (id != null) { if (id != null) {
// for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) { for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) {
// for (IBookletPage page : chapter.getAllPages()) { for (IBookletPage page : chapter.getAllPages()) {
// if (id.equals(page.getIdentifier())) { if (id.equals(page.getIdentifier())) {
// return page; return page;
// } }
// } }
// } }
// } }
// return null; return null;
// } }
//} }

View file

@ -1,199 +1,199 @@
///* /*
// * This file ("BookletPage.java") is part of the Actually Additions mod for Minecraft. * This file ("BookletPage.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.block.Block; import net.minecraft.block.Block;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
//
//import java.util.*; import java.util.*;
//
//public class BookletPage implements IBookletPage { public class BookletPage implements IBookletPage {
//
// protected final HashMap<String, String> textReplacements = new HashMap<>(); protected final HashMap<String, String> textReplacements = new HashMap<>();
// protected final int localizationKey; protected final int localizationKey;
// private final int priority; private final int priority;
// private final List<ItemStack> itemsForPage = new ArrayList<>(); private final List<ItemStack> itemsForPage = new ArrayList<>();
// private final List<FluidStack> fluidsForPage = new ArrayList<>(); private final List<FluidStack> fluidsForPage = new ArrayList<>();
// protected IBookletChapter chapter; protected IBookletChapter chapter;
// protected boolean hasNoText; protected boolean hasNoText;
//
// public BookletPage(int localizationKey) { public BookletPage(int localizationKey) {
// this(localizationKey, 0); this(localizationKey, 0);
// } }
//
// public BookletPage(int localizationKey, int priority) { public BookletPage(int localizationKey, int priority) {
// this.localizationKey = localizationKey; this.localizationKey = localizationKey;
// this.priority = priority; this.priority = priority;
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// list.addAll(this.itemsForPage); list.addAll(this.itemsForPage);
// } }
//
// @Override @Override
// public void getFluidStacksForPage(List<FluidStack> list) { public void getFluidStacksForPage(List<FluidStack> list) {
// list.addAll(this.fluidsForPage); list.addAll(this.fluidsForPage);
// } }
//
// @Override @Override
// public IBookletChapter getChapter() { public IBookletChapter getChapter() {
// return this.chapter; return this.chapter;
// } }
//
// @Override @Override
// public void setChapter(IBookletChapter chapter) { public void setChapter(IBookletChapter chapter) {
// this.chapter = chapter; this.chapter = chapter;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public String getInfoText() { public String getInfoText() {
// if (this.hasNoText) { if (this.hasNoText) {
// return null; return null;
// } }
//
// String base = StringUtil.localize(this.getLocalizationKey()); String base = StringUtil.localize(this.getLocalizationKey());
// base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + ""); base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + "");
// base = base.replaceAll("<item>", TextFormatting.BLUE + ""); base = base.replaceAll("<item>", TextFormatting.BLUE + "");
// base = base.replaceAll("<r>", TextFormatting.BLACK + ""); base = base.replaceAll("<r>", TextFormatting.BLACK + "");
// base = base.replaceAll("<n>", "\n"); base = base.replaceAll("<n>", "\n");
// base = base.replaceAll("<i>", TextFormatting.ITALIC + ""); base = base.replaceAll("<i>", TextFormatting.ITALIC + "");
// base = base.replaceAll("<tifisgrin>", TextFormatting.DARK_RED + "" + TextFormatting.UNDERLINE); //This is fucking important so go read it now 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()) { for (Map.Entry<String, String> entry : this.textReplacements.entrySet()) {
// base = base.replaceAll(entry.getKey(), entry.getValue()); base = base.replaceAll(entry.getKey(), entry.getValue());
// } }
// return base; return base;
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// protected String getLocalizationKey() { protected String getLocalizationKey() {
// return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey; return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) { public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) { public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void actionPerformed(GuiBookletBase gui, Button button) { public void actionPerformed(GuiBookletBase gui, Button button) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
// } }
//
// @Override @Override
// public boolean shouldBeOnLeftSide() { public boolean shouldBeOnLeftSide() {
// return (this.chapter.getPageIndex(this) + 1) % 2 != 0; return (this.chapter.getPageIndex(this) + 1) % 2 != 0;
// } }
//
// @Override @Override
// public String getIdentifier() { public String getIdentifier() {
// return this.chapter.getIdentifier() + "." + this.chapter.getPageIndex(this); return this.chapter.getIdentifier() + "." + this.chapter.getPageIndex(this);
// } }
//
// @Override @Override
// public String getWebLink() { public String getWebLink() {
// return "http://ellpeck.de/actaddmanual#" + this.chapter.getIdentifier(); return "http://ellpeck.de/actaddmanual#" + this.chapter.getIdentifier();
// } }
//
// public BookletPage setNoText() { public BookletPage setNoText() {
// this.hasNoText = true; this.hasNoText = true;
// return this; return this;
// } }
//
// public BookletPage addFluidToPage(Fluid fluid) { public BookletPage addFluidToPage(Fluid fluid) {
// this.fluidsForPage.add(new FluidStack(fluid, 1)); this.fluidsForPage.add(new FluidStack(fluid, 1));
// return this; return this;
// } }
//
// public BookletPage addItemsToPage(Block... blocks) { public BookletPage addItemsToPage(Block... blocks) {
// for (Block block : blocks) { for (Block block : blocks) {
// this.addItemsToPage(new ItemStack(block)); this.addItemsToPage(new ItemStack(block));
// } }
// return this; return this;
// } }
//
// public BookletPage addItemsToPage(ItemStack... stacks) { public BookletPage addItemsToPage(ItemStack... stacks) {
// Collections.addAll(this.itemsForPage, stacks); Collections.addAll(this.itemsForPage, stacks);
// return this; return this;
// } }
//
// @Override @Override
// public BookletPage addTextReplacement(String key, String value) { public BookletPage addTextReplacement(String key, String value) {
// this.textReplacements.put(key, value); this.textReplacements.put(key, value);
// return this; return this;
// } }
//
// @Override @Override
// public BookletPage addTextReplacement(String key, float value) { public BookletPage addTextReplacement(String key, float value) {
// return this.addTextReplacement(key, Float.toString(value)); return this.addTextReplacement(key, Float.toString(value));
// } }
//
// @Override @Override
// public BookletPage addTextReplacement(String key, int value) { public BookletPage addTextReplacement(String key, int value) {
// return this.addTextReplacement(key, Integer.toString(value)); return this.addTextReplacement(key, Integer.toString(value));
// } }
//
// @Override @Override
// public int getSortingPriority() { public int getSortingPriority() {
// return this.priority; return this.priority;
// } }
//} }

View file

@ -1,99 +1,99 @@
///* /*
// * This file ("ItemDisplay.java") is part of the Actually Additions mod for Minecraft. * This file ("ItemDisplay.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.client.util.ITooltipFlag.TooltipFlags; import net.minecraft.client.util.ITooltipFlag.TooltipFlags;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.SoundEvents; import net.minecraft.util.SoundEvents;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//
//public class ItemDisplay { public class ItemDisplay {
//
// public final int x; public final int x;
// public final int y; public final int y;
// public final float scale; public final float scale;
// private final GuiPage gui; private final GuiPage gui;
// private final IBookletPage page; private final IBookletPage page;
// public ItemStack stack; public ItemStack stack;
//
// public ItemDisplay(GuiPage gui, int x, int y, float scale, ItemStack stack, boolean shouldTryTransfer) { public ItemDisplay(GuiPage gui, int x, int y, float scale, ItemStack stack, boolean shouldTryTransfer) {
// this.gui = gui; this.gui = gui;
// this.x = x; this.x = x;
// this.y = y; this.y = y;
// this.scale = scale; this.scale = scale;
// this.stack = stack; this.stack = stack;
// this.page = shouldTryTransfer this.page = shouldTryTransfer
// ? BookletUtils.findFirstPageForStack(stack) ? BookletUtils.findFirstPageForStack(stack)
// : null; : null;
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawPre() { public void drawPre() {
// AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale); AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale);
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawPost(int mouseX, int mouseY) { public void drawPost(int mouseX, int mouseY) {
// if (this.isHovered(mouseX, mouseY)) { if (this.isHovered(mouseX, mouseY)) {
// Minecraft mc = this.gui.mc; Minecraft mc = this.gui.mc;
// boolean flagBefore = mc.font.getUnicodeFlag(); boolean flagBefore = mc.font.getUnicodeFlag();
// mc.font.setUnicodeFlag(false); mc.font.setUnicodeFlag(false);
//
// List<String> list = this.stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips List<String> list = this.stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
// ? TooltipFlags.ADVANCED ? TooltipFlags.ADVANCED
// : TooltipFlags.NORMAL); : TooltipFlags.NORMAL);
//
// for (int k = 0; k < list.size(); ++k) { for (int k = 0; k < list.size(); ++k) {
// if (k == 0) { if (k == 0) {
// list.set(k, this.stack.getItem().getForgeRarity(this.stack).getColor() + list.get(k)); list.set(k, this.stack.getItem().getForgeRarity(this.stack).getColor() + list.get(k));
// } else { } else {
// list.set(k, TextFormatting.GRAY + list.get(k)); list.set(k, TextFormatting.GRAY + list.get(k));
// } }
// } }
//
// if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) { 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")); list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".clickToSeeRecipe"));
// } }
//
// GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
//
// mc.font.setUnicodeFlag(flagBefore); mc.font.setUnicodeFlag(flagBefore);
// } }
// } }
//
// public void onMousePress(int button, int mouseX, int mouseY) { public void onMousePress(int button, int mouseX, int mouseY) {
// if (button == 0 && this.isHovered(mouseX, mouseY)) { if (button == 0 && this.isHovered(mouseX, mouseY)) {
// if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) { 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)); this.gui.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
//
// GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page); GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page);
// this.gui.mc.displayGuiScreen(gui); this.gui.mc.displayGuiScreen(gui);
// } }
// } }
// } }
//
// public boolean isHovered(int mouseX, int mouseY) { 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; return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 16 * this.scale && mouseY < this.y + 16 * this.scale;
// } }
//} }

View file

@ -1,78 +1,78 @@
///* /*
// * This file ("PageCoffeeMachine.java") is part of the Actually Additions mod for Minecraft. * This file ("PageCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//
//public class PageCoffeeMachine extends BookletPage { public class PageCoffeeMachine extends BookletPage {
//
// private final CoffeeIngredient ingredient; private final CoffeeIngredient ingredient;
// private final ItemStack outcome; private final ItemStack outcome;
// private int counter = 0; private int counter = 0;
// private int rotate = 0; private int rotate = 0;
// private final ItemStack[] stacks; private final ItemStack[] stacks;
//
// public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) { public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) {
// super(localizationKey); super(localizationKey);
// this.ingredient = ingredient; this.ingredient = ingredient;
// this.stacks = ingredient.getInput().getItems(); this.stacks = ingredient.getInput().getItems();
//
// this.outcome = new ItemStack(ActuallyItems.COFFEE.get()); this.outcome = new ItemStack(ActuallyItems.COFFEE.get());
// ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient); ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0); 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.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); gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX + 5, startY + 51, 0, false, gui.getSmallFontSize(), 35);
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90);
//
// if (this.counter++ % 50 == 0) { if (this.counter++ % 50 == 0) {
// gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true); gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true);
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// gui.addOrModifyItemRenderer(this.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true); 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(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false);
//
// gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE_CUP.get()), startX + 5 + 37, startY + 10 + 1, 1F, true); gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE_CUP.get()), startX + 5 + 37, startY + 10 + 1, 1F, true);
// gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE.get()), startX + 5 + 1, startY + 10 + 1, 1F, true); gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE.get()), startX + 5 + 1, startY + 10 + 1, 1F, true);
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// list.add(this.outcome); list.add(this.outcome);
// } }
//} }

View file

@ -1,194 +1,194 @@
///* /*
// * This file ("PageCrafting.java") is part of the Actually Additions mod for Minecraft. * This file ("PageCrafting.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.util.RefHelp; import de.ellpeck.actuallyadditions.mod.util.RefHelp;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
//import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.Arrays; import java.util.Arrays;
//import java.util.List; import java.util.List;
//
//public class PageCrafting extends BookletPage { public class PageCrafting extends BookletPage {
//
// private final List<IRecipe> recipes; private final List<IRecipe> recipes;
// private int recipeAt; private int recipeAt;
// private String recipeTypeLocKey; private String recipeTypeLocKey;
// private boolean isWildcard; private boolean isWildcard;
//
// public PageCrafting(int localizationKey, int priority, List<IRecipe> recipes) { public PageCrafting(int localizationKey, int priority, List<IRecipe> recipes) {
// super(localizationKey, priority); super(localizationKey, priority);
// this.recipes = recipes; this.recipes = recipes;
// } }
//
// public PageCrafting(int localizationKey, List<IRecipe> recipes) { public PageCrafting(int localizationKey, List<IRecipe> recipes) {
// this(localizationKey, 0, recipes); this(localizationKey, 0, recipes);
// } }
//
// public PageCrafting(int localizationKey, IRecipe... recipes) { public PageCrafting(int localizationKey, IRecipe... recipes) {
// this(localizationKey, 0, recipes); this(localizationKey, 0, recipes);
// } }
//
// public PageCrafting(int localizationKey, int priority, IRecipe... recipes) { public PageCrafting(int localizationKey, int priority, IRecipe... recipes) {
// this(localizationKey, priority, Arrays.asList(recipes)); this(localizationKey, priority, Arrays.asList(recipes));
// } }
//
// public BookletPage setWildcard() { public BookletPage setWildcard() {
// this.isWildcard = true; this.isWildcard = true;
// return this; return this;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0); GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0);
//
// if (this.recipeTypeLocKey != null) { if (this.recipeTypeLocKey != null) {
// gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize()); gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize());
// } }
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
// super.updateScreen(gui, startX, startY, pageTimer); super.updateScreen(gui, startX, startY, pageTimer);
//
// if (pageTimer % 20 == 0) { if (pageTimer % 20 == 0) {
// this.findRecipe(gui, startX, startY); this.findRecipe(gui, startX, startY);
// } }
// } }
//
// private void findRecipe(GuiBookletBase gui, int startX, int startY) { private void findRecipe(GuiBookletBase gui, int startX, int startY) {
// if (!this.recipes.isEmpty()) { if (!this.recipes.isEmpty()) {
// IRecipe recipe = this.recipes.get(this.recipeAt); IRecipe recipe = this.recipes.get(this.recipeAt);
// if (recipe != null) { if (recipe != null) {
// this.setupRecipe(gui, recipe, startX, startY); this.setupRecipe(gui, recipe, startX, startY);
// } }
//
// this.recipeAt++; this.recipeAt++;
// if (this.recipeAt >= this.recipes.size()) { if (this.recipeAt >= this.recipes.size()) {
// this.recipeAt = 0; this.recipeAt = 0;
// } }
// } }
// } }
//
// @Override @Override
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
// this.findRecipe(gui, startX, startY); this.findRecipe(gui, startX, startY);
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// if (!this.recipes.isEmpty()) { if (!this.recipes.isEmpty()) {
// for (IRecipe recipe : this.recipes) { for (IRecipe recipe : this.recipes) {
// if (recipe != null) { if (recipe != null) {
// ItemStack output = recipe.getResultItem(); ItemStack output = recipe.getResultItem();
// if (StackUtil.isValid(output)) { if (StackUtil.isValid(output)) {
// ItemStack copy = output.copy(); ItemStack copy = output.copy();
// /* /*
// if (this.isWildcard) { if (this.isWildcard) {
// copy.setItemDamage(Util.WILDCARD); copy.setItemDamage(Util.WILDCARD);
// } }
//
// */ */
// list.add(copy); list.add(copy);
// } }
// } }
// } }
// } }
// } }
//
// private void setupRecipe(GuiBookletBase gui, IRecipe recipe, int startX, int startY) { private void setupRecipe(GuiBookletBase gui, IRecipe recipe, int startX, int startY) {
// Ingredient[] ings = new Ingredient[9]; Ingredient[] ings = new Ingredient[9];
// int width = 3; int width = 3;
// int height = 3; int height = 3;
///* /*
// if (recipe instanceof BlankRecipe) { if (recipe instanceof BlankRecipe) {
// this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled"; this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled";
// gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false);
// return; return;
// } else if (recipe instanceof ShapedRecipes) { } else if (recipe instanceof ShapedRecipes) {
// ShapedRecipes shaped = (ShapedRecipes) recipe; ShapedRecipes shaped = (ShapedRecipes) recipe;
// width = shaped.recipeWidth; width = shaped.recipeWidth;
// height = shaped.recipeHeight; height = shaped.recipeHeight;
// ings = shaped.recipeItems.toArray(new Ingredient[shaped.recipeItems.size()]); ings = shaped.recipeItems.toArray(new Ingredient[shaped.recipeItems.size()]);
// this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedRecipe"; this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedRecipe";
// } else if (recipe instanceof ShapelessRecipes) { } else if (recipe instanceof ShapelessRecipes) {
// ShapelessRecipes shapeless = (ShapelessRecipes) recipe; ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
// for (int i = 0; i < shapeless.recipeItems.size(); i++) { for (int i = 0; i < shapeless.recipeItems.size(); i++) {
// ings[i] = shapeless.recipeItems.get(i); ings[i] = shapeless.recipeItems.get(i);
// } }
// this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessRecipe"; this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessRecipe";
// } else if (recipe instanceof ShapedOreRecipe) { } else if (recipe instanceof ShapedOreRecipe) {
// ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
// try { try {
// width = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 4); width = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
// height = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 5); height = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
// } catch (Exception e) { } catch (Exception e) {
// ActuallyAdditions.LOGGER.error("Something went wrong trying to get the Crafting Recipe in the booklet to display!", 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++) { for (int i = 0; i < shaped.getIngredients().size(); i++) {
// ings[i] = shaped.getIngredients().get(i); ings[i] = shaped.getIngredients().get(i);
// } }
// this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedOreRecipe"; this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedOreRecipe";
// } else if (recipe instanceof ShapelessOreRecipe) { } else if (recipe instanceof ShapelessOreRecipe) {
// ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
// for (int i = 0; i < shapeless.getIngredients().size(); i++) { for (int i = 0; i < shapeless.getIngredients().size(); i++) {
// ings[i] = shapeless.getIngredients().get(i); ings[i] = shapeless.getIngredients().get(i);
// } }
// this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe"; this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe";
// } }
//
//
// */ */
// for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
// for (int y = 0; y < height; y++) { for (int y = 0; y < height; y++) {
// Ingredient ing = ings[y * width + x]; Ingredient ing = ings[y * width + x];
// if (ing != null) { if (ing != null) {
// ItemStack[] stacks = ing.getItems(); ItemStack[] stacks = ing.getItems();
// if (stacks != null && stacks.length > 0) { if (stacks != null && stacks.length > 0) {
// ItemStack stack = stacks[0]; ItemStack stack = stacks[0];
// if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
// ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
// copy.setCount(1); copy.setCount(1);
// /* /*
// if (copy.getItemDamage() == Util.WILDCARD) { if (copy.getItemDamage() == Util.WILDCARD) {
// copy.setItemDamage(0); copy.setItemDamage(0);
// } }
// */ */
// gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true); gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true);
// } }
// } }
// } }
// } }
// } }
//
// gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false);
// } }
//} }

View file

@ -1,83 +1,83 @@
///* /*
// * This file ("PageCrusherRecipe.java") is part of the Actually Additions mod for Minecraft. * This file ("PageCrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//
//public class PageCrusherRecipe extends BookletPage { public class PageCrusherRecipe extends BookletPage {
//
// private final CrushingRecipe recipe; private final CrushingRecipe recipe;
// private int counter = 0; private int counter = 0;
// private int rotate = 0; private int rotate = 0;
// private final ItemStack[] stacks; private final ItemStack[] stacks;
//
// public PageCrusherRecipe(int localizationKey, CrushingRecipe recipe) { public PageCrusherRecipe(int localizationKey, CrushingRecipe recipe) {
// super(localizationKey); super(localizationKey);
// this.recipe = recipe; this.recipe = recipe;
// this.stacks = recipe.getInput().getItems(); this.stacks = recipe.getInput().getItems();
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0); 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()); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize());
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
//
// if (this.counter++ % 50 == 0) { if (this.counter++ % 50 == 0) {
// gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true);
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// if (this.recipe != null) { if (this.recipe != null) {
// gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); 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); gui.addOrModifyItemRenderer(this.recipe.getOutputOne(), startX + 38 + 4, startY + 6 + 53, 1F, false);
//
// if (StackUtil.isValid(this.recipe.getOutputTwo())) { if (StackUtil.isValid(this.recipe.getOutputTwo())) {
// gui.addOrModifyItemRenderer(this.recipe.getOutputTwo(), startX + 38 + 30, startY + 6 + 53, 1F, false); gui.addOrModifyItemRenderer(this.recipe.getOutputTwo(), startX + 38 + 30, startY + 6 + 53, 1F, false);
// } }
// } }
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// if (this.recipe != null) { if (this.recipe != null) {
// list.add(this.recipe.getOutputOne()); list.add(this.recipe.getOutputOne());
//
// if (StackUtil.isValid(this.recipe.getOutputTwo())) { if (StackUtil.isValid(this.recipe.getOutputTwo())) {
// list.add(this.recipe.getOutputTwo()); list.add(this.recipe.getOutputTwo());
// } }
// } }
// } }
//} }

View file

@ -1,105 +1,105 @@
///* /*
// * This file ("PageEmpowerer.java") is part of the Actually Additions mod for Minecraft. * This file ("PageEmpowerer.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//
//public class PageEmpowerer extends BookletPage { public class PageEmpowerer extends BookletPage {
//
// private final EmpowererRecipe recipe; private final EmpowererRecipe recipe;
// private int counter = 0; private int counter = 0;
// private int rotate = 0; private int rotate = 0;
// ItemStack[] inputs; ItemStack[] inputs;
// ItemStack[] stand1; ItemStack[] stand1;
// ItemStack[] stand2; ItemStack[] stand2;
// ItemStack[] stand3; ItemStack[] stand3;
// ItemStack[] stand4; ItemStack[] stand4;
//
// public PageEmpowerer(int localizationKey, EmpowererRecipe recipe) { public PageEmpowerer(int localizationKey, EmpowererRecipe recipe) {
// super(localizationKey); super(localizationKey);
// this.recipe = recipe; this.recipe = recipe;
// if (recipe != null) { if (recipe != null) {
// this.inputs = recipe.getInput().getItems(); this.inputs = recipe.getInput().getItems();
// this.stand1 = recipe.getStandOne().getItems(); this.stand1 = recipe.getStandOne().getItems();
// this.stand2 = recipe.getStandTwo().getItems(); this.stand2 = recipe.getStandTwo().getItems();
// this.stand3 = recipe.getStandThree().getItems(); this.stand3 = recipe.getStandThree().getItems();
// this.stand4 = recipe.getStandFour().getItems(); this.stand4 = recipe.getStandFour().getItems();
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0); 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()); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize());
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
// if (this.recipe != null) { if (this.recipe != null) {
// this.updateInputs(gui, startX, startY); this.updateInputs(gui, startX, startY);
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// if (this.recipe != null) { if (this.recipe != null) {
// gui.addOrModifyItemRenderer(this.stand1[0], startX + 5 + 26, startY + 10 + 1, 1F, true); 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.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.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.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.inputs[0], startX + 5 + 26, startY + 10 + 26, 1F, true);
// gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 5 + 96, startY + 10 + 26, 1F, false); gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 5 + 96, startY + 10 + 26, 1F, false);
// } }
// } }
//
// private void updateInputs(GuiBookletBase gui, int startX, int startY) { private void updateInputs(GuiBookletBase gui, int startX, int startY) {
// if (this.counter++ % 50 == 0) { if (this.counter++ % 50 == 0) {
// this.rotate++; this.rotate++;
// gui.addOrModifyItemRenderer(this.stand1[this.rotate % this.stand1.length], startX + 5 + 26, startY + 10 + 1, 1F, true); 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.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.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.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); gui.addOrModifyItemRenderer(this.inputs[this.rotate % this.inputs.length], startX + 5 + 26, startY + 10 + 26, 1F, true);
// } }
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// if (this.recipe != null) { if (this.recipe != null) {
// list.add(this.recipe.getOutput()); list.add(this.recipe.getOutput());
// } }
// } }
//
// @Override @Override
// public int getSortingPriority() { public int getSortingPriority() {
// return 20; return 20;
// } }
//} }

View file

@ -1,82 +1,82 @@
///* /*
// * This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft. * This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.datafix.fixes.FurnaceRecipes; import net.minecraft.util.datafix.fixes.FurnaceRecipes;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//import java.util.Map; import java.util.Map;
//
//public class PageFurnace extends BookletPage { public class PageFurnace extends BookletPage {
//
// private final ItemStack input; private final ItemStack input;
// private final ItemStack output; private final ItemStack output;
//
// public PageFurnace(int localizationKey, ItemStack output) { public PageFurnace(int localizationKey, ItemStack output) {
// this(localizationKey, output, 0); this(localizationKey, output, 0);
// } }
//
// public PageFurnace(int localizationKey, ItemStack output, int priority) { public PageFurnace(int localizationKey, ItemStack output, int priority) {
// super(localizationKey, priority); super(localizationKey, priority);
// this.output = output; this.output = output;
// this.input = getInputForOutput(output); this.input = getInputForOutput(output);
// } }
//
// private static ItemStack getInputForOutput(ItemStack output) { private static ItemStack getInputForOutput(ItemStack output) {
// for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) { for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
// ItemStack stack = entry.getValue(); ItemStack stack = entry.getValue();
// if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
// if (stack.sameItem(output)) { if (stack.sameItem(output)) {
// return entry.getKey(); return entry.getKey();
// } }
// } }
// } }
// return ItemStack.EMPTY; return ItemStack.EMPTY;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0); 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()); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize());
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 57); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 57);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true); gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true);
// gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false); gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false);
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// list.add(this.output); list.add(this.output);
// } }
//} }

View file

@ -1,68 +1,68 @@
///* /*
// * This file ("PageLinkButton.java") is part of the Actually Additions mod for Minecraft. * This file ("PageLinkButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.awt.*; import java.awt.*;
//import java.net.URI; import java.net.URI;
//
//public class PageLinkButton extends BookletPage { public class PageLinkButton extends BookletPage {
//
// public static int nextButtonId = 23782; public static int nextButtonId = 23782;
// private final int buttonId; private final int buttonId;
//
// private final String link; private final String link;
//
// public PageLinkButton(int localizationKey, String link) { public PageLinkButton(int localizationKey, String link) {
// super(localizationKey); super(localizationKey);
// this.link = link; this.link = link;
//
// this.buttonId = nextButtonId; this.buttonId = nextButtonId;
// nextButtonId++; nextButtonId++;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// gui.getButtonList().add(new Button(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey))); gui.getButtonList().add(new Button(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey)));
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void actionPerformed(GuiBookletBase gui, Button button) { public void actionPerformed(GuiBookletBase gui, Button button) {
// if (button.id == this.buttonId) { if (button.id == this.buttonId) {
// if (Desktop.isDesktopSupported()) { if (Desktop.isDesktopSupported()) {
// try { try {
// Desktop.getDesktop().browse(new URI(this.link)); Desktop.getDesktop().browse(new URI(this.link));
// } catch (Exception e) { } catch (Exception e) {
// ActuallyAdditions.LOGGER.error("Couldn't open website from Link Button page!", e); ActuallyAdditions.LOGGER.error("Couldn't open website from Link Button page!", e);
// } }
// } }
// } else { } else {
// super.actionPerformed(gui, button); super.actionPerformed(gui, button);
// } }
// } }
//} }

View file

@ -1,59 +1,59 @@
///* /*
// * This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft. * This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//public class PagePicture extends BookletPage { public class PagePicture extends BookletPage {
//
// private final ResourceLocation resLoc; private final ResourceLocation resLoc;
// private final int yTextOffset; private final int yTextOffset;
//
// public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) { public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
// super(localizationKey, priority); super(localizationKey, priority);
// this.resLoc = resLoc; this.resLoc = resLoc;
// this.yTextOffset = yTextOffset; this.yTextOffset = yTextOffset;
// } }
//
// public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) { public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
// super(localizationKey); super(localizationKey);
// this.yTextOffset = yTextOffset; this.yTextOffset = yTextOffset;
// this.resLoc = resLoc; this.resLoc = resLoc;
// } }
//
// public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) { public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
// this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset); this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(this.resLoc); gui.getMinecraft().getTextureManager().bind(this.resLoc);
//
// RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
// RenderSystem.enableBlend(); RenderSystem.enableBlend();
// RenderSystem.disableAlphaTest(); RenderSystem.disableAlphaTest();
// GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0); GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
// RenderSystem.disableBlend(); RenderSystem.disableBlend();
// RenderSystem.enableAlphaTest(); RenderSystem.enableAlphaTest();
// RenderSystem.popMatrix(); RenderSystem.popMatrix();
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
// } }
//} }

View file

@ -1,93 +1,93 @@
///* /*
// * This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft. * This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List; import java.util.List;
//
//public class PageReconstructor extends BookletPage { public class PageReconstructor extends BookletPage {
//
// private final LensConversionRecipe recipe; private final LensConversionRecipe recipe;
// private boolean isWildcard; private boolean isWildcard;
// private int counter = 0; private int counter = 0;
// private int rotate = 0; private int rotate = 0;
// private ItemStack[] stacks; private ItemStack[] stacks;
//
// public PageReconstructor(int localizationKey, LensConversionRecipe recipe) { public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
// super(localizationKey); super(localizationKey);
// this.recipe = recipe; this.recipe = recipe;
// if (recipe != null) { if (recipe != null) {
// this.stacks = recipe.getInput().getItems(); this.stacks = recipe.getInput().getItems();
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0); 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()); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize());
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
// if (this.recipe != null) { if (this.recipe != null) {
// if (this.counter++ % 50 == 0) { if (this.counter++ % 50 == 0) {
// gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true); gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true);
// } }
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// if (this.recipe != null) { if (this.recipe != null) {
// gui.addOrModifyItemRenderer(this.stacks[0], startX + 30 + 1, startY + 10 + 13, 1F, true); 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); gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 30 + 47, startY + 10 + 13, 1F, false);
// } }
// } }
//
// @Override @Override
// public void getItemStacksForPage(List<ItemStack> list) { public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list); super.getItemStacksForPage(list);
//
// if (this.recipe != null) { if (this.recipe != null) {
// ItemStack copy = this.recipe.getOutput().copy(); ItemStack copy = this.recipe.getOutput().copy();
// if (this.isWildcard) { if (this.isWildcard) {
// copy.setDamageValue(Util.WILDCARD); copy.setDamageValue(Util.WILDCARD);
// } }
// list.add(copy); list.add(copy);
// } }
// } }
//
// public BookletPage setWildcard() { public BookletPage setWildcard() {
// this.isWildcard = true; this.isWildcard = true;
// return this; return this;
// } }
//
// @Override @Override
// public int getSortingPriority() { public int getSortingPriority() {
// return 20; return 20;
// } }
//} }

View file

@ -1,41 +1,41 @@
///* /*
// * This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft. * This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class PageTextOnly extends BookletPage { public class PageTextOnly extends BookletPage {
//
// public PageTextOnly(int localizationKey, int priority) { public PageTextOnly(int localizationKey, int priority) {
// super(localizationKey, priority); super(localizationKey, priority);
// } }
//
// public PageTextOnly(int localizationKey) { public PageTextOnly(int localizationKey) {
// super(localizationKey); super(localizationKey);
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) { public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) {
// String text = page.getInfoText(); String text = page.getInfoText();
// if (text != null && !text.isEmpty()) { if (text != null && !text.isEmpty()) {
// gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120); gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// renderTextToPage(gui, this, startX + 6, startY + 5); renderTextToPage(gui, this, startX + 6, startY + 5);
// } }
//} }

View file

@ -1,109 +1,109 @@
///* /*
// * This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft. * This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
//import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
//import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class PageTrials extends BookletPage { public class PageTrials extends BookletPage {
//
// private final int buttonId; private final int buttonId;
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// private Button button; private Button button;
//
// public PageTrials(int localizationKey, boolean button, boolean text) { public PageTrials(int localizationKey, boolean button, boolean text) {
// super(localizationKey); super(localizationKey);
//
// if (!text) { if (!text) {
// this.setNoText(); this.setNoText();
// } }
//
// if (button) { if (button) {
// this.buttonId = PageLinkButton.nextButtonId; this.buttonId = PageLinkButton.nextButtonId;
// PageLinkButton.nextButtonId++; PageLinkButton.nextButtonId++;
// } else { } else {
// this.buttonId = -1; this.buttonId = -1;
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) { public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY); super.init(gui, startX, startY);
//
// if (this.buttonId >= 0) { if (this.buttonId >= 0) {
// this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, ""); this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, "");
// gui.getButtonList().add(this.button); gui.getButtonList().add(this.button);
// this.updateButton(); this.updateButton();
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// protected String getLocalizationKey() { protected String getLocalizationKey() {
// return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey; return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void actionPerformed(GuiBookletBase gui, Button button) { public void actionPerformed(GuiBookletBase gui, Button button) {
// if (this.buttonId >= 0 && button.id == this.buttonId) { if (this.buttonId >= 0 && button.id == this.buttonId) {
// PlayerEntity player = Minecraft.getInstance().player; PlayerEntity player = Minecraft.getInstance().player;
// PlayerSave data = PlayerData.getDataFromPlayer(player); PlayerSave data = PlayerData.getDataFromPlayer(player);
// String id = this.chapter.getIdentifier(); String id = this.chapter.getIdentifier();
//
// boolean completed = data.completedTrials.contains(id); boolean completed = data.completedTrials.contains(id);
// if (completed) { if (completed) {
// data.completedTrials.remove(id); data.completedTrials.remove(id);
// } else { } else {
// data.completedTrials.add(id); data.completedTrials.add(id);
// } }
// this.updateButton(); this.updateButton();
//
// PacketHandlerHelper.sendPlayerDataToServer(false, 2); PacketHandlerHelper.sendPlayerDataToServer(false, 2);
// } else { } else {
// super.actionPerformed(gui, button); super.actionPerformed(gui, button);
// } }
// } }
//
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// private void updateButton() { private void updateButton() {
// if (this.buttonId >= 0 && this.button != null) { if (this.buttonId >= 0 && this.button != null) {
// PlayerEntity player = Minecraft.getInstance().player; PlayerEntity player = Minecraft.getInstance().player;
// PlayerSave data = PlayerData.getDataFromPlayer(player); PlayerSave data = PlayerData.getDataFromPlayer(player);
//
// boolean completed = data.completedTrials.contains(this.chapter.getIdentifier()); boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
// if (completed) { if (completed) {
// this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name"); this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name");
// } else { } else {
// this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name"); this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name");
// } }
//
// } }
// } }
//} }

View file

@ -10,48 +10,57 @@
package de.ellpeck.actuallyadditions.mod.config; package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.config.Configuration;
public final class ConfigValues { public final class ConfigValues {
//
public static Item itemRedstoneTorchConfigurator; public static Item itemRedstoneTorchConfigurator;
public static Item itemCompassConfigurator; public static Item itemCompassConfigurator;
//
// public static void defineConfigValues(Configuration config) { public static void defineConfigValues(Configuration config) {
// for (ConfigIntValues currConf : ConfigIntValues.values()) { for (ConfigIntValues currConf : ConfigIntValues.values()) {
// currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
// } }
//
// for (ConfigBoolValues currConf : ConfigBoolValues.values()) { for (ConfigBoolValues currConf : ConfigBoolValues.values()) {
// currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean();
// } }
//
// for (ConfigIntListValues currConf : ConfigIntListValues.values()) { for (ConfigIntListValues currConf : ConfigIntListValues.values()) {
// currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getIntList(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getIntList();
// } }
//
// for (ConfigStringListValues currConf : ConfigStringListValues.values()) { for (ConfigStringListValues currConf : ConfigStringListValues.values()) {
// currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList();
// } }
//
// parseConfiguratorConfig(); parseConfiguratorConfig();
// } }
//
// private static void parseConfiguratorConfig() { private static void parseConfiguratorConfig() {
// itemRedstoneTorchConfigurator = null; itemRedstoneTorchConfigurator = null;
// itemCompassConfigurator = null; itemCompassConfigurator = null;
//
// String[] conf = ConfigStringListValues.CONFIGURE_ITEMS.getValue(); String[] conf = ConfigStringListValues.CONFIGURE_ITEMS.getValue();
// if (conf.length == 2) { if (conf.length == 2) {
// itemRedstoneTorchConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[0])); itemRedstoneTorchConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[0]));
// itemCompassConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[1])); itemCompassConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[1]));
// } }
//
// if (itemRedstoneTorchConfigurator == null || itemCompassConfigurator == null) { if (itemRedstoneTorchConfigurator == null || itemCompassConfigurator == null) {
// ActuallyAdditions.LOGGER.error("Parsing the Configuration Items config failed, reverting back to the default settings!"); ActuallyAdditions.LOGGER.error("Parsing the Configuration Items config failed, reverting back to the default settings!");
//
// itemRedstoneTorchConfigurator = Item.byBlock(Blocks.REDSTONE_TORCH); itemRedstoneTorchConfigurator = Item.byBlock(Blocks.REDSTONE_TORCH);
// itemCompassConfigurator = Items.COMPASS; itemCompassConfigurator = Items.COMPASS;
// } }
// } }
} }

View file

@ -10,33 +10,39 @@
package de.ellpeck.actuallyadditions.mod.config; package de.ellpeck.actuallyadditions.mod.config;
import java.io.File;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class ConfigurationHandler { public class ConfigurationHandler {
//
// public static Configuration config; public static Configuration config;
//
// public ConfigurationHandler(File configFile) { public ConfigurationHandler(File configFile) {
// ActuallyAdditions.LOGGER.info("Grabbing Configurations..."); ActuallyAdditions.LOGGER.info("Grabbing Configurations...");
//
// MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
//
// config = new Configuration(configFile); config = new Configuration(configFile);
// config.load(); config.load();
//
// redefineConfigs(); redefineConfigs();
// } }
//
// public static void redefineConfigs() { public static void redefineConfigs() {
// ConfigValues.defineConfigValues(config); ConfigValues.defineConfigValues(config);
//
// if (config.hasChanged()) { if (config.hasChanged()) {
// config.save(); config.save();
// } }
// } }
//
// @SubscribeEvent @SubscribeEvent
// public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
// if (event.getModID().equalsIgnoreCase(ActuallyAdditions.MODID)) { if (event.getModID().equalsIgnoreCase(ActuallyAdditions.MODID)) {
// redefineConfigs(); redefineConfigs();
// } }
// } }
} }

View file

@ -1,6 +1,5 @@
package de.ellpeck.actuallyadditions.mod.crafting; package de.ellpeck.actuallyadditions.mod.crafting;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.data.IFinishedRecipe; import net.minecraft.data.IFinishedRecipe;
@ -17,44 +16,39 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry; import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class CrushingRecipe implements IRecipe<IInventory> { public class CrushingRecipe implements IRecipe<IInventory> {
public static String NAME = "crushing"; public static String NAME = "crushing";
private final ResourceLocation id; private ResourceLocation id;
protected Ingredient input; protected Ingredient input;
protected ItemStack outputOne; protected ItemStack outputOne;
protected ItemStack outputTwo; protected ItemStack outputTwo;
protected float chance1; protected int outputChance;
protected float chance2;
public CrushingRecipe(ResourceLocation id, Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) { public CrushingRecipe(ResourceLocation id, Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this.id = id; this.id = id;
this.input = input; this.input = input;
this.outputOne = outputOne; this.outputOne = outputOne;
this.outputTwo = outputTwo; this.outputTwo = outputTwo;
this.chance1 = chance1; this.outputChance = outputChance;
this.chance2 = chance2;
} }
public CrushingRecipe(Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) { public CrushingRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this.id = new ResourceLocation(ActuallyAdditions.MODID, input.getItems()[0].getItem().getRegistryName().getPath() + "_crushing"); this.id = new ResourceLocation(ActuallyAdditions.MODID, input.getItems()[0].getItem().getRegistryName().getPath() + "_crushing");
this.input = input; this.input = input;
this.outputOne = outputOne; this.outputOne = outputOne;
this.outputTwo = outputTwo; this.outputTwo = outputTwo;
this.chance1 = chance1; this.outputChance = outputChance;
this.chance2 = chance2;
} }
@Override @Override
public boolean matches(IInventory pInv, @Nonnull World pLevel) { public boolean matches(IInventory pInv, World pLevel) {
return input.test(pInv.getItem(0)); return input.test(pInv.getItem(0));
} }
@Override @Override
@Nonnull public ItemStack assemble(IInventory pInv) {
public ItemStack assemble(@Nonnull IInventory pInv) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
@ -64,25 +58,21 @@ public class CrushingRecipe implements IRecipe<IInventory> {
} }
@Override @Override
@Nonnull
public ItemStack getResultItem() { public ItemStack getResultItem() {
return outputOne; return outputOne;
} }
@Override @Override
@Nonnull
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override @Override
@Nonnull
public IRecipeSerializer<?> getSerializer() { public IRecipeSerializer<?> getSerializer() {
return ActuallyRecipes.CRUSHING_RECIPE.get(); return ActuallyRecipes.CRUSHING_RECIPE.get();
} }
@Override @Override
@Nonnull
public IRecipeType<?> getType() { public IRecipeType<?> getType() {
return ActuallyRecipes.Types.CRUSHING; return ActuallyRecipes.Types.CRUSHING;
} }
@ -95,11 +85,8 @@ public class CrushingRecipe implements IRecipe<IInventory> {
return this.outputTwo; return this.outputTwo;
} }
public float getFirstChance() { public int getSecondChance() {
return this.chance1; return this.outputChance;
}
public float getSecondChance() {
return this.chance2;
} }
public Ingredient getInput() { public Ingredient getInput() {
@ -109,96 +96,64 @@ public class CrushingRecipe implements IRecipe<IInventory> {
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<CrushingRecipe> { public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<CrushingRecipe> {
@Override @Override
@Nonnull public CrushingRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "input"));
Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); ItemStack output1 = new ItemStack(JSONUtils.getAsItem(pJson, "output_one"));
ItemStack output2 = new ItemStack(JSONUtils.getAsItem(pJson, "output_two"));
int chance = JSONUtils.getAsInt(pJson, "second_chance");
JsonArray resultList = JSONUtils.getAsJsonObject(pJson, "result").getAsJsonArray(); return new CrushingRecipe(pRecipeId, ingredient, output1, output2, chance);
if (resultList.size() < 1)
throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item");
ItemStack output1 = new ItemStack(JSONUtils.getAsItem(resultList.get(0).getAsJsonObject(), "item"));
float chance1 = JSONUtils.getAsFloat(resultList.get(0).getAsJsonObject(), "chance");
ItemStack output2 = ItemStack.EMPTY;
float chance2 = 1.0f;
if (resultList.size() > 1) {
output2 = new ItemStack(JSONUtils.getAsItem(resultList.get(1).getAsJsonObject(), "item"));
chance2 = JSONUtils.getAsFloat(resultList.get(1).getAsJsonObject(), "chance");
}
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
} }
@Nullable
@Override @Override
public CrushingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { public CrushingRecipe fromNetwork(ResourceLocation pRecipeId, PacketBuffer pBuffer) {
Ingredient ingredient = Ingredient.fromNetwork(pBuffer); Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
ItemStack output1 = pBuffer.readItem(); ItemStack output1 = pBuffer.readItem();
ItemStack output2 = pBuffer.readItem(); ItemStack output2 = pBuffer.readItem();
float chance1 = pBuffer.readFloat(); int chance = pBuffer.readInt();
float chance2 = pBuffer.readFloat();
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2); return new CrushingRecipe(pRecipeId, ingredient, output1, output2, chance);
} }
@Override @Override
public void toNetwork(@Nonnull PacketBuffer pBuffer, CrushingRecipe pRecipe) { public void toNetwork(PacketBuffer pBuffer, CrushingRecipe pRecipe) {
pRecipe.input.toNetwork(pBuffer); pRecipe.input.toNetwork(pBuffer);
pBuffer.writeItem(pRecipe.outputOne); pBuffer.writeItem(pRecipe.outputOne);
pBuffer.writeItem(pRecipe.outputTwo); pBuffer.writeItem(pRecipe.outputTwo);
pBuffer.writeFloat(pRecipe.chance1); pBuffer.writeInt(pRecipe.outputChance);
pBuffer.writeFloat(pRecipe.chance2);
} }
} }
public static class FinishedRecipe implements IFinishedRecipe { public static class FinishedRecipe implements IFinishedRecipe {
private final ResourceLocation id; private ResourceLocation id;
protected Ingredient input; protected Ingredient input;
protected IItemProvider outputOne; protected IItemProvider outputOne;
protected int countOne;
protected float outputChance1;
protected IItemProvider outputTwo; protected IItemProvider outputTwo;
protected int countTwo; protected int outputChance;
protected float outputChance2;
public FinishedRecipe(ResourceLocation id, Ingredient input, IItemProvider outputOne, int countOne, float outputChance1, IItemProvider outputTwo, int countTwo, float outputChance2) { public FinishedRecipe(ResourceLocation id, Ingredient input, IItemProvider outputOne, IItemProvider outputTwo, int outputChance) {
this.id = id; this.id = id;
this.countOne = countOne;
this.countTwo = countTwo;
this.input = input; this.input = input;
this.outputOne = outputOne; this.outputOne = outputOne;
this.outputTwo = outputTwo; this.outputTwo = outputTwo;
this.outputChance1 = outputChance1; this.outputChance = outputChance;
this.outputChance2 = outputChance2;
} }
@Override @Override
public void serializeRecipeData(JsonObject pJson) { public void serializeRecipeData(JsonObject pJson) {
pJson.add("ingredient", input.toJson()); pJson.add("input", input.toJson());
pJson.addProperty("output_one", outputOne.asItem().getRegistryName().toString());
JsonObject result1 = new JsonObject(); pJson.addProperty("output_two", outputTwo.asItem().getRegistryName().toString());
result1.addProperty("item", outputOne.asItem().getRegistryName().toString()); pJson.addProperty("second_chance", outputChance);
result1.addProperty("chance", outputChance1);
JsonObject result2 = new JsonObject();
result1.addProperty("item", outputTwo.asItem().getRegistryName().toString());
result1.addProperty("chance", outputChance2);
JsonArray resultList = new JsonArray();
resultList.add(result1);
resultList.add(result2);
pJson.add("result", resultList);
} }
@Override @Override
@Nonnull
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override @Override
@Nonnull
public IRecipeSerializer<?> getType() { public IRecipeSerializer<?> getType() {
return ActuallyRecipes.CRUSHING_RECIPE.get(); return ActuallyRecipes.CRUSHING_RECIPE.get();
} }

View file

@ -15,14 +15,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry; import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class EmpowererRecipe implements IRecipe<IInventory> { public class EmpowererRecipe implements IRecipe<IInventory> {
public static String NAME = "empowering"; public static String NAME = "empowering";
private final ResourceLocation id; private ResourceLocation id;
protected final Ingredient input; protected final Ingredient input;
protected final ItemStack output; protected final ItemStack output;
@ -74,13 +73,12 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
} }
@Override @Override
public boolean matches(@Nonnull IInventory pInv, @Nonnull World pLevel) { public boolean matches(IInventory pInv, World pLevel) {
return false; return false;
} }
@Override @Override
@Nonnull public ItemStack assemble(IInventory pInv) {
public ItemStack assemble(@Nonnull IInventory pInv) {
return output.copy(); return output.copy();
} }
@ -90,25 +88,21 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
} }
@Override @Override
@Nonnull
public ItemStack getResultItem() { public ItemStack getResultItem() {
return output; return output;
} }
@Override @Override
@Nonnull
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override @Override
@Nonnull
public IRecipeSerializer<?> getSerializer() { public IRecipeSerializer<?> getSerializer() {
return ActuallyRecipes.EMPOWERING_RECIPE.get(); return ActuallyRecipes.EMPOWERING_RECIPE.get();
} }
@Override @Override
@Nonnull
public IRecipeType<?> getType() { public IRecipeType<?> getType() {
return ActuallyRecipes.Types.EMPOWERING; return ActuallyRecipes.Types.EMPOWERING;
} }
@ -151,8 +145,8 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<EmpowererRecipe> { public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<EmpowererRecipe> {
@Override @Override
@Nonnull public EmpowererRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
public EmpowererRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { ItemStack result = new ItemStack(JSONUtils.getAsItem(pJson, "result"));
Ingredient base = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "base")); Ingredient base = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "base"));
Ingredient mod1 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier1")); Ingredient mod1 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier1"));
Ingredient mod2 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier2")); Ingredient mod2 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier2"));
@ -161,15 +155,13 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
int energy = JSONUtils.getAsInt(pJson, "energy"); int energy = JSONUtils.getAsInt(pJson, "energy");
int color = JSONUtils.getAsInt(pJson, "color"); int color = JSONUtils.getAsInt(pJson, "color");
int time = JSONUtils.getAsInt(pJson, "time"); int time = JSONUtils.getAsInt(pJson, "time");
JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result");
ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item"));
return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time); return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time);
} }
@Nullable @Nullable
@Override @Override
public EmpowererRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, PacketBuffer pBuffer) { public EmpowererRecipe fromNetwork(ResourceLocation pRecipeId, PacketBuffer pBuffer) {
ItemStack result = pBuffer.readItem(); ItemStack result = pBuffer.readItem();
Ingredient input = Ingredient.fromNetwork(pBuffer); Ingredient input = Ingredient.fromNetwork(pBuffer);
Ingredient mod1 = Ingredient.fromNetwork(pBuffer); Ingredient mod1 = Ingredient.fromNetwork(pBuffer);
@ -198,16 +190,16 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
} }
public static class FinishedRecipe implements IFinishedRecipe { public static class FinishedRecipe implements IFinishedRecipe {
private final ResourceLocation id; private ResourceLocation id;
private final Ingredient base; private Ingredient base;
private final Ingredient mod1; private Ingredient mod1;
private final Ingredient mod2; private Ingredient mod2;
private final Ingredient mod3; private Ingredient mod3;
private final Ingredient mod4; private Ingredient mod4;
private final int energy; private int energy;
private final int color; private int color;
private final int time; private int time;
private final IItemProvider output; private IItemProvider output;
public FinishedRecipe(ResourceLocation id, IItemProvider output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) { public FinishedRecipe(ResourceLocation id, IItemProvider output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) {
this.id = id; this.id = id;
@ -232,21 +224,15 @@ public class EmpowererRecipe implements IRecipe<IInventory> {
pJson.addProperty("energy", energy); pJson.addProperty("energy", energy);
pJson.addProperty("time", time); pJson.addProperty("time", time);
pJson.addProperty("color", color); pJson.addProperty("color", color);
pJson.addProperty("result", output.asItem().getRegistryName().toString());
JsonObject resultObject = new JsonObject();
resultObject.addProperty("item", output.asItem().getRegistryName().toString());
pJson.add("result", resultObject);
} }
@Override @Override
@Nonnull
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override @Override
@Nonnull
public IRecipeSerializer<?> getType() { public IRecipeSerializer<?> getType() {
return ActuallyRecipes.EMPOWERING_RECIPE.get(); return ActuallyRecipes.EMPOWERING_RECIPE.get();
} }

View file

@ -4,10 +4,7 @@ import com.google.gson.JsonObject;
import net.minecraft.data.IFinishedRecipe; import net.minecraft.data.IFinishedRecipe;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.*;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.IItemProvider; import net.minecraft.util.IItemProvider;
import net.minecraft.util.JSONUtils; import net.minecraft.util.JSONUtils;
@ -83,8 +80,7 @@ public class LaserRecipe implements IRecipe<IInventory> {
public LaserRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) { public LaserRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient"));
int energy = JSONUtils.getAsInt(pJson, "energy"); int energy = JSONUtils.getAsInt(pJson, "energy");
JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); ItemStack result = new ItemStack(JSONUtils.getAsItem(pJson, "result"));
ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item"));
return new LaserRecipe(pRecipeId, result, ingredient, energy); return new LaserRecipe(pRecipeId, result, ingredient, energy);
} }
@ -121,13 +117,9 @@ public class LaserRecipe implements IRecipe<IInventory> {
@Override @Override
public void serializeRecipeData(JsonObject pJson) { public void serializeRecipeData(JsonObject pJson) {
pJson.add("ingredient", itemIngredient.toJson()); pJson.add("input", itemIngredient.toJson());
pJson.addProperty("energy", energy); pJson.addProperty("energy", energy);
pJson.addProperty("output", output.asItem().getRegistryName().toString());
JsonObject resultObject = new JsonObject();
resultObject.addProperty("item", output.asItem().getRegistryName().toString());
pJson.add("result", resultObject);
} }
@Override @Override

View file

@ -11,7 +11,6 @@ import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.IIngredientSerializer; import net.minecraftforge.common.crafting.IIngredientSerializer;
import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
public class TargetNBTIngredient extends Ingredient { public class TargetNBTIngredient extends Ingredient {
@ -20,7 +19,6 @@ public class TargetNBTIngredient extends Ingredient {
} }
@Override @Override
@Nonnull
public IIngredientSerializer<? extends Ingredient> getSerializer() { public IIngredientSerializer<? extends Ingredient> getSerializer() {
return SERIALIZER; return SERIALIZER;
} }
@ -31,15 +29,13 @@ public class TargetNBTIngredient extends Ingredient {
public static TargetNBTIngredient of(ItemStack itemStack) { public static TargetNBTIngredient of(ItemStack itemStack) {
return new TargetNBTIngredient(Stream.of(new SingleItemList(itemStack))); return new TargetNBTIngredient(Stream.of(new SingleItemList(itemStack)));
} }
@Nonnull public static TargetNBTIngredient of(ITag tag) {
public static TargetNBTIngredient of(@Nonnull ITag tag) {
return new TargetNBTIngredient(Stream.of(new TagList(tag))); return new TargetNBTIngredient(Stream.of(new TagList(tag)));
} }
@Override @Override
@Nonnull
public JsonElement toJson() { public JsonElement toJson() {
JsonObject tmp = super.toJson().getAsJsonObject(); JsonObject tmp = super.toJson().getAsJsonObject();
tmp.addProperty("type", Serializer.NAME.toString()); tmp.addProperty("type", Serializer.NAME.toString());
@ -52,14 +48,12 @@ public class TargetNBTIngredient extends Ingredient {
public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target"); public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
@Override @Override
@Nonnull
public TargetNBTIngredient parse(PacketBuffer buffer) { public TargetNBTIngredient parse(PacketBuffer buffer) {
return new TargetNBTIngredient(Stream.generate(() -> new SingleItemList(buffer.readItem())).limit(buffer.readVarInt())); return new TargetNBTIngredient(Stream.generate(() -> new SingleItemList(buffer.readItem())).limit(buffer.readVarInt()));
} }
@Override @Override
@Nonnull public TargetNBTIngredient parse(JsonObject json) {
public TargetNBTIngredient parse(@Nonnull JsonObject json) {
return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json))); return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
} }

View file

@ -0,0 +1,92 @@
/*
* This file ("ToolCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
// TODO: [port] MOVE TO DATA_GENERATOR
@Deprecated
public final class ToolCrafting {
//
// public static final ArrayList<IRecipe> RECIPES_PAXELS = new ArrayList<>();
//
// public static void init() {
//
// addToolAndArmorRecipes(new ItemStack(Items.EMERALD), InitItems.itemPickaxeEmerald, InitItems.itemSwordEmerald, InitItems.itemAxeEmerald, InitItems.itemShovelEmerald, InitItems.itemHoeEmerald, InitItems.itemHelmEmerald, InitItems.itemChestEmerald, InitItems.itemPantsEmerald, InitItems.itemBootsEmerald);
// addToolAndArmorRecipes("gemQuartzBlack", InitItems.itemPickaxeQuartz, InitItems.itemSwordQuartz, InitItems.itemAxeQuartz, InitItems.itemShovelQuartz, InitItems.itemHoeQuartz, InitItems.itemHelmQuartz, InitItems.itemChestQuartz, InitItems.itemPantsQuartz, InitItems.itemBootsQuartz);
// addToolAndArmorRecipes(new ItemStack(Blocks.OBSIDIAN), InitItems.itemPickaxeObsidian, InitItems.itemSwordObsidian, InitItems.itemAxeObsidian, InitItems.itemShovelObsidian, InitItems.itemHoeObsidian, InitItems.itemHelmObsidian, InitItems.itemChestObsidian, InitItems.itemPantsObsidian, InitItems.itemBootsObsidian);
//
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), InitItems.itemPickaxeCrystalRed, InitItems.itemSwordCrystalRed, InitItems.itemAxeCrystalRed, InitItems.itemShovelCrystalRed, InitItems.itemHoeCrystalRed, InitItems.itemHelmCrystalRed, InitItems.itemChestCrystalRed, InitItems.itemPantsCrystalRed, InitItems.itemBootsCrystalRed);
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), InitItems.itemPickaxeCrystalGreen, InitItems.itemSwordCrystalGreen, InitItems.itemAxeCrystalGreen, InitItems.itemShovelCrystalGreen, InitItems.itemHoeCrystalGreen, InitItems.itemHelmCrystalGreen, InitItems.itemChestCrystalGreen, InitItems.itemPantsCrystalGreen, InitItems.itemBootsCrystalGreen);
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), InitItems.itemPickaxeCrystalWhite, InitItems.itemSwordCrystalWhite, InitItems.itemAxeCrystalWhite, InitItems.itemShovelCrystalWhite, InitItems.itemHoeCrystalWhite, InitItems.itemHelmCrystalWhite, InitItems.itemChestCrystalWhite, InitItems.itemPantsCrystalWhite, InitItems.itemBootsCrystalWhite);
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), InitItems.itemPickaxeCrystalLightBlue, InitItems.itemSwordCrystalLightBlue, InitItems.itemAxeCrystalLightBlue, InitItems.itemShovelCrystalLightBlue, InitItems.itemHoeCrystalLightBlue, InitItems.itemHelmCrystalLightBlue, InitItems.itemChestCrystalLightBlue, InitItems.itemPantsCrystalLightBlue, InitItems.itemBootsCrystalLightBlue);
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), InitItems.itemPickaxeCrystalBlue, InitItems.itemSwordCrystalBlue, InitItems.itemAxeCrystalBlue, InitItems.itemShovelCrystalBlue, InitItems.itemHoeCrystalBlue, InitItems.itemHelmCrystalBlue, InitItems.itemChestCrystalBlue, InitItems.itemPantsCrystalBlue, InitItems.itemBootsCrystalBlue);
// addToolAndArmorRecipes(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), InitItems.itemPickaxeCrystalBlack, InitItems.itemSwordCrystalBlack, InitItems.itemAxeCrystalBlack, InitItems.itemShovelCrystalBlack, InitItems.itemHoeCrystalBlack, InitItems.itemHelmCrystalBlack, InitItems.itemChestCrystalBlack, InitItems.itemPantsCrystalBlack, InitItems.itemBootsCrystalBlack);
//
// //Paxels
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.woodenPaxel), new ItemStack(Items.WOODEN_AXE), new ItemStack(Items.WOODEN_PICKAXE), new ItemStack(Items.WOODEN_SHOVEL), new ItemStack(Items.WOODEN_SWORD), new ItemStack(Items.WOODEN_HOE));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.stonePaxel), new ItemStack(Items.STONE_AXE), new ItemStack(Items.STONE_PICKAXE), new ItemStack(Items.STONE_SHOVEL), new ItemStack(Items.STONE_SWORD), new ItemStack(Items.STONE_HOE));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.ironPaxel), new ItemStack(Items.IRON_AXE), new ItemStack(Items.IRON_PICKAXE), new ItemStack(Items.IRON_SHOVEL), new ItemStack(Items.IRON_SWORD), new ItemStack(Items.IRON_HOE));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.goldPaxel), new ItemStack(Items.GOLDEN_AXE), new ItemStack(Items.GOLDEN_PICKAXE), new ItemStack(Items.GOLDEN_SHOVEL), new ItemStack(Items.GOLDEN_SWORD), new ItemStack(Items.GOLDEN_HOE));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.diamondPaxel), new ItemStack(Items.DIAMOND_AXE), new ItemStack(Items.DIAMOND_PICKAXE), new ItemStack(Items.DIAMOND_SHOVEL), new ItemStack(Items.DIAMOND_SWORD), new ItemStack(Items.DIAMOND_HOE));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.emeraldPaxel), new ItemStack(InitItems.itemAxeEmerald), new ItemStack(InitItems.itemPickaxeEmerald), new ItemStack(InitItems.itemSwordEmerald), new ItemStack(InitItems.itemShovelEmerald), new ItemStack(InitItems.itemHoeEmerald));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.obsidianPaxel), new ItemStack(InitItems.itemAxeObsidian), new ItemStack(InitItems.itemPickaxeObsidian), new ItemStack(InitItems.itemSwordObsidian), new ItemStack(InitItems.itemShovelObsidian), new ItemStack(InitItems.itemHoeObsidian));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.quartzPaxel), new ItemStack(InitItems.itemAxeQuartz), new ItemStack(InitItems.itemPickaxeQuartz), new ItemStack(InitItems.itemSwordQuartz), new ItemStack(InitItems.itemShovelQuartz), new ItemStack(InitItems.itemHoeQuartz));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
//
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalRed), new ItemStack(InitItems.itemAxeCrystalRed), new ItemStack(InitItems.itemPickaxeCrystalRed), new ItemStack(InitItems.itemSwordCrystalRed), new ItemStack(InitItems.itemShovelCrystalRed), new ItemStack(InitItems.itemHoeCrystalRed));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalGreen), new ItemStack(InitItems.itemAxeCrystalGreen), new ItemStack(InitItems.itemPickaxeCrystalGreen), new ItemStack(InitItems.itemSwordCrystalGreen), new ItemStack(InitItems.itemShovelCrystalGreen), new ItemStack(InitItems.itemHoeCrystalGreen));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalBlue), new ItemStack(InitItems.itemAxeCrystalBlue), new ItemStack(InitItems.itemPickaxeCrystalBlue), new ItemStack(InitItems.itemSwordCrystalBlue), new ItemStack(InitItems.itemShovelCrystalBlue), new ItemStack(InitItems.itemHoeCrystalBlue));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalLightBlue), new ItemStack(InitItems.itemAxeCrystalLightBlue), new ItemStack(InitItems.itemPickaxeCrystalLightBlue), new ItemStack(InitItems.itemSwordCrystalLightBlue), new ItemStack(InitItems.itemShovelCrystalLightBlue), new ItemStack(InitItems.itemHoeCrystalLightBlue));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalBlack), new ItemStack(InitItems.itemAxeCrystalBlack), new ItemStack(InitItems.itemPickaxeCrystalBlack), new ItemStack(InitItems.itemSwordCrystalBlack), new ItemStack(InitItems.itemShovelCrystalBlack), new ItemStack(InitItems.itemHoeCrystalBlack));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemPaxelCrystalWhite), new ItemStack(InitItems.itemAxeCrystalWhite), new ItemStack(InitItems.itemPickaxeCrystalWhite), new ItemStack(InitItems.itemSwordCrystalWhite), new ItemStack(InitItems.itemShovelCrystalWhite), new ItemStack(InitItems.itemHoeCrystalWhite));
// RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
// }
//
// public static void addToolAndArmorRecipes(Object base, Item pickaxe, Item sword, Item axe, Item shovel, Item hoe, Item helm, Item chest, Item pants, Item boots) {
// //Pickaxe
// RecipeHandler.addOreDictRecipe(new ItemStack(pickaxe), "EEE", " S ", " S ", 'E', base, 'S', new ItemStack(Items.STICK));
//
// //Sword
// RecipeHandler.addOreDictRecipe(new ItemStack(sword), "E", "E", "S", 'E', base, 'S', new ItemStack(Items.STICK));
//
// //Axe
// RecipeHandler.addOreDictRecipe(new ItemStack(axe), "EE", "ES", " S", 'E', base, 'S', new ItemStack(Items.STICK));
//
// //Shovel
// RecipeHandler.addOreDictRecipe(new ItemStack(shovel), "E", "S", "S", 'E', base, 'S', new ItemStack(Items.STICK));
//
// //Hoe
// RecipeHandler.addOreDictRecipe(new ItemStack(hoe), "EE", " S", " S", 'E', base, 'S', new ItemStack(Items.STICK));
//
// //Helm
// RecipeHandler.addShapedRecipe(new ItemStack(helm), "OOO", "O O", 'O', base);
//
// //Chest
// RecipeHandler.addShapedRecipe(new ItemStack(chest), "O O", "OOO", "OOO", 'O', base);
//
// //Legs
// RecipeHandler.addShapedRecipe(new ItemStack(pants), "OOO", "O O", "O O", 'O', base);
//
// //Boots
// RecipeHandler.addShapedRecipe(new ItemStack(boots), "O O", "O O", 'O', base);
// }
}

View file

@ -11,10 +11,14 @@
package de.ellpeck.actuallyadditions.mod.data; package de.ellpeck.actuallyadditions.mod.data;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT; import net.minecraft.nbt.StringNBT;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -55,8 +59,8 @@ public final class PlayerData {
public IBookletPage[] bookmarks = new IBookletPage[12]; public IBookletPage[] bookmarks = new IBookletPage[12];
public List<String> completedTrials = new ArrayList<>(); public List<String> completedTrials = new ArrayList<>();
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public GuiBooklet lastOpenBooklet; public GuiBooklet lastOpenBooklet;
public PlayerSave(UUID id) { public PlayerSave(UUID id) {
this.id = id; this.id = id;
@ -109,8 +113,8 @@ public final class PlayerData {
for (int i = 0; i < bookmarks.size(); i++) { for (int i = 0; i < bookmarks.size(); i++) {
String strg = bookmarks.getString(i); String strg = bookmarks.getString(i);
if (!strg.isEmpty()) { if (!strg.isEmpty()) {
// IBookletPage page = BookletUtils.getBookletPageById(strg); IBookletPage page = BookletUtils.getBookletPageById(strg);
this.bookmarks[i] = null; // page; this.bookmarks[i] = page;
} else { } else {
this.bookmarks[i] = null; this.bookmarks[i] = null;
} }

View file

@ -12,71 +12,85 @@ package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior;
import net.minecraft.block.*; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.IGrowable;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
public class EntityWorm extends Entity { public class EntityWorm extends Entity {
public int timer; public int timer;
public EntityWorm(EntityType<?> type, World world) { public EntityWorm(World world) {
super(type, world); super(world);
this.setBoundingBox(new AxisAlignedBB(0, 0, 0, 0, 0, 0)); this.setEntityBoundingBox(new AxisAlignedBB(0, 0, 0, 0, 0, 0));
} }
public static boolean canWormify(World world, BlockPos pos, BlockState state) { public static boolean canWormify(World world, BlockPos pos, BlockState state) {
Block block = state.getBlock(); Block block = state.getBlock();
boolean rightBlock = block instanceof FarmlandBlock || block == Blocks.DIRT || block instanceof GrassBlock; boolean rightBlock = block instanceof BlockFarmland || block instanceof BlockDirt || block instanceof BlockGrass;
if (rightBlock) { if (rightBlock) {
BlockPos posUp = pos.above(); BlockPos posUp = pos.above();
BlockState stateUp = world.getBlockState(posUp); BlockState stateUp = world.getBlockState(posUp);
Block blockUp = stateUp.getBlock(); Block blockUp = stateUp.getBlock();
return blockUp instanceof IPlantable || blockUp instanceof BushBlock || stateUp.getMaterial().isReplaceable(); return blockUp instanceof IPlantable || blockUp instanceof BlockBush || blockUp.canBeReplaced(world, posUp);
} else { } else {
return false; return false;
} }
} }
@Override @Override
public boolean canUpdate() { protected void entityInit() {
return true;
} }
@Override @Override
public void tick() { protected void readEntityFromNBT(CompoundNBT compound) {
this.timer = compound.getInt("Timer");
}
@Override
protected void writeEntityToNBT(CompoundNBT compound) {
compound.putInt("Timer", this.timer);
}
@Override
public void onUpdate() {
this.onEntityUpdate();
}
@Override
public void onEntityUpdate() {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
this.timer++; this.timer++;
if (this.timer % 50 == 0) { if (this.timer % 50 == 0) {
for (int x = -1; x <= 1; x++) { for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) { for (int z = -1; z <= 1; z++) {
BlockPos pos = new BlockPos(this.getX() + x, this.getY(), this.getZ() + z); BlockPos pos = new BlockPos(this.posX + x, this.posY, this.posZ + z);
BlockState state = this.level.getBlockState(pos); BlockState state = this.level.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();
boolean isMiddlePose = x == 0 && z == 0; boolean isMiddlePose = x == 0 && z == 0;
if (canWormify(this.level, pos, state)) { if (canWormify(this.level, pos, state)) {
boolean isFarmland = block instanceof FarmlandBlock; boolean isFarmland = block instanceof BlockFarmland;
if (!isFarmland || state.getValue(FarmlandBlock.MOISTURE) < 7) { if (!isFarmland || state.getValue(BlockFarmland.MOISTURE) < 7) {
if (isMiddlePose || this.level.random.nextFloat() >= 0.45F) { if (isMiddlePose || this.level.random.nextFloat() >= 0.45F) {
if (!isFarmland) { if (!isFarmland) {
DefaultFarmerBehavior.useHoeAt(this.level, pos); DefaultFarmerBehavior.useHoeAt(this.level, pos);
} }
state = this.level.getBlockState(pos); state = this.level.getBlockState(pos);
isFarmland = state.getBlock() instanceof FarmlandBlock; isFarmland = state.getBlock() instanceof BlockFarmland;
if (isFarmland) { if (isFarmland) {
this.level.setBlock(pos, state.setValue(FarmlandBlock.MOISTURE, 7), 2); this.level.setBlock(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2);
} }
} }
} }
@ -87,8 +101,8 @@ public class EntityWorm extends Entity {
BlockState plantState = this.level.getBlockState(plant); BlockState plantState = this.level.getBlockState(plant);
Block plantBlock = plantState.getBlock(); Block plantBlock = plantState.getBlock();
if ((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof GrassBlock)) { if ((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof BlockGrass)) {
plantBlock.randomTick(plantState, (ServerWorld) this.level, plant, this.level.random); plantBlock.updateTick(this.level, plant, plantState, this.level.random);
BlockState newState = this.level.getBlockState(plant); BlockState newState = this.level.getBlockState(plant);
if (newState != plantState) { if (newState != plantState) {
@ -110,24 +124,4 @@ public class EntityWorm extends Entity {
} }
} }
} }
@Override
protected void defineSynchedData() {
}
@Override
protected void readAdditionalSaveData(CompoundNBT compound) {
this.timer = compound.getInt("Timer");
}
@Override
protected void addAdditionalSaveData(CompoundNBT compound) {
compound.putInt("Timer", this.timer);
}
@Override
public IPacket<?> getAddEntityPacket() {
return null;
}
} }

View file

@ -11,8 +11,9 @@
package de.ellpeck.actuallyadditions.mod.entity; package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraftforge.api.distmarker.Dist; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
public final class InitEntities { public final class InitEntities {
@ -20,12 +21,12 @@ public final class InitEntities {
public static void init() { public static void init() {
ActuallyAdditions.LOGGER.info("Initializing Entities..."); ActuallyAdditions.LOGGER.info("Initializing Entities...");
//EntityRegistry.registerModEntity(new ResourceLocation(ActuallyAdditions.MODID, "worm"), EntityWorm.class, ActuallyAdditions.MODID + ".worm", 0, ActuallyAdditions.INSTANCE, 64, 1, false); EntityRegistry.registerModEntity(new ResourceLocation(ActuallyAdditions.MODID, "worm"), EntityWorm.class, ActuallyAdditions.MODID + ".worm", 0, ActuallyAdditions.INSTANCE, 64, 1, false);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void initClient() { public static void initClient() {
//RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new); RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new);
} }
} }

View file

@ -10,69 +10,47 @@
package de.ellpeck.actuallyadditions.mod.entity; package de.ellpeck.actuallyadditions.mod.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class RenderWorm extends EntityRenderer<EntityWorm> { public class RenderWorm extends Render<EntityWorm> {
private static ItemStack stack = ItemStack.EMPTY; private static ItemStack stack = ItemStack.EMPTY;
public RenderWorm(EntityRendererManager p_i46179_1_) {
super(p_i46179_1_);
}
public static void fixItemStack() { public static void fixItemStack() {
stack = new ItemStack(ActuallyItems.WORM.get()); stack = new ItemStack(ActuallyItems.WORM.get());
} }
@Override protected RenderWorm(RenderManager renderManager) {
public void render(EntityWorm entity, float partialTicks, float p_225623_3_, MatrixStack matrix, IRenderTypeBuffer buffer, int light) { super(renderManager);
matrix.pushPose();
matrix.translate(0, 0.7F, 0);
double boop = Util.getMillis() / 70D;
matrix.mulPose(new Quaternion(-(float) (boop % 360), 0, 1, 0));
// stack.getDisplayName()
Minecraft.getInstance().getItemRenderer().renderStatic(
stack, ItemCameraTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer
);
matrix.popPose();
} }
// @Override
// public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks) {
// GlStateManager.pushMatrix();
// this.bindEntityTexture(entity);
// GlStateManager.translate(x, y + 0.7F, z);
// double boop = Minecraft.getSystemTime() / 70D;
// GlStateManager.rotate(-(float) (boop % 360), 0, 1, 0);
// GlStateManager.translate(0, 0, 0.4);
//
// stack.setStackDisplayName(entity.getName());
// AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
//
// GlStateManager.popMatrix();
// }
@Override @Override
public ResourceLocation getTextureLocation(EntityWorm pEntity) { protected ResourceLocation getEntityTexture(EntityWorm entity) {
return PlayerContainer.BLOCK_ATLAS; return TextureMap.LOCATION_BLOCKS_TEXTURE;
}
@Override
public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks) {
GlStateManager.pushMatrix();
this.bindEntityTexture(entity);
GlStateManager.translate(x, y + 0.7F, z);
double boop = Minecraft.getSystemTime() / 70D;
GlStateManager.rotate(-(float) (boop % 360), 0, 1, 0);
GlStateManager.translate(0, 0, 0.4);
stack.setStackDisplayName(entity.getName());
AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
GlStateManager.popMatrix();
} }
} }

View file

@ -10,73 +10,26 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.items.ItemBooklet;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@Deprecated
enum GuiTypes {
FEEDER,
GIANT_CHEST,
GIANT_CHEST_PAGE_2,
GIANT_CHEST_PAGE_3,
CRAFTER(false),
GRINDER,
GRINDER_DOUBLE,
FURNACE_DOUBLE,
INPUTTER,
REPAIRER,
INPUTTER_ADVANCED,
BREAKER,
DROPPER,
CANOLA_PRESS,
FERMENTING_BARREL,
COAL_GENERATOR,
OIL_GENERATOR,
PHANTOM_PLACER,
FLUID_COLLECTOR,
COFFEE_MACHINE,
DRILL(false),
ENERGIZER,
ENERVATOR,
XP_SOLIDIFIER,
CLOUD,
BOOK(false),
DIRECTIONAL_BREAKER,
RANGED_COLLECTOR,
MINER,
LASER_RELAY_ITEM_WHITELIST,
FILTER(false),
BAG(false),
VOID_BAG(false),
BIO_REACTOR,
FARMER,
FIREWORK_BOX;
public final boolean checkTileEntity;
GuiTypes() {
this(true);
}
GuiTypes(boolean checkTileEntity) {
this.checkTileEntity = checkTileEntity;
}
}
public class GuiHandler { public class GuiHandler {
@Deprecated @Deprecated
public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) {
TileEntityBase tile = null; TileEntityBase tile = null;
// if (GuiTypes.values()[id].checkTileEntity) { if (GuiTypes.values()[id].checkTileEntity) {
// tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z));
// } }
// switch (GuiTypes.values()[id]) { switch (GuiTypes.values()[id]) {
// case FEEDER: // case FEEDER:
// return new ContainerFeeder(player.inventory, tile); // return new ContainerFeeder(player.inventory, tile);
// case GIANT_CHEST: // case GIANT_CHEST:
@ -147,106 +100,153 @@ public class GuiHandler {
// return new ContainerFarmer(player.inventory, tile); // return new ContainerFarmer(player.inventory, tile);
// case FIREWORK_BOX: // case FIREWORK_BOX:
// return new ContainerFireworkBox(); // return new ContainerFireworkBox();
// default: default:
// return null;
// }
return null; return null;
} }
}
@Deprecated @Deprecated
public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) {
// TileEntityBase tile = null; TileEntityBase tile = null;
// if (GuiTypes.values()[id].checkTileEntity) { if (GuiTypes.values()[id].checkTileEntity) {
// tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z));
// } }
// switch (GuiTypes.values()[id]) { switch (GuiTypes.values()[id]) {
// case FEEDER: case FEEDER:
// return new GuiFeeder(player.inventory, tile); return new GuiFeeder(player.inventory, tile);
// case GIANT_CHEST: case GIANT_CHEST:
// return new GuiGiantChest(player.inventory, tile, 0); return new GuiGiantChest(player.inventory, tile, 0);
// case GIANT_CHEST_PAGE_2: case GIANT_CHEST_PAGE_2:
// return new GuiGiantChest(player.inventory, tile, 1); return new GuiGiantChest(player.inventory, tile, 1);
// case GIANT_CHEST_PAGE_3: case GIANT_CHEST_PAGE_3:
// return new GuiGiantChest(player.inventory, tile, 2); return new GuiGiantChest(player.inventory, tile, 2);
// case CRAFTER: case CRAFTER:
// return CompatUtil.getCrafterGuiElement(player, world, x, y, z); return CompatUtil.getCrafterGuiElement(player, world, x, y, z);
// case GRINDER: case GRINDER:
// return new GuiGrinder(player.inventory, tile); return new GuiGrinder(player.inventory, tile);
// case GRINDER_DOUBLE: case GRINDER_DOUBLE:
// return new GuiGrinder.GuiGrinderDouble(player.inventory, tile); return new GuiGrinder.GuiGrinderDouble(player.inventory, tile);
// case FURNACE_DOUBLE: case FURNACE_DOUBLE:
// return new GuiFurnaceDouble(player.inventory, tile); return new GuiFurnaceDouble(player.inventory, tile);
// case INPUTTER: case INPUTTER:
// return new GuiInputter(player.inventory, tile, false); return new GuiInputter(player.inventory, tile, false);
// case INPUTTER_ADVANCED: case INPUTTER_ADVANCED:
// return new GuiInputter(player.inventory, tile, true); return new GuiInputter(player.inventory, tile, true);
// case REPAIRER: case REPAIRER:
// return new GuiRepairer(player.inventory, tile); return new GuiRepairer(player.inventory, tile);
// // case BREAKER: // case BREAKER:
// // return new GuiBreaker(player.inventory, tile); // return new GuiBreaker(player.inventory, tile);
// case DROPPER: case DROPPER:
// return new GuiDropper(player, tile); return new GuiDropper(player, tile);
// case CANOLA_PRESS: case CANOLA_PRESS:
// return new GuiCanolaPress(player.inventory, tile); return new GuiCanolaPress(player.inventory, tile);
// case FERMENTING_BARREL: case FERMENTING_BARREL:
// return new GuiFermentingBarrel(player.inventory, tile); return new GuiFermentingBarrel(player.inventory, tile);
// case COAL_GENERATOR: case COAL_GENERATOR:
// return new GuiCoalGenerator(player.inventory, tile); return new GuiCoalGenerator(player.inventory, tile);
// case OIL_GENERATOR: case OIL_GENERATOR:
// return new GuiOilGenerator(player.inventory, tile); return new GuiOilGenerator(player.inventory, tile);
// case PHANTOM_PLACER: case PHANTOM_PLACER:
// return new GuiPhantomPlacer(player.inventory, tile); return new GuiPhantomPlacer(player.inventory, tile);
// case FLUID_COLLECTOR: case FLUID_COLLECTOR:
// return new GuiFluidCollector(player.inventory, tile); return new GuiFluidCollector(player.inventory, tile);
// case COFFEE_MACHINE: case COFFEE_MACHINE:
// return new GuiCoffeeMachine(player.inventory, tile); return new GuiCoffeeMachine(player.inventory, tile);
// case DRILL: case DRILL:
// return new GuiDrill(player.inventory); return new GuiDrill(player.inventory);
// case FILTER: case FILTER:
// return new GuiFilter(player.inventory); return new GuiFilter(player.inventory);
// case ENERGIZER: case ENERGIZER:
// return new GuiEnergizer(player, tile); return new GuiEnergizer(player, tile);
// case ENERVATOR: case ENERVATOR:
// return new GuiEnervator(player, tile); return new GuiEnervator(player, tile);
// case XP_SOLIDIFIER: case XP_SOLIDIFIER:
// return new GuiXPSolidifier(player.inventory, tile); return new GuiXPSolidifier(player.inventory, tile);
// case CLOUD: case CLOUD:
// return new GuiSmileyCloud(tile, x, y, z, world); return new GuiSmileyCloud(tile, x, y, z, world);
// case BOOK: case BOOK:
// if (ItemBooklet.forcedPage != null) { if (ItemBooklet.forcedPage != null) {
// GuiBooklet gui = BookletUtils.createBookletGuiFromPage(null, ItemBooklet.forcedPage); GuiBooklet gui = BookletUtils.createBookletGuiFromPage(null, ItemBooklet.forcedPage);
// ItemBooklet.forcedPage = null; ItemBooklet.forcedPage = null;
// return gui; return gui;
// } else { } else {
// PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
// if (data.lastOpenBooklet != null) { if (data.lastOpenBooklet != null) {
// return data.lastOpenBooklet; return data.lastOpenBooklet;
// } else { } else {
// return new GuiMainPage(null); return new GuiMainPage(null);
// } }
// } }
// case DIRECTIONAL_BREAKER: case DIRECTIONAL_BREAKER:
// return new GuiDirectionalBreaker(player.inventory, tile); return new GuiDirectionalBreaker(player.inventory, tile);
// case RANGED_COLLECTOR: case RANGED_COLLECTOR:
// return new GuiRangedCollector(player.inventory, tile); return new GuiRangedCollector(player.inventory, tile);
// case MINER: case MINER:
// return new GuiMiner(player.inventory, tile); return new GuiMiner(player.inventory, tile);
// case LASER_RELAY_ITEM_WHITELIST: case LASER_RELAY_ITEM_WHITELIST:
// return new GuiLaserRelayItemWhitelist(player.inventory, tile); return new GuiLaserRelayItemWhitelist(player.inventory, tile);
// // case BAG: // case BAG:
// // return new GuiBag(player.getHeldItemMainhand(), player.inventory, false); // return new GuiBag(player.getHeldItemMainhand(), player.inventory, false);
// // case VOID_BAG: // case VOID_BAG:
// // return new GuiBag(player.getHeldItemMainhand(), player.inventory, true); // return new GuiBag(player.getHeldItemMainhand(), player.inventory, true);
// case BIO_REACTOR: case BIO_REACTOR:
// return new GuiBioReactor(player.inventory, tile); return new GuiBioReactor(player.inventory, tile);
// case FARMER: case FARMER:
// return new GuiFarmer(player.inventory, tile); return new GuiFarmer(player.inventory, tile);
// case FIREWORK_BOX: case FIREWORK_BOX:
// return new GuiFireworkBox(tile); return new GuiFireworkBox(tile);
// default: default:
// return null;
return null; return null;
} }
} }
@Deprecated
public enum GuiTypes {
FEEDER,
GIANT_CHEST,
GIANT_CHEST_PAGE_2,
GIANT_CHEST_PAGE_3,
CRAFTER(false),
GRINDER,
GRINDER_DOUBLE,
FURNACE_DOUBLE,
INPUTTER,
REPAIRER,
INPUTTER_ADVANCED,
BREAKER,
DROPPER,
CANOLA_PRESS,
FERMENTING_BARREL,
COAL_GENERATOR,
OIL_GENERATOR,
PHANTOM_PLACER,
FLUID_COLLECTOR,
COFFEE_MACHINE,
DRILL(false),
ENERGIZER,
ENERVATOR,
XP_SOLIDIFIER,
CLOUD,
BOOK(false),
DIRECTIONAL_BREAKER,
RANGED_COLLECTOR,
MINER,
LASER_RELAY_ITEM_WHITELIST,
FILTER(false),
BAG(false),
VOID_BAG(false),
BIO_REACTOR,
FARMER,
FIREWORK_BOX;
public final boolean checkTileEntity;
GuiTypes() {
this(true);
}
GuiTypes(boolean checkTileEntity) {
this.checkTileEntity = checkTileEntity;
}
}
}

View file

@ -171,18 +171,17 @@ public final class ActuallyItems {
public static final RegistryObject<Item> PANTS_QUARTZ = ITEMS.register("pants_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.LEGS)); public static final RegistryObject<Item> PANTS_QUARTZ = ITEMS.register("pants_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.LEGS));
public static final RegistryObject<Item> BOOTS_QUARTZ = ITEMS.register("boots_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.FEET)); public static final RegistryObject<Item> BOOTS_QUARTZ = ITEMS.register("boots_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.FEET));
public static final RegistryObject<Item> PICKAXE_QUARTZ = ITEMS.register("pickaxe_quartz", () -> new ItemPickaxeAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> PICKAXE_QUARTZ = ITEMS.register("pickaxe_quartz", () -> new ItemPickaxeAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> AXE_QUARTZ = ITEMS.register("axe_quartz", () -> new ItemAxeAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> AXE_QUARTZ = ITEMS.register("axe_quartz", () -> new ItemAxeAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", () -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", () -> new ItemShovelAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> SWORD_QUARTZ = ITEMS.register("sword_quartz", () -> new ItemSwordAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> SWORD_QUARTZ = ITEMS.register("sword_quartz", () -> new ItemSwordAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> HOE_QUARTZ = ITEMS.register("hoe_quartz", () -> new ItemHoeAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> HOE_QUARTZ = ITEMS.register("hoe_quartz", () -> new ItemHoeAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> WOODEN_PAXEL = ITEMS.register("wooden_paxel", () -> new ItemAllToolAA(ItemTier.WOOD)); public static final RegistryObject<Item> WOODEN_PAXEL = ITEMS.register("wooden_paxel", () -> new ItemAllToolAA(ItemTier.WOOD));
public static final RegistryObject<Item> STONE_PAXEL = ITEMS.register("stone_paxel", () -> new ItemAllToolAA(ItemTier.STONE)); public static final RegistryObject<Item> STONE_PAXEL = ITEMS.register("stone_paxel", () -> new ItemAllToolAA(ItemTier.STONE));
public static final RegistryObject<Item> IRON_PAXEL = ITEMS.register("iron_paxel", () -> new ItemAllToolAA(ItemTier.IRON)); public static final RegistryObject<Item> IRON_PAXEL = ITEMS.register("iron_paxel", () -> new ItemAllToolAA(ItemTier.IRON));
public static final RegistryObject<Item> GOLD_PAXEL = ITEMS.register("gold_paxel", () -> new ItemAllToolAA(ItemTier.GOLD)); public static final RegistryObject<Item> GOLD_PAXEL = ITEMS.register("gold_paxel", () -> new ItemAllToolAA(ItemTier.GOLD));
public static final RegistryObject<Item> DIAMOND_PAXEL = ITEMS.register("diamond_paxel", () -> new ItemAllToolAA(ItemTier.DIAMOND)); public static final RegistryObject<Item> DIAMOND_PAXEL = ITEMS.register("diamond_paxel", () -> new ItemAllToolAA(ItemTier.DIAMOND));
public static final RegistryObject<Item> NETHERITE_PAXEL = ITEMS.register("netherite_paxel", () -> new ItemAllToolAA(ItemTier.NETHERITE)); public static final RegistryObject<Item> QUARTZ_PAXEL = ITEMS.register("quartz_paxel", () -> new ItemAllToolAA(ToolMaterials.QUARTZ));
public static final RegistryObject<Item> QUARTZ_PAXEL = ITEMS.register("quartz_paxel", () -> new ItemAllToolAA(ToolMaterials.BLACK_QUARTZ));
public static final RegistryObject<Item> PICKAXE_CRYSTAL_RESTONIA = ITEMS.register("pickaxe_crystal_restonia", () -> new ItemPickaxeAA(ToolMaterials.RESTONIA)); public static final RegistryObject<Item> PICKAXE_CRYSTAL_RESTONIA = ITEMS.register("pickaxe_crystal_restonia", () -> new ItemPickaxeAA(ToolMaterials.RESTONIA));
public static final RegistryObject<Item> AXE_CRYSTAL_RESTONIA = ITEMS.register("axe_crystal_restonia", () -> new ItemAxeAA(ToolMaterials.RESTONIA)); public static final RegistryObject<Item> AXE_CRYSTAL_RESTONIA = ITEMS.register("axe_crystal_restonia", () -> new ItemAxeAA(ToolMaterials.RESTONIA));

View file

@ -14,7 +14,14 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.MainWindow; import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
@ -46,30 +53,30 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
@Override @Override
public ActionResultType useOn(ItemUseContext context) { public ActionResultType useOn(ItemUseContext context) {
// if (context.getPlayer().isShiftKeyDown()) { if (context.getPlayer().isShiftKeyDown()) {
// BlockState state = context.getLevel().getBlockState(context.getClickedPos()); BlockState state = context.getLevel().getBlockState(context.getClickedPos());
// Block block = state.getBlock(); Block block = state.getBlock();
// ItemStack blockStack = new ItemStack(block); ItemStack blockStack = new ItemStack(block);
// IBookletPage page = BookletUtils.findFirstPageForStack(blockStack); IBookletPage page = BookletUtils.findFirstPageForStack(blockStack);
// if (page != null) { if (page != null) {
// if (context.getLevel().isClientSide) { if (context.getLevel().isClientSide) {
// forcedPage = page; forcedPage = page;
// } }
// this.use(context.getLevel(), context.getPlayer(), context.getHand()); this.use(context.getLevel(), context.getPlayer(), context.getHand());
// return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
// } }
// } }
return ActionResultType.FAIL; return ActionResultType.FAIL;
} }
@Override @Override
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
//
// if (!world.isClientSide) { if (!world.isClientSide) {
// //TheAchievements.OPEN_BOOKLET.get(player); //TheAchievements.OPEN_BOOKLET.get(player);
// //TheAchievements.OPEN_BOOKLET_MILESTONE.get(player); //TheAchievements.OPEN_BOOKLET_MILESTONE.get(player);
// } }
return ActionResult.success(player.getItemInHand(hand)); return ActionResult.success(player.getItemInHand(hand));
} }
@ -90,36 +97,36 @@ public class ItemBooklet extends ItemBase implements IHudDisplay {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) {
// if (rayCast != null && rayCast.getBlockPos() != null) { if (rayCast != null && rayCast.getBlockPos() != null) {
// BlockState state = minecraft.level.getBlockState(rayCast.getBlockPos()); BlockState state = minecraft.level.getBlockState(rayCast.getBlockPos());
// Block block = state.getBlock(); Block block = state.getBlock();
// if (block != null && !block.isAir(minecraft.level.getBlockState(rayCast.getBlockPos()), minecraft.level, rayCast.getBlockPos())) { if (block != null && !block.isAir(minecraft.level.getBlockState(rayCast.getBlockPos()), minecraft.level, rayCast.getBlockPos())) {
// ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state)); ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
// int height = resolution.getGuiScaledHeight() / 5 * 3; int height = resolution.getGuiScaledHeight() / 5 * 3;
// if (player.isShiftKeyDown()) { if (player.isShiftKeyDown()) {
// IBookletPage page = BookletUtils.findFirstPageForStack(blockStack); IBookletPage page = BookletUtils.findFirstPageForStack(blockStack);
// if (page != null) { if (page != null) {
// String strg1 = page.getChapter().getLocalizedName(); String strg1 = page.getChapter().getLocalizedName();
// String strg2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.page") + " " + (page.getChapter().getPageIndex(page) + 1); String strg2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.page") + " " + (page.getChapter().getPageIndex(page) + 1);
// String strg3 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.open"); String strg3 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.open");
//
// AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack()) AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack())
// ? page.getChapter().getDisplayItemStack() ? page.getChapter().getDisplayItemStack()
// : new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), resolution.getGuiScaledWidth() / 2 - 10, height + 41, 1F); : new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), resolution.getGuiScaledWidth() / 2 - 10, height + 41, 1F);
// minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE);
// minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE);
// minecraft.font.drawShadow(TextFormatting.GOLD + strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(TextFormatting.GOLD + strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE);
// } else { } else {
// String strg1 = TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo"); String strg1 = TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo");
// String strg2 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.1"); String strg2 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.1");
// String strg3 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.2"); String strg3 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.2");
//
// minecraft.font.drawShadow(strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE);
// minecraft.font.drawShadow(strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 50, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 50, StringUtil.DECIMAL_COLOR_WHITE);
// minecraft.font.drawShadow(strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); minecraft.font.drawShadow(strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE);
// } }
// } }
// } }
// } }
} }
} }

View file

@ -1,82 +1,82 @@
///* /*
// * This file ("ItemCrystalShard.java") is part of the Actually Additions mod for Minecraft. * This file ("ItemCrystalShard.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystal; import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystal;
//import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
//import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
//import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
//import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
//import net.minecraftforge.common.IRarity; import net.minecraftforge.common.IRarity;
//
//
//public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { public class ItemCrystalShard extends ItemBase implements IColorProvidingItem {
//
// public ItemCrystalShard() { public ItemCrystalShard() {
// super(name); super(name);
// this.setHasSubtypes(true); this.setHasSubtypes(true);
// this.setMaxDamage(0); this.setMaxDamage(0);
// } }
//
// @Override @Override
// public int getMetadata(int damage) { public int getMetadata(int damage) {
// return damage; return damage;
// } }
//
// @Override @Override
// public String getDescriptionId(ItemStack stack) { public String getDescriptionId(ItemStack stack) {
// return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length
// ? StringUtil.BUGGED_ITEM_NAME ? StringUtil.BUGGED_ITEM_NAME
// : this.getDescriptionId() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; : this.getDescriptionId() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
// } }
//
// @Override @Override
// public IRarity getForgeRarity(ItemStack stack) { public IRarity getForgeRarity(ItemStack stack) {
// return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length
// ? EnumRarity.COMMON ? EnumRarity.COMMON
// : BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity; : BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity;
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) { public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
// if (this.isInCreativeTab(tab)) { if (this.isInCreativeTab(tab)) {
// for (int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++) { for (int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++) {
// list.add(new ItemStack(this, 1, j)); list.add(new ItemStack(this, 1, j));
// } }
// } }
// } }
//
// @Override @Override
// protected void registerRendering() { protected void registerRendering() {
// for (int i = 0; i < BlockCrystal.ALL_CRYSTALS.length; i++) { for (int i = 0; i < BlockCrystal.ALL_CRYSTALS.length; i++) {
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory"); ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory");
// } }
// } }
//
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public IItemColor getItemColor() { public IItemColor getItemColor() {
// return (stack, tintIndex) -> { return (stack, tintIndex) -> {
// int damage = stack.getItemDamage(); int damage = stack.getItemDamage();
// if (damage >= 0 && damage < BlockCrystal.ALL_CRYSTALS.length) { if (damage >= 0 && damage < BlockCrystal.ALL_CRYSTALS.length) {
// return BlockCrystal.ALL_CRYSTALS[damage].clusterColor; return BlockCrystal.ALL_CRYSTALS[damage].clusterColor;
// } else { } else {
// return 0; return 0;
// } }
// }; };
// } }
//} }

View file

@ -14,6 +14,7 @@ import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
@ -25,13 +26,11 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.Attributes; import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
@ -39,14 +38,18 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ItemDrill extends ItemEnergy { public class ItemDrill extends ItemEnergy {
@ -54,7 +57,10 @@ public class ItemDrill extends ItemEnergy {
private static final int ENERGY_USE = 100; private static final int ENERGY_USE = 100;
public ItemDrill() { public ItemDrill() {
super(ActuallyItems.defaultProps().defaultDurability(0).stacksTo(1).addToolType(ToolType.SHOVEL, HARVEST_LEVEL).addToolType(ToolType.PICKAXE, HARVEST_LEVEL), 250000, 1000); super(ActuallyItems.defaultProps().defaultDurability(0).stacksTo(1), 250000, 1000);
this.setHasSubtypes(true);
this.setHarvestLevel("shovel", HARVEST_LEVEL);
this.setHarvestLevel("pickaxe", HARVEST_LEVEL);
} }
/** /**
@ -147,21 +153,25 @@ public class ItemDrill extends ItemEnergy {
@Override @Override
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (!world.isClientSide && player.isShiftKeyDown() && hand == Hand.MAIN_HAND) { if (!world.isClientSide && player.isShiftKeyDown() && hand == Hand.MAIN_HAND) {
player.openMenu(new SimpleNamedContainerProvider((id, inv, p) -> new ContainerDrill(id, inv), new StringTextComponent(""))); player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
} }
return new ActionResult<>(ActionResultType.PASS, player.getItemInHand(hand)); return new ActionResult<>(ActionResultType.PASS, player.getItemInHand(hand));
} }
@Override @Override
public ActionResultType interactLivingEntity(ItemStack stack, PlayerEntity player, LivingEntity entityHit, Hand hand) { public int getMetadata(int damage) {
return damage;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2) {
int use = this.getEnergyUsePerBlock(stack); int use = this.getEnergyUsePerBlock(stack);
if (!(entityHit instanceof PlayerEntity) || !((PlayerEntity) entityHit).isCreative()) { if (!(entity2 instanceof PlayerEntity) || !((PlayerEntity) entity2).isCreative()) {
if (this.getEnergyStored(stack) >= use) { if (this.getEnergyStored(stack) >= use) {
this.extractEnergyInternal(stack, use, false); this.extractEnergyInternal(stack, use, false);
} }
} }
return ActionResultType.SUCCESS; return true;
} }
@Override @Override
@ -182,7 +192,7 @@ public class ItemDrill extends ItemEnergy {
@Override @Override
public float getDestroySpeed(ItemStack stack, BlockState state) { public float getDestroySpeed(ItemStack stack, BlockState state) {
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack)
? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state) == ToolType.PICKAXE || state.getBlock().getHarvestTool(state) == ToolType.SHOVEL) ? this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state) || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state))
? this.getEfficiencyFromUpgrade(stack) ? this.getEfficiencyFromUpgrade(stack)
: 1.0F : 1.0F
: 0.1F; : 0.1F;
@ -230,7 +240,7 @@ public class ItemDrill extends ItemEnergy {
@Override @Override
public boolean canHarvestBlock(ItemStack stack, BlockState state) { public boolean canHarvestBlock(ItemStack stack, BlockState state) {
Block block = state.getBlock(); Block block = state.getBlock();
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isReplaceable() || block == Blocks.SNOW_BLOCK || block == Blocks.SNOW || (block == Blocks.OBSIDIAN return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN
? HARVEST_LEVEL >= 3 ? HARVEST_LEVEL >= 3
: block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE : block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE
? block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK
@ -247,6 +257,14 @@ public class ItemDrill extends ItemEnergy {
: HARVEST_LEVEL >= 2)); : HARVEST_LEVEL >= 2));
} }
@Override
public Set<String> getToolClasses(ItemStack stack) {
HashSet<String> hashSet = new HashSet<>();
hashSet.add("pickaxe");
hashSet.add("shovel");
return hashSet;
}
@Override @Override
public int getHarvestLevel(ItemStack stack, ToolType p_getHarvestLevel_2_, @Nullable PlayerEntity p_getHarvestLevel_3_, @Nullable BlockState p_getHarvestLevel_4_) { public int getHarvestLevel(ItemStack stack, ToolType p_getHarvestLevel_2_, @Nullable PlayerEntity p_getHarvestLevel_3_, @Nullable BlockState p_getHarvestLevel_4_) {
return HARVEST_LEVEL; return HARVEST_LEVEL;
@ -307,25 +325,25 @@ public class ItemDrill extends ItemEnergy {
return StackUtil.isValid(this.getHasUpgradeAsStack(stack, upgrade)); return StackUtil.isValid(this.getHasUpgradeAsStack(stack, upgrade));
} }
// @Override @Override
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list) { public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list) {
// if (this.isInCreativeTab(tabs)) { if (this.isInCreativeTab(tabs)) {
// for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
// this.addDrillStack(list, i); this.addDrillStack(list, i);
// } }
// } }
// } }
// private void addDrillStack(List<ItemStack> list, int meta) { private void addDrillStack(List<ItemStack> list, int meta) {
// ItemStack stackFull = new ItemStack(this, 1, meta); ItemStack stackFull = new ItemStack(this, 1, meta);
// this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull)); this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
// list.add(stackFull); list.add(stackFull);
//
// ItemStack stackEmpty = new ItemStack(this, 1, meta); ItemStack stackEmpty = new ItemStack(this, 1, meta);
// this.setEnergy(stackEmpty, 0); this.setEnergy(stackEmpty, 0);
// list.add(stackEmpty); list.add(stackEmpty);
// } }
/** /**
* Gets the Mining Speed of the Drill * Gets the Mining Speed of the Drill

View file

@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -45,7 +44,7 @@ public class ItemDust extends ItemBase implements IColorProvidingItem {
} }
@Override @Override
public Rarity getRarity(ItemStack stack) { public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_DUSTS.length return stack.getItemDamage() >= ALL_DUSTS.length
? EnumRarity.COMMON ? EnumRarity.COMMON
: ALL_DUSTS[stack.getItemDamage()].rarity; : ALL_DUSTS[stack.getItemDamage()].rarity;

View file

@ -18,8 +18,9 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -98,9 +99,9 @@ public class ItemFoods extends ItemFoodBase {
} }
@Override @Override
public Rarity getRarity(ItemStack stack) { public EnumRarity getRarity(ItemStack stack) {
return stack.getItemDamage() >= ALL_FOODS.length return stack.getItemDamage() >= ALL_FOODS.length
? Rarity.COMMON ? EnumRarity.COMMON
: ALL_FOODS[stack.getItemDamage()].rarity; : ALL_FOODS[stack.getItemDamage()].rarity;
} }

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm; import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
@ -52,7 +51,7 @@ public class ItemWorm extends ItemBase {
List<EntityWorm> worms = context.getLevel().getEntitiesOfClass(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); List<EntityWorm> worms = context.getLevel().getEntitiesOfClass(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2));
if (worms.isEmpty()) { if (worms.isEmpty()) {
if (!context.getLevel().isClientSide) { if (!context.getLevel().isClientSide) {
EntityWorm worm = new EntityWorm(ActuallyAdditions.ENTITY_WORM.get(), context.getLevel()); EntityWorm worm = new EntityWorm(context.getLevel());
worm.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); worm.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
worm.setCustomName(stack.getHoverName()); // TODO: WHAT DOES THIS EVEN DO? worm.setCustomName(stack.getHoverName()); // TODO: WHAT DOES THIS EVEN DO?
context.getLevel().addFreshEntity(worm); context.getLevel().addFreshEntity(worm);

View file

@ -11,13 +11,12 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.IItemTier; import net.minecraft.item.*;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolItem;
import net.minecraft.tags.ITag; import net.minecraft.tags.ITag;
import java.util.Set; import java.util.Set;
@ -29,31 +28,22 @@ public class ItemToolAA extends ToolItem implements IDisableableItem {
private final ITag<Item> repairTag; private final ITag<Item> repairTag;
private final boolean disabled; private final boolean disabled;
public ItemToolAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set<Block> p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag<Item> repairTag) { public ItemToolAA(float attack, float speed, IItemTier toolMat, String repairItem, String unlocalizedName, Rarity rarity, Set<Block> effectiveStuff) {
super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_); this(attack, speed, toolMat, ItemStack.EMPTY, unlocalizedName, rarity, effectiveStuff);
this.repairOredict = repairItem;
this.name = name;
this.repairItem = repairItem;
this.repairTag = repairTag;
this.disabled = false;
} }
// public ItemToolAA(float attack, float speed, IItemTier toolMat, String repairItem, String unlocalizedName, Rarity rarity, Set<Block> effectiveStuff) { public ItemToolAA(float attack, float speed, ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, IRarity rarity, Set<Block> effectiveStuff) {
// this(attack, speed, toolMat, ItemStack.EMPTY, unlocalizedName, rarity, effectiveStuff); super(attack, speed, toolMat, effectiveStuff);
// this.repairOredict = repairItem;
// }
// public ItemToolAA(float attack, float speed, ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, Rarity rarity, Set<Block> effectiveStuff) { this.repairItem = repairItem;
// super(attack, speed, toolMat, effectiveStuff); this.name = unlocalizedName;
// this.rarity = rarity;
// this.repairItem = repairItem; this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(unlocalizedName), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(unlocalizedName) + ". It will not be registered.");
// this.name = unlocalizedName; if (!this.disabled) {
// this.rarity = rarity; this.register();
//// this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(unlocalizedName), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(unlocalizedName) + ". It will not be registered."); }
//// if (!this.disabled) { }
//// this.register();
//// }
// }
private void register() { private void register() {
} }

View file

@ -13,7 +13,7 @@ import java.util.function.Supplier;
* todo: review to ensure all values act as intended * todo: review to ensure all values act as intended
*/ */
public enum ToolMaterials implements IItemTier { public enum ToolMaterials implements IItemTier {
BLACK_QUARTZ(2, 280, 6.5f, 2.0f, 10, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())), QUARTZ(2, 280, 6.5f, 2.0f, 10, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())),
RESTONIA(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())), RESTONIA(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())),
PALIS(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())), PALIS(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())),
DIAMATINE(3, 1600, 9.0f, 4.0f, 14, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())), DIAMATINE(3, 1600, 9.0f, 4.0f, 14, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())),

View file

@ -20,6 +20,12 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay; import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace;
import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTextOnly;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
@ -33,8 +39,8 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Potion;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -106,7 +112,7 @@ public class MethodHandler implements IMethodHandler {
public void addEffectToStack(ItemStack stack, EffectInstance effect) { public void addEffectToStack(ItemStack stack, EffectInstance effect) {
CompoundNBT tag = stack.getOrCreateTag(); CompoundNBT tag = stack.getOrCreateTag();
int prevCounter = tag.getInt("Counter"); int prevCounter = tag.putInt("Counter");
CompoundNBT compound = new CompoundNBT(); CompoundNBT compound = new CompoundNBT();
//compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); //TODO ?! //compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); //TODO ?!
compound.putInt("Duration", effect.getDuration()); compound.putInt("Duration", effect.getDuration());
@ -126,7 +132,7 @@ public class MethodHandler implements IMethodHandler {
int counter = tag.getInt("Counter"); int counter = tag.getInt("Counter");
while (counter > 0) { while (counter > 0) {
CompoundNBT compound = (CompoundNBT) tag.get(counter + ""); CompoundNBT compound = (CompoundNBT) tag.get(counter + "");
EffectInstance effect = new EffectInstance(Effect.byId(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier")); EffectInstance effect = new EffectInstance(Potion.getPotionById(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier"));
effects.add(effect); effects.add(effect);
counter--; counter--;
} }

View file

@ -1,56 +1,56 @@
//package de.ellpeck.actuallyadditions.mod.recipe; package de.ellpeck.actuallyadditions.mod.recipe;
//
//import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
//import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
//import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
//import net.minecraft.item.DyeColor; import net.minecraft.item.DyeColor;
//import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
//
//import java.util.HashMap; import java.util.HashMap;
//import java.util.List; import java.util.List;
//import java.util.Map; import java.util.Map;
//
//public class ColorLensRotator implements IColorLensChanger { public class ColorLensRotator implements IColorLensChanger {
//
// public static final Map<String, DyeColor> STRING_TO_ENUM = new HashMap<>(); public static final Map<String, DyeColor> STRING_TO_ENUM = new HashMap<>();
//
// static { static {
// String[] dyes = {"White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "Gray", "LightGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"}; String[] dyes = {"White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "Gray", "LightGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"};
// for (int i = 0; i < dyes.length; i++) { for (int i = 0; i < dyes.length; i++) {
// STRING_TO_ENUM.put("dye" + dyes[i], DyeColor.byMetadata(i)); STRING_TO_ENUM.put("dye" + dyes[i], DyeColor.byMetadata(i));
// } }
// } }
//
// final List<ItemStack> rotations; final List<ItemStack> rotations;
//
// public ColorLensRotator(List<ItemStack> rotations) { public ColorLensRotator(List<ItemStack> rotations) {
// this.rotations = rotations; this.rotations = rotations;
// } }
//
// @Override @Override
// public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
//
// int idx = -1; int idx = -1;
//
// for (int i : OreDictionary.getOreIDs(stack)) { for (int i : OreDictionary.getOreIDs(stack)) {
// String s = OreDictionary.getOreName(i); String s = OreDictionary.getOreName(i);
// if (s.startsWith("dye")) { if (s.startsWith("dye")) {
// DyeColor color = STRING_TO_ENUM.get(s); DyeColor color = STRING_TO_ENUM.get(s);
// if (color != null) { if (color != null) {
// idx = color.getMetadata(); idx = color.getMetadata();
// break; break;
// } }
// } }
// } }
//
// if (idx == -1) { if (idx == -1) {
// return ItemStack.EMPTY; return ItemStack.EMPTY;
// } }
//
// ItemStack s = this.rotations.get((idx + 1) % this.rotations.size()).copy(); ItemStack s = this.rotations.get((idx + 1) % this.rotations.size()).copy();
// s.setCount(stack.getCount()); s.setCount(stack.getCount());
// return s; return s;
// } }
//
//} }

View file

@ -187,7 +187,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) { public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) {
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
CrushingRecipe recipe = null;//CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); //TODO CrushingRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));
if (recipe == null) { if (recipe == null) {
return false; return false;
} }
@ -202,7 +202,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
outputTwo.setDamage(0); outputTwo.setDamage(0);
} }
*/ */
if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).sameItem(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) {
return true; return true;
} }
} }
@ -217,7 +217,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
} }
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) { public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) {
CrushingRecipe recipe = null; //CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));//TODO CrushingRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));
if (recipe == null) { if (recipe == null) {
return; return;
} }
@ -242,7 +242,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
outputTwo.setDamage(0); outputTwo.setDamage(0);
} }
*/ */
float rand = this.level.random.nextFloat(); int rand = this.level.random.nextInt(100) + 1;
if (rand <= recipe.getSecondChance()) { if (rand <= recipe.getSecondChance()) {
if (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput))) { if (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput))) {
this.inv.setStackInSlot(theSecondOutput, outputTwo.copy()); this.inv.setStackInSlot(theSecondOutput, outputTwo.copy());

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
@ -30,6 +29,8 @@ import net.minecraftforge.energy.IEnergyStorage;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityEnergizer extends TileEntityInventoryBase implements INamedContainerProvider { public class TileEntityEnergizer extends TileEntityInventoryBase implements INamedContainerProvider {
public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000, 0); public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000, 0);
@ -37,7 +38,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements INam
private int lastEnergy; private int lastEnergy;
public TileEntityEnergizer() { public TileEntityEnergizer() {
super(ActuallyBlocks.ENERGIZER.getTileEntityType(), 2); super(ActuallyTiles.ENERGIZER_TILE.get(), 2);
} }
@Override @Override

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -42,6 +41,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider { public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider {
private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>(); private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>();
@ -54,7 +55,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
private int lastEnergy; private int lastEnergy;
public TileEntityFarmer() { public TileEntityFarmer() {
super(ActuallyBlocks.FARMER.getTileEntityType(), 12); super(ActuallyTiles.FARMER_TILE.get(), 12);
} }
@Override @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.AnimalEntity;
@ -33,6 +32,8 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityFeeder extends TileEntityInventoryBase implements INamedContainerProvider { public class TileEntityFeeder extends TileEntityInventoryBase implements INamedContainerProvider {
public static final int THRESHOLD = 30; public static final int THRESHOLD = 30;
@ -43,7 +44,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC
private int lastTimer; private int lastTimer;
public TileEntityFeeder() { public TileEntityFeeder() {
super(ActuallyBlocks.FEEDER.getTileEntityType(), 1); super(ActuallyTiles.FEEDER_TILE.get(), 1);
} }
public int getCurrentTimerToScale(int i) { public int getCurrentTimerToScale(int i) {

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox;
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -37,6 +36,8 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, INamedContainerProvider { public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, INamedContainerProvider {
public static final int USE_PER_SHOT = 500; public static final int USE_PER_SHOT = 500;
@ -58,7 +59,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
private int oldEnergy; private int oldEnergy;
public TileEntityFireworkBox() { public TileEntityFireworkBox() {
super(ActuallyBlocks.FIREWORK_BOX.getTileEntityType()); super(ActuallyTiles.FIREWORKBOX_TILE.get());
} }
@Override @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -42,6 +41,9 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
public boolean isPlacer; public boolean isPlacer;
@ -82,7 +84,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
} }
public TileEntityFluidCollector() { public TileEntityFluidCollector() {
this(ActuallyBlocks.FLUID_COLLECTOR.getTileEntityType()); this(ActuallyTiles.FLUIDCOLLECTOR_TILE.get());
this.isPlacer = false; this.isPlacer = false;
} }

View file

@ -10,12 +10,10 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
public class TileEntityFluidPlacer extends TileEntityFluidCollector { public class TileEntityFluidPlacer extends TileEntityFluidCollector {
public TileEntityFluidPlacer() { public TileEntityFluidPlacer() {
super(ActuallyBlocks.FLUID_PLACER.getTileEntityType()); super(ActuallyTiles.FLUIDPLACER_TILE.get());
this.isPlacer = true; this.isPlacer = true;
} }

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -26,6 +25,8 @@ import net.minecraftforge.energy.IEnergyStorage;
import java.util.ArrayList; import java.util.ArrayList;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityHeatCollector extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public class TileEntityHeatCollector extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
public static final int ENERGY_PRODUCE = 40; public static final int ENERGY_PRODUCE = 40;
@ -36,7 +37,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE
private int disappearTime; private int disappearTime;
public TileEntityHeatCollector() { public TileEntityHeatCollector() {
super(ActuallyBlocks.HEAT_COLLECTOR.getTileEntityType()); super(ActuallyTiles.HEATCOLLECTOR_TILE.get());
} }
@Override @Override

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -67,9 +66,9 @@ public class TileEntityItemInterface extends TileEntityBase {
IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot); IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot);
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stack, false)) { if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stack, false)) {
ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate); ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate);
if (!ItemStack.isSame(remain, stack) && !simulate) { if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
TileEntityItemInterface.this.setChanged(); TileEntityItemInterface.this.markDirty();
TileEntityItemInterface.this.doItemParticle(stack, info.relayInQuestion.getBlockPos(), TileEntityItemInterface.this.connectedRelay.getBlockPos()); TileEntityItemInterface.this.doItemParticle(stack, info.relayInQuestion.getPos(), TileEntityItemInterface.this.connectedRelay.getPos());
} }
return remain; return remain;
} }
@ -84,8 +83,8 @@ public class TileEntityItemInterface extends TileEntityBase {
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stackIn, true)) { if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stackIn, true)) {
ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate); ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate);
if (StackUtil.isValid(extracted) && !simulate) { if (StackUtil.isValid(extracted) && !simulate) {
TileEntityItemInterface.this.setChanged(); TileEntityItemInterface.this.markDirty();
TileEntityItemInterface.this.doItemParticle(extracted, TileEntityItemInterface.this.connectedRelay.getBlockPos(), info.relayInQuestion.getBlockPos()); TileEntityItemInterface.this.doItemParticle(extracted, TileEntityItemInterface.this.connectedRelay.getPos(), info.relayInQuestion.getPos());
} }
return extracted; return extracted;
} }
@ -119,7 +118,7 @@ public class TileEntityItemInterface extends TileEntityBase {
} }
public TileEntityItemInterface() { public TileEntityItemInterface() {
this(ActuallyBlocks.ITEM_INTERFACE.getTileEntityType()); this(ActuallyTiles.ITEMVIEWER_TILE.get());
} }
@Override @Override
@ -154,9 +153,9 @@ public class TileEntityItemInterface extends TileEntityBase {
} }
public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) { public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) {
if (!this.level.isClientSide) { if (!this.world.isRemote) {
CompoundNBT compound = new CompoundNBT(); CompoundNBT compound = new CompoundNBT();
stack.save(compound); stack.write(compound);
compound.putDouble("InX", input.getX()); compound.putDouble("InX", input.getX());
compound.putDouble("InY", input.getY()); compound.putDouble("InY", input.getY());
@ -167,9 +166,9 @@ public class TileEntityItemInterface extends TileEntityBase {
compound.putDouble("OutZ", output.getZ()); compound.putDouble("OutZ", output.getZ());
int rangeSq = 16 * 16; int rangeSq = 16 * 16;
for (PlayerEntity player : this.level.players()) { for (PlayerEntity player : this.world.getPlayers()) {
if (player instanceof ServerPlayerEntity) { if (player instanceof ServerPlayerEntity) {
if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) { if (player.getDistanceSq(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.getDistanceSq(output.getX(), output.getY(), output.getZ()) <= rangeSq) {
PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player); PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player);
} }
} }
@ -250,13 +249,13 @@ public class TileEntityItemInterface extends TileEntityBase {
@Override @Override
public void saveDataOnChangeOrWorldStart() { public void saveDataOnChangeOrWorldStart() {
TileEntityLaserRelayItem tileFound = null; TileEntityLaserRelayItem tileFound = null;
if (this.level != null) { //Why is that even possible..? if (this.world != null) { //Why is that even possible..?
for (int i = 0; i <= 5; i++) { for (int i = 0; i <= 5; i++) {
Direction side = WorldUtil.getDirectionBySidesInOrder(i); Direction side = WorldUtil.getDirectionBySidesInOrder(i);
BlockPos pos = this.getBlockPos().relative(side); BlockPos pos = this.getPos().offset(side);
if (this.level.isLoaded(pos)) { if (this.world.isBlockLoaded(pos)) {
TileEntity tile = this.level.getBlockEntity(pos); TileEntity tile = this.world.getTileEntity(pos);
if (tile instanceof TileEntityLaserRelayItem) { if (tile instanceof TileEntityLaserRelayItem) {
if (tileFound != null) { if (tileFound != null) {
@ -313,7 +312,7 @@ public class TileEntityItemInterface extends TileEntityBase {
} }
public boolean isLoaded() { public boolean isLoaded() {
return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().isLoaded(this.relayInQuestion.getBlockPos()); return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos());
} }
} }
@ -327,7 +326,7 @@ public class TileEntityItemInterface extends TileEntityBase {
} }
public boolean isLoaded() { public boolean isLoaded() {
return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().isLoaded(this.relayInQuestion.getBlockPos()); return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos());
} }
@Override @Override

View file

@ -11,18 +11,15 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.EntityPredicates;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -37,7 +34,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
private SlotlessableItemHandlerWrapper handlerToPushTo; private SlotlessableItemHandlerWrapper handlerToPushTo;
public TileEntityItemInterfaceHopping() { public TileEntityItemInterfaceHopping() {
super(ActuallyBlocks.ITEM_INTERFACE_HOPPING.getTileEntityType()); super(ActuallyTiles.ITEMVIEWERHOPPING_TILE.get());
} }
@Override @Override
@ -45,14 +42,12 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
super.updateEntity(); super.updateEntity();
// TODO: [port] validate this is the correct way to get total game time getGameTime // TODO: [port] validate this is the correct way to get total game time getGameTime
if (!this.level.isClientSide && this.level.getLevelData().getGameTime() % 10 == 0) { if (!this.world.isRemote && this.world.getWorldInfo().getGameTime() % 10 == 0) {
if (this.handlerToPullFrom != null) { if (this.handlerToPullFrom != null) {
WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4); WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4);
} else { } else {
if (this.level.getLevelData().getGameTime() % 20 == 0) { if (this.world.getWorldInfo().getGameTime() % 20 == 0) {
//TODO hmm? List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(), this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1));
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(this.getBlockPos().getX(), this.getBlockPos().getY() + 0.5, this.getBlockPos().getZ(), this.getBlockPos().getX() + 1, this.getBlockPos().getY() + 2, this.getBlockPos().getZ() + 1);
List<ItemEntity> items = this.level.getEntities(EntityType.ITEM, axisAlignedBB, EntityPredicates.ENTITY_STILL_ALIVE);
if (items != null && !items.isEmpty()) { if (items != null && !items.isEmpty()) {
for (ItemEntity item : items) { for (ItemEntity item : items) {
if (item != null && item.isAlive()) { if (item != null && item.isAlive()) {
@ -101,7 +96,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
this.handlerToPullFrom = null; this.handlerToPullFrom = null;
this.handlerToPushTo = null; this.handlerToPushTo = null;
TileEntity from = this.level.getBlockEntity(this.getBlockPos().relative(Direction.UP)); TileEntity from = this.world.getTileEntity(this.pos.offset(Direction.UP));
if (from != null && !(from instanceof TileEntityItemInterface)) { if (from != null && !(from instanceof TileEntityItemInterface)) {
LazyOptional<IItemHandler> normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); LazyOptional<IItemHandler> normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN);
@ -117,12 +112,12 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless); this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless);
} }
BlockState state = this.level.getBlockState(this.getBlockPos()); BlockState state = this.world.getBlockState(this.pos);
Direction facing = state.getValue(BlockStateProperties.FACING); Direction facing = state.get(BlockStateProperties.FACING);
BlockPos toPos = this.getBlockPos().relative(facing); BlockPos toPos = this.pos.offset(facing);
if (this.level.isLoaded(toPos)) { if (this.world.isBlockLoaded(toPos)) {
TileEntity to = this.level.getBlockEntity(toPos); TileEntity to = this.world.getTileEntity(toPos);
if (to != null && !(to instanceof TileEntityItemInterface)) { if (to != null && !(to instanceof TileEntityItemInterface)) {
LazyOptional<IItemHandler> normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); LazyOptional<IItemHandler> normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite());

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.LaserType;
import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
@ -37,6 +36,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay {
public static final int CAP = 1000; public static final int CAP = 1000;
@ -84,7 +85,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay {
} }
public TileEntityLaserRelayEnergy() { public TileEntityLaserRelayEnergy() {
this(ActuallyBlocks.LASER_RELAY.getTileEntityType()); this(ActuallyTiles.LASERRELAYENERGY_TILE.get());
} }
private int transmitEnergy(Direction from, int maxTransmit, boolean simulate) { private int transmitEnergy(Direction from, int maxTransmit, boolean simulate) {

View file

@ -10,14 +10,12 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
public class TileEntityLaserRelayEnergyAdvanced extends TileEntityLaserRelayEnergy { public class TileEntityLaserRelayEnergyAdvanced extends TileEntityLaserRelayEnergy {
public static final int CAP = 10000; public static final int CAP = 10000;
public TileEntityLaserRelayEnergyAdvanced() { public TileEntityLaserRelayEnergyAdvanced() {
super(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType()); super(ActuallyTiles.LASERRELAYENERGYADVANCED_TILE.get());
} }
@Override @Override

View file

@ -10,14 +10,12 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
public class TileEntityLaserRelayEnergyExtreme extends TileEntityLaserRelayEnergy { public class TileEntityLaserRelayEnergyExtreme extends TileEntityLaserRelayEnergy {
public static final int CAP = 100000; public static final int CAP = 100000;
public TileEntityLaserRelayEnergyExtreme() { public TileEntityLaserRelayEnergyExtreme() {
super(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType()); super(ActuallyTiles.LASERRELAYENERGYEXTREME_TILE.get());
} }
@Override @Override

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.LaserType;
import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy.Mode; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy.Mode;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -38,6 +37,9 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { public class TileEntityLaserRelayFluids extends TileEntityLaserRelay {
public final ConcurrentHashMap<Direction, TileEntity> handlersAround = new ConcurrentHashMap<>(); public final ConcurrentHashMap<Direction, TileEntity> handlersAround = new ConcurrentHashMap<>();
@ -45,7 +47,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay {
private Mode mode = Mode.BOTH; private Mode mode = Mode.BOTH;
public TileEntityLaserRelayFluids() { public TileEntityLaserRelayFluids() {
super(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), LaserType.FLUID); super(ActuallyTiles.LASERRELAYFLUIDS_TILE.get(), LaserType.FLUID);
for (int i = 0; i < this.fluidHandlers.length; i++) { for (int i = 0; i < this.fluidHandlers.length; i++) {
Direction facing = Direction.values()[i]; Direction facing = Direction.values()[i];

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.LaserType;
import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface.GenericItemHandlerInfo; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface.GenericItemHandlerInfo;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -36,6 +35,8 @@ import net.minecraftforge.items.IItemHandler;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityLaserRelayItem extends TileEntityLaserRelay { public class TileEntityLaserRelayItem extends TileEntityLaserRelay {
public final Map<BlockPos, SlotlessableItemHandlerWrapper> handlersAround = new ConcurrentHashMap<>(); public final Map<BlockPos, SlotlessableItemHandlerWrapper> handlersAround = new ConcurrentHashMap<>();
@ -46,7 +47,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay {
} }
public TileEntityLaserRelayItem() { public TileEntityLaserRelayItem() {
this(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType()); this(ActuallyTiles.LASERRELAYITEM_TILE.get());
} }
public int getPriority() { public int getPriority() {
@ -73,7 +74,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay {
BlockPos pos = this.getBlockPos().relative(side); BlockPos pos = this.getBlockPos().relative(side);
if (this.level.hasChunkAt(pos)) { if (this.level.hasChunkAt(pos)) {
TileEntity tile = this.level.getBlockEntity(pos); TileEntity tile = this.level.getBlockEntity(pos);
if (tile != null && !(tile instanceof TileEntityItemInterface) && !(tile instanceof TileEntityLaserRelay)) { if (tile != null && !(tile instanceof TileEntityItemViewer) && !(tile instanceof TileEntityLaserRelay)) {
LazyOptional<IItemHandler> itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); LazyOptional<IItemHandler> itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite());
Object slotlessHandler = null; Object slotlessHandler = null;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
@ -36,7 +35,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i
public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000); public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000);
public TileEntityLaserRelayItemAdvanced() { public TileEntityLaserRelayItemAdvanced() {
super(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType()); super(ActuallyTiles.LASERRELAYITEMWHITELIST_TILE.get());
} }
@Override @Override
@ -132,7 +131,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
if (!this.level.isClientSide) { if (!this.world.isRemote) {
if ((this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) { if ((this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) {
this.leftFilter.updateLasts(); this.leftFilter.updateLasts();
this.rightFilter.updateLasts(); this.rightFilter.updateLasts();

View file

@ -21,6 +21,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyDisplay { public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyDisplay {
public static final int NOT_MULTI = 0; public static final int NOT_MULTI = 0;
@ -34,7 +36,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
private int oldEnergy; private int oldEnergy;
public TileEntityLavaFactoryController() { public TileEntityLavaFactoryController() {
super(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.getTileEntityType()); super(ActuallyTiles.LAVAFACTORYCONTROLLER_TILE.get());
} }
@Override @Override
@ -80,7 +82,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
BlockPos thisPos = this.worldPosition; BlockPos thisPos = this.worldPosition;
BlockPos[] positions = new BlockPos[]{thisPos.offset(1, 1, 0), thisPos.offset(-1, 1, 0), thisPos.offset(0, 1, 1), thisPos.offset(0, 1, -1)}; BlockPos[] positions = new BlockPos[]{thisPos.offset(1, 1, 0), thisPos.offset(-1, 1, 0), thisPos.offset(0, 1, 1), thisPos.offset(0, 1, -1)};
if (this.level != null && WorldUtil.hasBlocksInPlacesGiven(positions, ActuallyBlocks.LAVA_FACTORY_CASING.get(), this.level)) { if (this.level != null && WorldUtil.hasBlocksInPlacesGiven(positions, ActuallyBlocks.LAVA_CASING.get(), this.level)) {
BlockPos pos = thisPos.above(); BlockPos pos = thisPos.above();
BlockState state = this.level.getBlockState(pos); BlockState state = this.level.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();

View file

@ -37,6 +37,9 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider { public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider {
int[] i = ConfigIntListValues.OIL_POWER.getValue(); int[] i = ConfigIntListValues.OIL_POWER.getValue();
@ -56,12 +59,12 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
return FluidStack.EMPTY; return FluidStack.EMPTY;
} }
//@Override @Override
public boolean canFillFluidType(FluidStack stack) { public boolean canFillFluidType(FluidStack stack) {
Fluid fluid = stack == null Fluid fluid = stack == null
? null ? null
: stack.getFluid(); : stack.getFluid();
return fluid != null && getRecipeForFluid(fluid.getRegistryName().toString()) != null; return fluid != null && getRecipeForFluid(fluid.getName()) != null;
} }
}; };
public final LazyOptional<IFluidHandler> lazyTank = LazyOptional.of(() -> this.tank); public final LazyOptional<IFluidHandler> lazyTank = LazyOptional.of(() -> this.tank);
@ -100,7 +103,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
if (stack != null) { if (stack != null) {
Fluid fluid = stack.getFluid(); Fluid fluid = stack.getFluid();
if (fluid != null) { if (fluid != null) {
return getRecipeForFluid(fluid.getRegistryName().toString()); return getRecipeForFluid(fluid.getName());
} }
} }
return null; return null;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
@ -24,12 +23,13 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipe;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.datafix.fixes.FurnaceRecipes;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
@ -55,7 +55,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
private boolean lastSmelted; private boolean lastSmelted;
public TileEntityPoweredFurnace() { public TileEntityPoweredFurnace() {
super(ActuallyBlocks.POWERED_FURNACE.getTileEntityType(), 4); super(ActuallyTiles.FURNACE_DOUBLE_TILE.get(), 4);
} }
public static void autoSplit(ItemStackHandlerAA inv, int slot1, int slot2) { public static void autoSplit(ItemStackHandlerAA inv, int slot1, int slot2) {
@ -111,7 +111,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
@Override @Override
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
if (!this.level.isClientSide) { if (!this.world.isRemote) {
if (this.isAutoSplit) { if (this.isAutoSplit) {
autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2);
} }
@ -149,8 +149,8 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
this.secondSmeltTime = 0; this.secondSmeltTime = 0;
} }
BlockState currState = this.level.getBlockState(this.getBlockPos()); BlockState currState = this.world.getBlockState(this.pos);
boolean current = currState.getValue(BlockStateProperties.LIT); boolean current = currState.get(BlockStateProperties.LIT);
boolean changeTo = current; boolean changeTo = current;
if (this.lastSmelted != smelted) { if (this.lastSmelted != smelted) {
changeTo = smelted; changeTo = smelted;
@ -163,7 +163,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
} }
if (changeTo != current) { if (changeTo != current) {
this.level.setBlock(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo), Constants.BlockFlags.DEFAULT); this.world.setBlockState(this.pos, currState.with(BlockStateProperties.LIT, changeTo));
} }
this.lastSmelted = smelted; this.lastSmelted = smelted;
@ -179,7 +179,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
@Override @Override
public IAcceptor getAcceptor() { public IAcceptor getAcceptor() {
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2); //&& StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack)); //TODO return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack));
} }
@Override @Override
@ -189,9 +189,9 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
public boolean canSmeltOn(int theInput, int theOutput) { public boolean canSmeltOn(int theInput, int theOutput) {
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
ItemStack output = ItemStack.EMPTY; //FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); //TODO ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput));
if (StackUtil.isValid(output)) { if (StackUtil.isValid(output)) {
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) {
return true; return true;
} }
} }
@ -201,7 +201,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
} }
public void finishBurning(int theInput, int theOutput) { public void finishBurning(int theInput, int theOutput) {
ItemStack output = ItemStack.EMPTY; //FurnaceRecipe.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); //TODO ItemStack output = FurnaceRecipe.instance().getSmeltingResult(this.inv.getStackInSlot(theInput));
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) { if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) {
this.inv.setStackInSlot(theOutput, output.copy()); this.inv.setStackInSlot(theOutput, output.copy());
} else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) { } else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) {
@ -223,7 +223,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
public void onButtonPressed(int buttonID, PlayerEntity player) { public void onButtonPressed(int buttonID, PlayerEntity player) {
if (buttonID == 0) { if (buttonID == 0) {
this.isAutoSplit = !this.isAutoSplit; this.isAutoSplit = !this.isAutoSplit;
this.setChanged(); this.markDirty();
} }
} }

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -32,13 +31,15 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
public static final int RANGE = 6; public static final int RANGE = 6;
public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000); public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000);
public TileEntityRangedCollector() { public TileEntityRangedCollector() {
super(ActuallyBlocks.RANGED_COLLECTOR.getTileEntityType(), 6); super(ActuallyTiles.RANGEDCOLLECTOR_TILE.get(), 6);
} }
@Override @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -19,6 +18,8 @@ import net.minecraftforge.energy.IEnergyStorage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay { public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay {
public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<>(); public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<>();
@ -31,7 +32,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy
private int oldEnergy; private int oldEnergy;
public TileEntityShockSuppressor() { public TileEntityShockSuppressor() {
super(ActuallyBlocks.SHOCK_SUPPRESSOR.getTileEntityType()); super(ActuallyTiles.SHOCKSUPPRESSOR_TILE.get());
} }
@Override @Override

View file

@ -28,9 +28,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -167,60 +165,60 @@ public final class AssetUtil {
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
} }
// @OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
// public static void renderNameTag(String tag, double x, double y, double z) { public static void renderNameTag(String tag, double x, double y, double z) {
// FontRenderer fontrenderer = Minecraft.getInstance().font; FontRenderer fontrenderer = Minecraft.getInstance().font;
// float f = 1.6F; float f = 1.6F;
// float f1 = 0.016666668F * f; float f1 = 0.016666668F * f;
// GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
// GlStateManager.translate(x, y, z); GlStateManager.translate(x, y, z);
// GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glNormal3f(0.0F, 1.0F, 0.0F);
// GlStateManager.rotate(-Minecraft.getInstance().getEntityRenderDispatcher().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-Minecraft.getInstance().getEntityRenderDispatcher().playerViewY, 0.0F, 1.0F, 0.0F);
// GlStateManager.rotate(Minecraft.getInstance().getEntityRenderDispatcher().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(Minecraft.getInstance().getEntityRenderDispatcher().playerViewX, 1.0F, 0.0F, 0.0F);
// GlStateManager.scale(-f1, -f1, f1); GlStateManager.scale(-f1, -f1, f1);
// GlStateManager._disableLighting(); GlStateManager._disableLighting();
// GlStateManager._depthMask(false); GlStateManager._depthMask(false);
// GlStateManager.disableDepth(); GlStateManager.disableDepth();
// GlStateManager._enableBlend(); GlStateManager._enableBlend();
// GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
// Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
// BufferBuilder renderer = tessellator.getBuilder(); BufferBuilder renderer = tessellator.getBuilder();
// int i = 0; int i = 0;
// int j = fontrenderer.width(tag) / 2; int j = fontrenderer.width(tag) / 2;
// GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
// renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
// renderer.vertex(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); renderer.vertex(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// renderer.vertex(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); renderer.vertex(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// renderer.vertex(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); renderer.vertex(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// renderer.vertex(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); renderer.vertex(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// tessellator.end(); tessellator.end();
// GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
// fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127); fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127);
// GlStateManager.enableDepth(); GlStateManager.enableDepth();
// GlStateManager._depthMask(true); GlStateManager._depthMask(true);
// fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1); fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1);
// GlStateManager._enableLighting(); GlStateManager._enableLighting();
// GlStateManager._disableBlend(); GlStateManager._disableBlend();
// GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F);
// GlStateManager._popMatrix(); GlStateManager._popMatrix();
// } }
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
if (!world.isClientSide) { if (!world.isClientSide) {
CompoundNBT data = new CompoundNBT(); CompoundNBT data = new CompoundNBT();
data.putDouble("StartX", startX); data.setDouble("StartX", startX);
data.putDouble("StartY", startY); data.setDouble("StartY", startY);
data.putDouble("StartZ", startZ); data.setDouble("StartZ", startZ);
data.putDouble("EndX", endX); data.setDouble("EndX", endX);
data.putDouble("EndY", endY); data.setDouble("EndY", endY);
data.putDouble("EndZ", endZ); data.setDouble("EndZ", endZ);
data.putFloat("Color1", color[0]); data.setFloat("Color1", color[0]);
data.putFloat("Color2", color[1]); data.setFloat("Color2", color[1]);
data.putFloat("Color3", color[2]); data.setFloat("Color3", color[2]);
data.putDouble("RotationTime", rotationTime); data.setDouble("RotationTime", rotationTime);
data.putFloat("Size", size); data.setFloat("Size", size);
data.putInt("MaxAge", maxAge); data.setInteger("MaxAge", maxAge);
data.putFloat("Alpha", alpha); data.setFloat("Alpha", alpha);
PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
} }
} }
@ -229,9 +227,9 @@ public final class AssetUtil {
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) { if (mc.player.distanceTo(startX, startY, startZ) <= 64 || mc.player.distanceTo(endX, endY, endZ) <= 64) {
Particle fx = new ParticleBeam(mc.level, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha); Particle fx = new ParticleBeam(mc.level, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha);
mc.level.addParticle((IParticleData) fx, startX, startY, startZ, 0, 0, 0); mc.effectRenderer.addEffect(fx);
} }
} }
@ -247,12 +245,12 @@ public final class AssetUtil {
float g = color[1]; float g = color[1];
float b = color[2]; float b = color[2];
Vector3d vec1 = new Vector3d(firstX, firstY, firstZ); Vec3d vec1 = new Vec3d(firstX, firstY, firstZ);
Vector3d vec2 = new Vector3d(secondX, secondY, secondZ); Vec3d vec2 = new Vec3d(secondX, secondY, secondZ);
Vector3d combinedVec = vec2.subtract(vec1); Vec3d combinedVec = vec2.subtract(vec1);
double rot = rotationTime > 0 double rot = rotationTime > 0
? 360D * (world.getGameTime() % rotationTime / rotationTime) ? 360D * (world.getTotalWorldTime() % rotationTime / rotationTime)
: 0; : 0;
double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z)); double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z));
double yaw = Math.atan2(-combinedVec.z, combinedVec.x); double yaw = Math.atan2(-combinedVec.z, combinedVec.x);
@ -263,7 +261,7 @@ public final class AssetUtil {
GlStateManager._disableLighting(); GlStateManager._disableLighting();
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE);
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0);

View file

@ -10,13 +10,17 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.LanguageMap; import net.minecraft.util.text.LanguageMap;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.ForgeI18n;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.List;
public final class StringUtil { public final class StringUtil {
@ -24,8 +28,6 @@ public final class StringUtil {
public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752; public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis"; public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis";
//TODO: Remove
static LanguageMap cancerino;
/** /**
* Localizes a given String * Localizes a given String
@ -46,59 +48,58 @@ public final class StringUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName //TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName
public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) { public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) {
return I18n.get(langKey); return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
} }
// TODO: Move to official
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) { public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) {
// ResourcePackList <- holds the correct way List<String> list = renderer.listFormattedStringToWidth(strg, width);
// List<String> list = renderer.listFormattedStringToWidth(strg, width); for (int i = 0; i < list.size(); i++) {
// for (int i = 0; i < list.size(); i++) { String s1 = list.get(i);
// String s1 = list.get(i); renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow);
// renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow); }
// }
} }
// @OnlyIn(Dist.CLIENT)
// public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) {
// List<String> lines = font.listFormattedStringToWidth(text, (int) (length / scale));
// for (int i = 0; i < lines.size(); i++) {
// renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.lineHeight * scale + 3), color, shadow, scale);
// }
// }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) {
// GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
// GlStateManager.scale(scale, scale, scale); GlStateManager.scale(scale, scale, scale);
// boolean oldUnicode = font.getUnicodeFlag(); boolean oldUnicode = font.getUnicodeFlag();
// font.setUnicodeFlag(false); font.setUnicodeFlag(false);
//
// font.draw(text, x / scale, y / scale, color, shadow); font.draw(text, x / scale, y / scale, color, shadow);
//
// font.setUnicodeFlag(oldUnicode); font.setUnicodeFlag(oldUnicode);
// GlStateManager._popMatrix(); GlStateManager._popMatrix();
} }
// static void setupLangMap() { @OnlyIn(Dist.CLIENT)
// try { public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) {
// Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class); List<String> lines = font.listFormattedStringToWidth(text, (int) (length / scale));
// m.setAccessible(true); for (int i = 0; i < lines.size(); i++) {
// m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_US.lang")); renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.lineHeight * scale + 3), color, shadow, scale);
// } catch (Exception e) { }
// e.printStackTrace(); }
// throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
// } //TODO: Remove
// } static LanguageMap cancerino;
static void setupLangMap() {
try {
Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class);
m.setAccessible(true);
m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_US.lang"));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
}
}
// TODO: This might be wrong
public static String badTranslate(String someUnlocAAItemName) { public static String badTranslate(String someUnlocAAItemName) {
// if (cancerino == null) { if (cancerino == null) {
// cancerino = new LanguageMap(); cancerino = new LanguageMap();
// setupLangMap(); setupLangMap();
// } }
// return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name"); return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name");
return ForgeI18n.parseFormat("item.actuallyadditions." + someUnlocAAItemName + ".name");
} }
} }

View file

@ -1,9 +1,9 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
public final class VanillaPacketDispatcher { public final class VanillaPacketDispatcher {
@ -11,11 +11,16 @@ public final class VanillaPacketDispatcher {
//Don't call from the client. //Don't call from the client.
public static void dispatchTEToNearbyPlayers(TileEntity tile) { public static void dispatchTEToNearbyPlayers(TileEntity tile) {
ServerWorld world = (ServerWorld) tile.getLevel(); ServerWorld world = (ServerWorld) tile.getLevel();
Chunk chunk = world.getChunk(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4); PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4);
if (entry == null) {
return;
}
for (ServerPlayerEntity player : entry.getWatchingPlayers()) {
player.connection.send(tile.getUpdatePacket());
}
world.getChunkSource().chunkMap.getPlayers(chunk.getPos(), false).forEach(e -> {
e.connection.send(tile.getUpdatePacket());
});
} }
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {

View file

@ -28,7 +28,6 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
@ -152,6 +151,7 @@ public final class WorldUtil {
* @param positions The Positions, an array of {x, y, z} arrays containing Positions * @param positions The Positions, an array of {x, y, z} arrays containing Positions
* @param block The Block * @param block The Block
* @param world The World * @param world The World
*
* @return Is every block present? * @return Is every block present?
*/ */
public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) { public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) {
@ -258,14 +258,14 @@ public final class WorldUtil {
double d0 = player.posX; double d0 = player.posX;
double d1 = player.posY + player.getEyeHeight(); double d1 = player.posY + player.getEyeHeight();
double d2 = player.posZ; double d2 = player.posZ;
Vector3d vec3 = new Vector3d(d0, d1, d2); Vec3d vec3 = new Vec3d(d0, d1, d2);
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI); float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
float f4 = -MathHelper.cos(-f * 0.017453292F); float f4 = -MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = f3 * f4; float f6 = f3 * f4;
float f7 = f2 * f4; float f7 = f2 * f4;
Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); Vec3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance);
return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3);
} }
@ -308,6 +308,7 @@ public final class WorldUtil {
* @param world The player's world. * @param world The player's world.
* @param player The player that is breaking this block. * @param player The player that is breaking this block.
* @param pos The pos to break. * @param pos The pos to break.
*
* @return If the break was successful. * @return If the break was successful.
*/ */
public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) { public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) {