Readded the Alchemy Table
Finished adding the Alchemy Table with JEI compatability. Also added recipes for the ARC block and the Alchemy Table.
This commit is contained in:
parent
37c5e807b0
commit
bf6250272c
|
@ -20,7 +20,7 @@ e1a98bd53fca155e4bbb03c1e548341af0f84bd7 assets/bloodmagic/blockstates/masterrit
|
|||
b03040d7a168653bf8df3600033b8fde2383db30 assets/bloodmagic/blockstates/selfsacrificerune.json
|
||||
487ffdc02ab7b65aafcb932e3b5cf6ea0500b21d assets/bloodmagic/blockstates/speedrune.json
|
||||
e6d9cf699667aaa47efff37b2b033895dee29c15 assets/bloodmagic/blockstates/waterritualstone.json
|
||||
9bcff74a4115a9a7f777990b987c247a77e3d7a5 assets/bloodmagic/lang/en_us.json
|
||||
3ce8493bdefc034104e5a1496f24f5463cb15c4c assets/bloodmagic/lang/en_us.json
|
||||
34445195b9f2459475cde53454bc8e37d32865d7 assets/bloodmagic/models/block/accelerationrune.json
|
||||
bcdbccc49d4509571be6988762ab87126275a4c8 assets/bloodmagic/models/block/airritualstone.json
|
||||
adf6c0b1e25451609486dc8c8cfbd9cf0f8c67f4 assets/bloodmagic/models/block/alchemicalreactionchamber.json
|
||||
|
@ -151,6 +151,8 @@ a31019db55828cb937a071ac2f74b125a2d0c955 assets/bloodmagic/models/item/waterritu
|
|||
7426fed5f833ce3d08602f727f1467dd3e107991 assets/bloodmagic/models/item/watersigil.json
|
||||
f72efc172699d43405019add97f455bd6b7f452b assets/bloodmagic/models/item/weakbloodorb.json
|
||||
1efacee8dc0c3114567509ad247800cff59cb455 assets/bloodmagic/models/item/weakbloodshard.json
|
||||
04faf23bcb783a306c3b7a8a375ac2bf87c1072b data/bloodmagic/advancements/recipes/bloodmagictab/alchemy_table.json
|
||||
e6a3ac3998653b10ee09780be9099a9d0c5b3917 data/bloodmagic/advancements/recipes/bloodmagictab/arc.json
|
||||
828c0f89e747d48d37c6a86030a8ec59ca5c29cb data/bloodmagic/advancements/recipes/bloodmagictab/blood_altar.json
|
||||
f8b66411c96c6a7a409fb10f6888d078f1f8fa14 data/bloodmagic/advancements/recipes/bloodmagictab/blood_rune_blank.json
|
||||
ab5612f33028487c08e51de4b91bb786df1b1b95 data/bloodmagic/advancements/recipes/bloodmagictab/blood_rune_capacity.json
|
||||
|
@ -174,6 +176,7 @@ c8e5cdac0e7328640ab1cb0eab0a46f0733b59b3 data/bloodmagic/advancements/recipes/bl
|
|||
26e3f34021426def32602e5ae7755e4672878320 data/bloodmagic/loot_tables/blocks/airritualstone.json
|
||||
1ed1f3cebe68450b6d5ca3ce69e4728a7d250b1c data/bloodmagic/loot_tables/blocks/alchemicalreactionchamber.json
|
||||
443550be9eaf1021b11fd2bbe6afcfe2cee6f7ad data/bloodmagic/loot_tables/blocks/alchemyarray.json
|
||||
c92a9f2a90f2c17933f89832899c295cde1f194d data/bloodmagic/loot_tables/blocks/alchemytable.json
|
||||
17d8dcc62320d5d2eeb781e925963d9b9d5eec54 data/bloodmagic/loot_tables/blocks/altar.json
|
||||
05bb6268d7e884c962061a632e162d5baf73271e data/bloodmagic/loot_tables/blocks/altarcapacityrune.json
|
||||
87d44fa5143733864c12608443d11744b91e0496 data/bloodmagic/loot_tables/blocks/bettercapacityrune.json
|
||||
|
@ -195,6 +198,8 @@ e0239eff7762a414a4e4faa0158d844dffb8c1f6 data/bloodmagic/loot_tables/blocks/sacr
|
|||
f748a5ba8838b50de0502f132fe2a65f4726dae6 data/bloodmagic/loot_tables/blocks/soulforge.json
|
||||
015e07226fd90935f7ec663f4bcf3873a57a82d1 data/bloodmagic/loot_tables/blocks/speedrune.json
|
||||
26e3f34021426def32602e5ae7755e4672878320 data/bloodmagic/loot_tables/blocks/waterritualstone.json
|
||||
2df19ff659705a5408ce0819a947764673404388 data/bloodmagic/recipes/alchemy_table.json
|
||||
3a80b920539778b3eb9eab8fdf1eb76c1ab9d8d5 data/bloodmagic/recipes/alchemytable/string.json
|
||||
3c9d829f7bff8a4d607c46fc3ff4f86dffa28fd5 data/bloodmagic/recipes/altar/air_tool.json
|
||||
f41b0e9dfab608c42a85c3c5c5bbc050b03f02a1 data/bloodmagic/recipes/altar/apprenticebloodorb.json
|
||||
2a67e37497a571b5ee944375d315fddccea87697 data/bloodmagic/recipes/altar/daggerofsacrifice.json
|
||||
|
@ -209,6 +214,7 @@ d79a96eb3eed597f1c18a8983764a6362a24748c data/bloodmagic/recipes/altar/dusk_tool
|
|||
584d01dff4d64bb88bd3783751a29723700f1728 data/bloodmagic/recipes/altar/slate.json
|
||||
926d4a0e165c87a15a609744d832d2f5f04a40d0 data/bloodmagic/recipes/altar/water_tool.json
|
||||
7551501cf361667ec7454c307b9d2368536fbed6 data/bloodmagic/recipes/altar/weakbloodorb.json
|
||||
5807b2515f4a2dc9855327940e6055f6947f0749 data/bloodmagic/recipes/arc.json
|
||||
352ba51f1c988029059e5b53a3a11432d0591b58 data/bloodmagic/recipes/arc/weakbloodshard.json
|
||||
e1285ec51100f2336c1ea1a1a3057e74a0dd84d1 data/bloodmagic/recipes/array/airsigil.json
|
||||
d1ac23080f72f21adb5908befefe965ffb4efd4f data/bloodmagic/recipes/array/bloodlightsigil.json
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{
|
||||
"block.bloodmagic.accelerationrune": "Acceleration Rune",
|
||||
"block.bloodmagic.airritualstone": "Air Ritual Stone",
|
||||
"block.bloodmagic.alchemicalreactionchamber": "Alchemical Reaction Chamber",
|
||||
"block.bloodmagic.alchemytable": "Alchemy Table",
|
||||
"block.bloodmagic.altar": "Blood Altar",
|
||||
"block.bloodmagic.altarcapacityrune": "Rune of Capacity",
|
||||
"block.bloodmagic.bettercapacityrune": "Rune of Augmented Capacity",
|
||||
"block.bloodmagic.blankrune": "Blank Rune",
|
||||
"block.bloodmagic.bloodstonebrick": "Bloodstone Tile",
|
||||
"block.bloodmagic.bloodstonebrick": "Bloodstone Brick",
|
||||
"block.bloodmagic.chargingrune": "Charging Rune",
|
||||
"block.bloodmagic.dislocationrune": "DisplacementRune",
|
||||
"block.bloodmagic.duskritualstone": "Dusk Ritual Stone",
|
||||
"block.bloodmagic.earthritualstone": "Earth Ritual Stone",
|
||||
"block.bloodmagic.fireritualstone": "Fire Ritual Stone",
|
||||
"block.bloodmagic.largebloodstonebrick": "Large Bloodstone Tile",
|
||||
"block.bloodmagic.largebloodstonebrick": "Large Bloodstone Brick",
|
||||
"block.bloodmagic.lightritualstone": "Dawn Ritual Stone",
|
||||
"block.bloodmagic.masterritualstone": "Master Ritual Stone",
|
||||
"block.bloodmagic.orbcapacityrune": "Rune of the Orb",
|
||||
|
@ -87,7 +89,10 @@
|
|||
"itemGroup.bloodmagic.creativeTab": "Blood Magic",
|
||||
"itemGroup.bloodmagictab": "Blood Magic",
|
||||
"jei.bloodmagic.recipe.alchemyarraycrafting": "Alchemy Array",
|
||||
"jei.bloodmagic.recipe.alchemytable": "Alchemy Table",
|
||||
"jei.bloodmagic.recipe.altar": "Blood Altar",
|
||||
"jei.bloodmagic.recipe.arc": "ARC Recipe",
|
||||
"jei.bloodmagic.recipe.arcfurnace": "ARC Furnace Recipe",
|
||||
"jei.bloodmagic.recipe.consumptionrate": "Consumption: %s LP/t",
|
||||
"jei.bloodmagic.recipe.drainrate": "Drain: %s LP/t",
|
||||
"jei.bloodmagic.recipe.minimumsouls": "Minimum: %s Will",
|
||||
|
@ -122,6 +127,7 @@
|
|||
"ritual.bloodmagic.waterRitual": "Ritual of the Full Spring",
|
||||
"ritual.bloodmagic.wellOfSufferingRitual": "Well of Suffering",
|
||||
"ritual.bloodmagic.zephyrRitual": "Call of the Zephyr",
|
||||
"tile.bloodmagic.alchemytable.name": "Alchemy Table",
|
||||
"tile.bloodmagic.arc.name": "Alchemical Reaction Chamber",
|
||||
"tile.bloodmagic.soulforge.name": "Hellfire Forge",
|
||||
"tooltip.bloodmagic.activationcrystal.awakened": "Activates more powerful rituals",
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"bloodmagic:alchemy_table"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_weak_orb": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "bloodmagic:weakbloodorb"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "bloodmagic:alchemy_table"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_weak_orb",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"bloodmagic:arc"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_magician_orb": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "bloodmagic:magicianbloodorb"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "bloodmagic:arc"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_magician_orb",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "bloodmagic:alchemytable"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"sss",
|
||||
"wbw",
|
||||
"gog"
|
||||
],
|
||||
"key": {
|
||||
"b": {
|
||||
"tag": "forge:rods/blaze"
|
||||
},
|
||||
"s": {
|
||||
"tag": "forge:stone"
|
||||
},
|
||||
"w": {
|
||||
"tag": "minecraft:planks"
|
||||
},
|
||||
"g": {
|
||||
"tag": "forge:ingots/gold"
|
||||
},
|
||||
"o": {
|
||||
"type": "bloodmagic:bloodorb",
|
||||
"orb_tier": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "bloodmagic:alchemytable"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"type": "bloodmagic:alchemytable",
|
||||
"input": [
|
||||
{
|
||||
"tag": "minecraft:wool"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:flint"
|
||||
}
|
||||
],
|
||||
"output": {
|
||||
"item": "minecraft:string",
|
||||
"count": 4
|
||||
},
|
||||
"syphon": 0,
|
||||
"ticks": 100,
|
||||
"upgradeLevel": 0
|
||||
}
|
29
src/generated/resources/data/bloodmagic/recipes/arc.json
Normal file
29
src/generated/resources/data/bloodmagic/recipes/arc.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"sss",
|
||||
"SoS",
|
||||
"IfI"
|
||||
],
|
||||
"key": {
|
||||
"s": {
|
||||
"tag": "forge:stone"
|
||||
},
|
||||
"f": {
|
||||
"item": "minecraft:furnace"
|
||||
},
|
||||
"o": {
|
||||
"type": "bloodmagic:bloodorb",
|
||||
"orb_tier": 3
|
||||
},
|
||||
"I": {
|
||||
"tag": "forge:storage_blocks/iron"
|
||||
},
|
||||
"S": {
|
||||
"item": "bloodmagic:infusedslate"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "bloodmagic:alchemicalreactionchamber"
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ import net.minecraftforge.common.crafting.CraftingHelper;
|
|||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
@ -33,8 +32,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|||
import wayoftime.bloodmagic.api.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.api.impl.BloodMagicCorePlugin;
|
||||
import wayoftime.bloodmagic.client.ClientEvents;
|
||||
import wayoftime.bloodmagic.client.render.entity.BloodLightRenderer;
|
||||
import wayoftime.bloodmagic.client.render.entity.SoulSnareRenderer;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.data.GeneratorBaseRecipes;
|
||||
import wayoftime.bloodmagic.common.data.GeneratorBlockStates;
|
||||
|
@ -54,6 +51,7 @@ import wayoftime.bloodmagic.potion.BloodMagicPotions;
|
|||
import wayoftime.bloodmagic.ritual.RitualManager;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
import wayoftime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import wayoftime.bloodmagic.tile.TileSoulForge;
|
||||
|
@ -155,6 +153,7 @@ public class BloodMagic
|
|||
event.getRegistry().register(TileEntityType.Builder.create(TileSoulForge::new, BloodMagicBlocks.SOUL_FORGE.get()).build(null).setRegistryName("soulforge"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileMasterRitualStone::new, BloodMagicBlocks.MASTER_RITUAL_STONE.get()).build(null).setRegistryName("masterritualstone"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileAlchemicalReactionChamber::new, BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get()).build(null).setRegistryName("alchemicalreactionchamber"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileAlchemyTable::new, BloodMagicBlocks.ALCHEMY_TABLE.get()).build(null).setRegistryName("alchemytable"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -193,11 +192,8 @@ public class BloodMagic
|
|||
{
|
||||
// do something that can only be done on the client
|
||||
// LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
|
||||
ClientEvents.registerContainerScreens();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.SNARE.getEntityType(), SoulSnareRenderer::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.BLOOD_LIGHT.getEntityType(), BloodLightRenderer::new);
|
||||
ClientEvents.registerItemModelProperties(event);
|
||||
ClientEvents.initClientEvents(event);
|
||||
}
|
||||
|
||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import wayoftime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
|
||||
|
@ -324,6 +325,45 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar
|
|||
// return null;
|
||||
// }
|
||||
//
|
||||
@Nullable
|
||||
public RecipeAlchemyTable getAlchemyTable(World world, @Nonnull List<ItemStack> input)
|
||||
{
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
List<RecipeAlchemyTable> tartaricForgeRecipes = world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALCHEMYTABLE);
|
||||
mainLoop: for (RecipeAlchemyTable recipe : tartaricForgeRecipes)
|
||||
{
|
||||
if (recipe.getInput().size() != input.size())
|
||||
continue;
|
||||
|
||||
List<Ingredient> recipeInput = new ArrayList<>(recipe.getInput());
|
||||
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
boolean matched = false;
|
||||
for (int j = 0; j < recipeInput.size(); j++)
|
||||
{
|
||||
Ingredient ingredient = recipeInput.get(j);
|
||||
if (ingredient.test(input.get(i)))
|
||||
{
|
||||
matched = true;
|
||||
recipeInput.remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeTartaricForge getTartaricForge(World world, @Nonnull List<ItemStack> input)
|
||||
{
|
||||
|
@ -457,6 +497,11 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar
|
|||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARC));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyTable> getAlchemyTableRecipes(World world)
|
||||
{
|
||||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALCHEMYTABLE));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyArray> getCraftingAlchemyArrayRecipes(World world)
|
||||
{
|
||||
Set<RecipeAlchemyArray> recipes = Set.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARRAY));
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RecipeAlchemyTable extends BloodMagicRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final List<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final int syphon;
|
||||
@Nonnegative
|
||||
private final int ticks;
|
||||
@Nonnegative
|
||||
private final int minimumTier;
|
||||
|
||||
public static final int MAX_INPUTS = 6;
|
||||
|
||||
public RecipeAlchemyTable(ResourceLocation id, List<Ingredient> input, @Nonnull ItemStack output, int syphon, int ticks, int minimumTier)
|
||||
{
|
||||
super(id);
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.syphon = syphon;
|
||||
this.ticks = ticks;
|
||||
this.minimumTier = minimumTier;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final List<Ingredient> getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
public final int getSyphon()
|
||||
{
|
||||
return syphon;
|
||||
}
|
||||
|
||||
public final int getTicks()
|
||||
{
|
||||
return ticks;
|
||||
}
|
||||
|
||||
public final int getMinimumTier()
|
||||
{
|
||||
return minimumTier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeInt(input.size());
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
input.get(i).write(buffer);
|
||||
}
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(syphon);
|
||||
buffer.writeInt(ticks);
|
||||
buffer.writeInt(minimumTier);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package wayoftime.bloodmagic.client;
|
||||
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
|
@ -10,18 +12,24 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAltar;
|
||||
import wayoftime.bloodmagic.client.render.entity.BloodLightRenderer;
|
||||
import wayoftime.bloodmagic.client.render.entity.SoulSnareRenderer;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenAlchemyTable;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenSoulForge;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
||||
import wayoftime.bloodmagic.iface.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
|
@ -41,27 +49,44 @@ public class ClientEvents
|
|||
{
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.SOUL_FORGE_CONTAINER.get(), ScreenSoulForge::new);
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.ARC_CONTAINER.get(), ScreenAlchemicalReactionChamber::new);
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.ALCHEMY_TABLE_CONTAINER.get(), ScreenAlchemyTable::new);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void initClientEvents(FMLClientSetupEvent event)
|
||||
{
|
||||
DeferredWorkQueue.runLater(() -> {
|
||||
RenderType rendertype = RenderType.getCutoutMipped();
|
||||
RenderTypeLookup.setRenderLayer(BloodMagicBlocks.ALCHEMY_TABLE.get(), rendertype);
|
||||
|
||||
ClientEvents.registerContainerScreens();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.SNARE.getEntityType(), SoulSnareRenderer::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.BLOOD_LIGHT.getEntityType(), BloodLightRenderer::new);
|
||||
|
||||
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerItemModelProperties(FMLClientSetupEvent event)
|
||||
{
|
||||
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerToggleableProperties(Item item)
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package wayoftime.bloodmagic.client.screens;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemyTable;
|
||||
|
||||
public class ScreenAlchemyTable extends ScreenBase<ContainerAlchemyTable>
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/alchemytable.png");
|
||||
public IInventory tileTable;
|
||||
|
||||
public ScreenAlchemyTable(ContainerAlchemyTable container, PlayerInventory playerInventory, ITextComponent title)
|
||||
{
|
||||
super(container, playerInventory, title);
|
||||
tileTable = container.tileTable;
|
||||
this.xSize = 176;
|
||||
this.ySize = 205;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
// public
|
||||
|
||||
// public ScreenSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge)
|
||||
// {
|
||||
// super(new ContainerAlchemyTable(playerInventory, tileSoulForge));
|
||||
// this.tileSoulForge = tileSoulForge;
|
||||
// this.xSize = 176;
|
||||
// this.ySize = 205;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
// {
|
||||
// this.drawDefaultBackground();
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// this.renderHoveredToolTip(mouseX, mouseY);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(MatrixStack stack, int mouseX, int mouseY)
|
||||
{
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("tile.bloodmagic.alchemytable.name"), 8, 5, 4210752);
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("container.inventory"), 8, 111, 4210752);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
getMinecraft().getTextureManager().bindTexture(background);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
this.blit(stack, i, j, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int l = this.getCookProgressScaled(90);
|
||||
this.blit(stack, i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
|
||||
|
||||
for (int slotId = 0; slotId < 6; slotId++)
|
||||
{
|
||||
if (!((TileAlchemyTable) tileTable).isInputSlotAccessible(slotId))
|
||||
{
|
||||
Slot slot = this.getContainer().getSlot(slotId);
|
||||
|
||||
this.blit(stack, i + slot.xPos, j + slot.yPos, 195, 1, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public int getCookProgressScaled(int scale)
|
||||
{
|
||||
double progress = ((TileAlchemyTable) tileTable).getProgressForGui();
|
||||
// if (tileSoulForge != null)
|
||||
// {
|
||||
// System.out.println("Tile is NOT null");
|
||||
// }
|
||||
// double progress = ((float) this.container.data.get(0)) / ((float) this.container.data.get(1));
|
||||
// System.out.println(this.container.data.get(0));
|
||||
return (int) (progress * scale);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
public class BlockAlchemyTable extends Block// implements IBMBlock
|
||||
{
|
||||
public static final DirectionProperty DIRECTION = DirectionProperty.create("direction", Direction.Plane.HORIZONTAL);
|
||||
public static final BooleanProperty INVISIBLE = BooleanProperty.create("invisible");
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(1, 0, 1, 15, 15, 15);
|
||||
|
||||
public BlockAlchemyTable()
|
||||
{
|
||||
super(AbstractBlock.Properties.create(Material.IRON).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(1).notSolid().setOpaque(BlockAlchemyTable::isntSolid).setBlocksVision(BlockAlchemyTable::isntSolid));
|
||||
}
|
||||
|
||||
private static boolean isntSolid(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
public VoxelShape getRayTraceShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileAlchemyTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state)
|
||||
{
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileAlchemyTable)
|
||||
{
|
||||
if (((TileAlchemyTable) tile).isSlave())
|
||||
{
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) world.getTileEntity(((TileAlchemyTable) tile).getConnectedPos()), ((TileAlchemyTable) tile).getConnectedPos());
|
||||
} else
|
||||
{
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
// player.openGui(BloodMagic.instance, Constants.Gui.SOUL_FORGE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{
|
||||
return this.getDefaultState().with(DIRECTION, context.getPlacementHorizontalFacing());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
|
||||
{
|
||||
builder.add(DIRECTION, INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor)
|
||||
{
|
||||
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
{
|
||||
BlockPos connectedPos = tile.getConnectedPos();
|
||||
TileEntity connectedTile = world.getTileEntity(connectedPos);
|
||||
if (!(connectedTile instanceof TileAlchemyTable
|
||||
&& ((TileAlchemyTable) connectedTile).getConnectedPos().equals(pos)))
|
||||
{
|
||||
this.onPlayerDestroy(tile.getWorld(), pos, state);
|
||||
this.removedByPlayer(state, tile.getWorld(), pos, null, true, this.getFluidState(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileAlchemyTable forge = (TileAlchemyTable) world.getTileEntity(blockPos);
|
||||
|
||||
if (forge != null && !forge.isSlave())
|
||||
{
|
||||
forge.dropItems();
|
||||
}
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileAlchemyTable && !((TileAlchemyTable) tileentity).isSlave())
|
||||
{
|
||||
((TileAlchemyTable) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
// {
|
||||
// if (!state.isIn(newState.getBlock()))
|
||||
// {
|
||||
// TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
// if (tileentity instanceof TileSoulForge)
|
||||
// {
|
||||
// ((TileSoulForge) tileentity).dropItems();
|
||||
// worldIn.updateComparatorOutputLevel(pos, this);
|
||||
// }
|
||||
//
|
||||
// super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Item asItem()
|
||||
{
|
||||
return BloodMagicItems.ALCHEMY_TABLE_ITEM.get();
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import wayoftime.bloodmagic.block.enums.BloodRuneType;
|
|||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemyTable;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerSoulForge;
|
||||
|
||||
public class BloodMagicBlocks
|
||||
|
@ -68,6 +69,7 @@ public class BloodMagicBlocks
|
|||
public static final RegistryObject<Block> MASTER_RITUAL_STONE = BASICBLOCKS.register("masterritualstone", () -> new BlockMasterRitualStone(false));
|
||||
|
||||
public static final RegistryObject<Block> ALCHEMICAL_REACTION_CHAMBER = BLOCKS.register("alchemicalreactionchamber", () -> new BlockAlchemicalReactionChamber());
|
||||
public static final RegistryObject<Block> ALCHEMY_TABLE = BLOCKS.register("alchemytable", () -> new BlockAlchemyTable());
|
||||
|
||||
private static ForgeFlowingFluid.Properties makeProperties()
|
||||
{
|
||||
|
@ -82,6 +84,7 @@ public class BloodMagicBlocks
|
|||
|
||||
public static final RegistryObject<ContainerType<ContainerSoulForge>> SOUL_FORGE_CONTAINER = CONTAINERS.register("soul_forge_container", () -> IForgeContainerType.create(ContainerSoulForge::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemicalReactionChamber>> ARC_CONTAINER = CONTAINERS.register("arc_container", () -> IForgeContainerType.create(ContainerAlchemicalReactionChamber::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemyTable>> ALCHEMY_TABLE_CONTAINER = CONTAINERS.register("alchemy_table_container", () -> IForgeContainerType.create(ContainerAlchemyTable::new));
|
||||
// public static final RegistryObject<BloodstoneBlock> BLOOD_STONE = registerNoItem("blood_stone", () -> new BloodstoneBlock());
|
||||
//
|
||||
//// private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator)
|
||||
|
|
|
@ -2,12 +2,14 @@ package wayoftime.bloodmagic.common.data;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.ShapelessRecipeBuilder;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
|
@ -53,6 +55,9 @@ public class GeneratorBaseRecipes extends BaseRecipeProvider
|
|||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLANK_RITUAL_STONE.get(), 4).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicItems.REINFORCED_SLATE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_blank"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.MASTER_RITUAL_STONE.get()).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicBlocks.BLANK_RITUAL_STONE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_master"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.ALCHEMY_TABLE.get()).key('b', Tags.Items.RODS_BLAZE).key('s', Tags.Items.STONE).key('w', ItemTags.PLANKS).key('g', Tags.Items.INGOTS_GOLD).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("sss").patternLine("wbw").patternLine("gog").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("alchemy_table"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get()).key('s', Tags.Items.STONE).key('f', Blocks.FURNACE).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).key('I', Tags.Items.STORAGE_BLOCKS_IRON).key('S', BloodMagicItems.IMBUED_SLATE.get()).patternLine("sss").patternLine("SoS").patternLine("IfI").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("arc"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.PRIMITIVE_FURNACE_CELL.get()).key('c', Tags.Items.COBBLESTONE).key('f', Tags.Items.STORAGE_BLOCKS_COAL).key('s', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).patternLine("csc").patternLine("cfc").patternLine("coc").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("primitive_furnace_cell"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.LAVA_CRYSTAL.get()).key('a', Tags.Items.GLASS).key('b', Items.LAVA_BUCKET).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).key('d', Tags.Items.OBSIDIAN).key('e', Tags.Items.GEMS_DIAMOND).patternLine("aba").patternLine("bcb").patternLine("ded").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("lava_crystal"));
|
||||
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', Ingredient.fromItems(Items.DIAMOND)).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_standard"));
|
||||
|
|
|
@ -24,6 +24,7 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
// Tile Entitites
|
||||
add("tile.bloodmagic.soulforge.name", "Hellfire Forge");
|
||||
add("tile.bloodmagic.arc.name", "Alchemical Reaction Chamber");
|
||||
add("tile.bloodmagic.alchemytable.name", "Alchemy Table");
|
||||
|
||||
// Blood Orb tooltips
|
||||
add("tooltip.bloodmagic.extraInfo", "&9-Hold shift for more info-");
|
||||
|
@ -162,6 +163,9 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
addBlock(BloodMagicBlocks.DAWN_RITUAL_STONE, "Dawn Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.MASTER_RITUAL_STONE, "Master Ritual Stone");
|
||||
|
||||
addBlock(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER, "Alchemical Reaction Chamber");
|
||||
addBlock(BloodMagicBlocks.ALCHEMY_TABLE, "Alchemy Table");
|
||||
|
||||
addBlock(BloodMagicBlocks.BLOODSTONE, "Large Bloodstone Brick");
|
||||
addBlock(BloodMagicBlocks.BLOODSTONE_BRICK, "Bloodstone Brick");
|
||||
|
||||
|
@ -243,6 +247,9 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
add("jei.bloodmagic.recipe.altar", "Blood Altar");
|
||||
add("jei.bloodmagic.recipe.soulforge", "Hellfire Forge");
|
||||
add("jei.bloodmagic.recipe.alchemyarraycrafting", "Alchemy Array");
|
||||
add("jei.bloodmagic.recipe.arc", "ARC Recipe");
|
||||
add("jei.bloodmagic.recipe.arcfurnace", "ARC Furnace Recipe");
|
||||
add("jei.bloodmagic.recipe.alchemytable", "Alchemy Table");
|
||||
|
||||
// Chat
|
||||
add("chat.bloodmagic.ritual.weak", "You feel a push, but are too weak to perform this ritual.");
|
||||
|
|
|
@ -60,6 +60,7 @@ public class GeneratorLootTable extends LootTableProvider
|
|||
registerDropping(BloodMagicBlocks.EARTH_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.DUSK_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.DAWN_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.ALCHEMY_TABLE.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.data.DataGenerator;
|
|||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.recipe.ARCRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.AlchemyArrayRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.AlchemyTableRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodAltarRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.ISubRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.TartaricForgeRecipeProvider;
|
||||
|
@ -21,6 +22,6 @@ public class BloodMagicRecipeProvider extends BaseRecipeProvider
|
|||
@Override
|
||||
protected List<ISubRecipeProvider> getSubRecipeProviders()
|
||||
{
|
||||
return Arrays.asList(new BloodAltarRecipeProvider(), new AlchemyArrayRecipeProvider(), new TartaricForgeRecipeProvider(), new ARCRecipeProvider());
|
||||
return Arrays.asList(new BloodAltarRecipeProvider(), new AlchemyArrayRecipeProvider(), new TartaricForgeRecipeProvider(), new ARCRecipeProvider(), new AlchemyTableRecipeProvider());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe.builder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BloodMagicRecipeBuilder;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class AlchemyTableRecipeBuilder extends BloodMagicRecipeBuilder<AlchemyTableRecipeBuilder>
|
||||
{
|
||||
private final List<Ingredient> input;
|
||||
private final ItemStack output;
|
||||
private final int syphon;
|
||||
private final int ticks;
|
||||
private final int minimumTier;
|
||||
|
||||
protected AlchemyTableRecipeBuilder(List<Ingredient> input, ItemStack output, int syphon, int ticks, int minimumTier)
|
||||
{
|
||||
super(bmSerializer("alchemytable"));
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.syphon = syphon;
|
||||
this.ticks = ticks;
|
||||
this.minimumTier = minimumTier;
|
||||
}
|
||||
|
||||
public static AlchemyTableRecipeBuilder alchemyTable(ItemStack output, int syphon, int ticks, int minimumTier)
|
||||
{
|
||||
List<Ingredient> inputList = new ArrayList<Ingredient>();
|
||||
|
||||
return new AlchemyTableRecipeBuilder(inputList, output, syphon, ticks, minimumTier);
|
||||
}
|
||||
|
||||
public AlchemyTableRecipeBuilder addIngredient(Ingredient ing)
|
||||
{
|
||||
if (input.size() < RecipeAlchemyTable.MAX_INPUTS)
|
||||
{
|
||||
input.add(ing);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AlchemyTableRecipeResult getResult(ResourceLocation id)
|
||||
{
|
||||
return new AlchemyTableRecipeResult(id);
|
||||
}
|
||||
|
||||
public class AlchemyTableRecipeResult extends RecipeResult
|
||||
{
|
||||
protected AlchemyTableRecipeResult(ResourceLocation id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@Nonnull JsonObject json)
|
||||
{
|
||||
if (input.size() > 0)
|
||||
{
|
||||
JsonArray mainArray = new JsonArray();
|
||||
for (Ingredient ing : input)
|
||||
{
|
||||
JsonElement jsonObj = ing.serialize();
|
||||
|
||||
mainArray.add(jsonObj);
|
||||
}
|
||||
|
||||
json.add(Constants.JSON.INPUT, mainArray);
|
||||
}
|
||||
|
||||
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
|
||||
json.addProperty(Constants.JSON.SYPHON, syphon);
|
||||
json.addProperty(Constants.JSON.TICKS, ticks);
|
||||
json.addProperty(Constants.JSON.ALTAR_TIER, minimumTier);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.arc.ItemARCToolBase;
|
||||
import wayoftime.bloodmagic.common.item.block.ItemBlockAlchemyTable;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilAir;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilBloodLight;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilDivination;
|
||||
|
@ -71,6 +72,7 @@ public class BloodMagicItems
|
|||
public static final RegistryObject<Item> MASTER_RITUAL_STONE_ITEM = ITEMS.register("masterritualstone", () -> new BlockItem(BloodMagicBlocks.MASTER_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<Item> BLOOD_ALTAR_ITEM = ITEMS.register("altar", () -> new BlockItem(BloodMagicBlocks.BLOOD_ALTAR.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> ALCHEMY_TABLE_ITEM = ITEMS.register("alchemytable", () -> new ItemBlockAlchemyTable(BloodMagicBlocks.ALCHEMY_TABLE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
// TODO: Need to rework the above instantiations for the ItemBlocks so that it's
|
||||
// done with the Blocks.
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package wayoftime.bloodmagic.common.item.block;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.common.block.BlockAlchemyTable;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
public class ItemBlockAlchemyTable extends BlockItem
|
||||
{
|
||||
public ItemBlockAlchemyTable(Block block, Properties properties)
|
||||
{
|
||||
super(block, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType tryPlace(BlockItemUseContext context)
|
||||
{
|
||||
// PlayerEntity player = context.getPlayer()
|
||||
// float yaw = player.rotationYaw;
|
||||
Direction direction = context.getPlacementHorizontalFacing();
|
||||
PlayerEntity player = context.getPlayer();
|
||||
|
||||
if (direction.getYOffset() != 0)
|
||||
{
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
if (!world.isAirBlock(pos.offset(direction)))
|
||||
{
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
BlockState thisState = this.getBlock().getDefaultState().with(BlockAlchemyTable.DIRECTION, direction).with(BlockAlchemyTable.INVISIBLE, false);
|
||||
BlockState newState = this.getBlock().getDefaultState().with(BlockAlchemyTable.DIRECTION, direction).with(BlockAlchemyTable.INVISIBLE, true);
|
||||
|
||||
if (!this.canPlace(context, thisState) || !world.setBlockState(pos.offset(direction), newState, 3))
|
||||
{
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if (!world.setBlockState(pos, thisState, 3))
|
||||
{
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() == this.getBlock())
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileAlchemyTable)
|
||||
{
|
||||
((TileAlchemyTable) tile).setInitialTableParameters(direction, false, pos.offset(direction));
|
||||
}
|
||||
|
||||
TileEntity slaveTile = world.getTileEntity(pos.offset(direction));
|
||||
if (slaveTile instanceof TileAlchemyTable)
|
||||
{
|
||||
((TileAlchemyTable) slaveTile).setInitialTableParameters(direction, true, pos);
|
||||
}
|
||||
|
||||
setTileEntityNBT(world, context.getPlayer(), pos, context.getItem());
|
||||
this.getBlock().onBlockPlacedBy(world, pos, state, context.getPlayer(), context.getItem());
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
{
|
||||
CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity) player, pos, context.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
SoundType soundtype = state.getSoundType(world, pos, context.getPlayer());
|
||||
world.playSound(player, pos, this.getPlaceSound(state, world, pos, context.getPlayer()), SoundCategory.BLOCKS, (soundtype.getVolume()
|
||||
+ 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||
if (player == null || !player.abilities.isCreativeMode)
|
||||
{
|
||||
context.getItem().shrink(1);
|
||||
}
|
||||
|
||||
return ActionResultType.func_233537_a_(world.isRemote);
|
||||
|
||||
// return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.AlchemyTableRecipeBuilder;
|
||||
|
||||
public class AlchemyTableRecipeProvider implements ISubRecipeProvider
|
||||
{
|
||||
@Override
|
||||
public void addRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
String basePath = "alchemytable/";
|
||||
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(Items.STRING, 4), 0, 100, 0).addIngredient(Ingredient.fromTag(ItemTags.WOOL)).addIngredient(Ingredient.fromItems(Items.FLINT)).build(consumer, BloodMagic.rl(basePath + "string"));
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package wayoftime.bloodmagic.common.recipe;
|
|||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
|
||||
|
@ -12,4 +13,5 @@ public class BloodMagicRecipeType
|
|||
public static final IRecipeType<RecipeAlchemyArray> ARRAY = IRecipeType.register("array");
|
||||
public static final IRecipeType<RecipeTartaricForge> TARTARICFORGE = IRecipeType.register("soulforge");
|
||||
public static final IRecipeType<RecipeARC> ARC = IRecipeType.register("arc");
|
||||
public static final IRecipeType<RecipeAlchemyTable> ALCHEMYTABLE = IRecipeType.register("alchemytable");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
package wayoftime.bloodmagic.common.recipe.serializer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class AlchemyTableRecipeSerializer<RECIPE extends RecipeAlchemyTable>
|
||||
extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RECIPE>
|
||||
{
|
||||
|
||||
private final IFactory<RECIPE> factory;
|
||||
|
||||
public AlchemyTableRecipeSerializer(IFactory<RECIPE> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json)
|
||||
{
|
||||
List<Ingredient> inputList = new ArrayList<Ingredient>();
|
||||
|
||||
if (json.has(Constants.JSON.INPUT) && JSONUtils.isJsonArray(json, Constants.JSON.INPUT))
|
||||
{
|
||||
JsonArray mainArray = JSONUtils.getJsonArray(json, Constants.JSON.INPUT);
|
||||
|
||||
arrayLoop: for (JsonElement element : mainArray)
|
||||
{
|
||||
if (inputList.size() >= RecipeAlchemyTable.MAX_INPUTS)
|
||||
{
|
||||
break arrayLoop;
|
||||
}
|
||||
|
||||
if (element.isJsonArray())
|
||||
{
|
||||
element = element.getAsJsonArray();
|
||||
} else
|
||||
{
|
||||
element.getAsJsonObject();
|
||||
}
|
||||
|
||||
inputList.add(Ingredient.deserialize(element));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack output = SerializerHelper.getItemStack(json, Constants.JSON.OUTPUT);
|
||||
|
||||
int syphon = JSONUtils.getInt(json, Constants.JSON.SYPHON);
|
||||
int ticks = JSONUtils.getInt(json, Constants.JSON.TICKS);
|
||||
int minimumTier = JSONUtils.getInt(json, Constants.JSON.ALTAR_TIER);
|
||||
|
||||
return this.factory.create(recipeId, inputList, output, syphon, ticks, minimumTier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
int size = buffer.readInt();
|
||||
List<Ingredient> input = new ArrayList<Ingredient>(size);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
input.add(i, Ingredient.read(buffer));
|
||||
}
|
||||
|
||||
buffer.writeInt(input.size());
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
input.get(i).write(buffer);
|
||||
}
|
||||
|
||||
ItemStack output = buffer.readItemStack();
|
||||
int syphon = buffer.readInt();
|
||||
int ticks = buffer.readInt();
|
||||
int minimumTier = buffer.readInt();
|
||||
|
||||
return this.factory.create(recipeId, input, output, syphon, ticks, minimumTier);
|
||||
} catch (Exception e)
|
||||
{
|
||||
//Mekanism.logger.error("Error reading electrolysis recipe from packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull RECIPE recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
recipe.write(buffer);
|
||||
} catch (Exception e)
|
||||
{
|
||||
//Mekanism.logger.error("Error writing electrolysis recipe to packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IFactory<RECIPE extends RecipeAlchemyTable>
|
||||
{
|
||||
RECIPE create(ResourceLocation id, List<Ingredient> input, ItemStack output, int syphon, int ticks, int minimumTier);
|
||||
}
|
||||
}
|
|
@ -3,16 +3,19 @@ package wayoftime.bloodmagic.common.registries;
|
|||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import wayoftime.bloodmagic.common.recipe.serializer.ARCRecipeSerializer;
|
||||
import wayoftime.bloodmagic.common.recipe.serializer.AlchemyArrayRecipeSerializer;
|
||||
import wayoftime.bloodmagic.common.recipe.serializer.AlchemyTableRecipeSerializer;
|
||||
import wayoftime.bloodmagic.common.recipe.serializer.BloodAltarRecipeSerializer;
|
||||
import wayoftime.bloodmagic.common.recipe.serializer.TartaricForgeRecipeSerializer;
|
||||
import wayoftime.bloodmagic.common.registration.impl.IRecipeSerializerDeferredRegister;
|
||||
import wayoftime.bloodmagic.common.registration.impl.IRecipeSerializerRegistryObject;
|
||||
import wayoftime.bloodmagic.recipe.IRecipeARC;
|
||||
import wayoftime.bloodmagic.recipe.IRecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.recipe.IRecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.recipe.IRecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.recipe.IRecipeTartaricForge;
|
||||
|
||||
|
@ -29,6 +32,7 @@ public class BloodMagicRecipeSerializers
|
|||
public static final IRecipeSerializerRegistryObject<RecipeAlchemyArray> ARRAY = RECIPE_SERIALIZERS.register("array", () -> new AlchemyArrayRecipeSerializer<>(IRecipeAlchemyArray::new));
|
||||
public static final IRecipeSerializerRegistryObject<RecipeTartaricForge> TARTARIC = RECIPE_SERIALIZERS.register("soulforge", () -> new TartaricForgeRecipeSerializer<>(IRecipeTartaricForge::new));
|
||||
public static final IRecipeSerializerRegistryObject<RecipeARC> ARC = RECIPE_SERIALIZERS.register("arc", () -> new ARCRecipeSerializer<>(IRecipeARC::new));
|
||||
public static final IRecipeSerializerRegistryObject<RecipeAlchemyTable> ALCHEMYTABLE = RECIPE_SERIALIZERS.register("alchemytable", () -> new AlchemyTableRecipeSerializer<>(IRecipeAlchemyTable::new));
|
||||
|
||||
// public static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, BloodMagic.MODID);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import wayoftime.bloodmagic.BloodMagic;
|
|||
import wayoftime.bloodmagic.api.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.compat.jei.alchemytable.AlchemyTableRecipeCategory;
|
||||
import wayoftime.bloodmagic.compat.jei.altar.BloodAltarRecipeCategory;
|
||||
import wayoftime.bloodmagic.compat.jei.arc.ARCFurnaceRecipeCategory;
|
||||
import wayoftime.bloodmagic.compat.jei.arc.ARCRecipeCategory;
|
||||
|
@ -40,6 +41,7 @@ public class BloodMagicJEIPlugin implements IModPlugin
|
|||
registration.addRecipeCatalyst(new ItemStack(BloodMagicItems.ARCANE_ASHES.get()), AlchemyArrayCraftingCategory.UID);
|
||||
registration.addRecipeCatalyst(new ItemStack(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get()), ARCRecipeCategory.UID);
|
||||
registration.addRecipeCatalyst(new ItemStack(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get()), ARCFurnaceRecipeCategory.UID);
|
||||
registration.addRecipeCatalyst(new ItemStack(BloodMagicBlocks.ALCHEMY_TABLE.get()), AlchemyTableRecipeCategory.UID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,6 +53,7 @@ public class BloodMagicJEIPlugin implements IModPlugin
|
|||
registration.addRecipeCategories(new AlchemyArrayCraftingCategory(registration.getJeiHelpers().getGuiHelper()));
|
||||
registration.addRecipeCategories(new ARCRecipeCategory(registration.getJeiHelpers().getGuiHelper()));
|
||||
registration.addRecipeCategories(new ARCFurnaceRecipeCategory(registration.getJeiHelpers().getGuiHelper()));
|
||||
registration.addRecipeCategories(new AlchemyTableRecipeCategory(registration.getJeiHelpers().getGuiHelper()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,6 +65,7 @@ public class BloodMagicJEIPlugin implements IModPlugin
|
|||
registration.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArrayRecipes(world), AlchemyArrayCraftingCategory.UID);
|
||||
registration.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getARCRecipes(world), ARCRecipeCategory.UID);
|
||||
registration.addRecipes(ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(IRecipeType.SMELTING)), ARCFurnaceRecipeCategory.UID);
|
||||
registration.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTableRecipes(world), AlchemyTableRecipeCategory.UID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
package wayoftime.bloodmagic.compat.jei.alchemytable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.core.registry.OrbRegistry;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class AlchemyTableRecipeCategory implements IRecipeCategory<RecipeAlchemyTable>
|
||||
{
|
||||
private static final int OUTPUT_SLOT = 0;
|
||||
private static final int ORB_SLOT = 1;
|
||||
private static final int INPUT_SLOT = 2;
|
||||
public static final ResourceLocation UID = BloodMagic.rl(Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background;
|
||||
private final IDrawable icon;
|
||||
// @Nonnull
|
||||
// private final ICraftingGridHelper craftingGridHelper;
|
||||
|
||||
public AlchemyTableRecipeCategory(IGuiHelper guiHelper)
|
||||
{
|
||||
icon = guiHelper.createDrawableIngredient(new ItemStack(BloodMagicBlocks.ALCHEMY_TABLE.get()));
|
||||
background = guiHelper.createDrawable(BloodMagic.rl("gui/jei/alchemytable.png"), 0, 0, 118, 40);
|
||||
// craftingGridHelper = guiHelper.createCraftingGridHelper(INPUT_SLOT);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getUid()
|
||||
{
|
||||
return UID;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<ITextComponent> getTooltipStrings(RecipeBloodAltar recipe, double mouseX, double mouseY)
|
||||
// {
|
||||
// List<ITextComponent> tooltip = Lists.newArrayList();
|
||||
//
|
||||
// if (mouseX >= 13 && mouseX <= 64 && mouseY >= 27 && mouseY <= 58)
|
||||
// {
|
||||
// tooltip.add(new TranslationTextComponent("jei.bloodmagic.recipe.consumptionrate", ChatUtil.DECIMAL_FORMAT.format(recipe.getConsumeRate())));
|
||||
// tooltip.add(new TranslationTextComponent("jei.bloodmagic.recipe.drainrate", ChatUtil.DECIMAL_FORMAT.format(recipe.getDrainRate())));
|
||||
// }
|
||||
//
|
||||
// return tooltip;
|
||||
// }
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return TextHelper.localize("jei.bloodmagic.recipe.alchemytable");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RecipeAlchemyTable recipe, @Nonnull IIngredients ingredients)
|
||||
{
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
guiItemStacks.init(OUTPUT_SLOT, false, 91, 13);
|
||||
guiItemStacks.init(ORB_SLOT, true, 60, 0);
|
||||
|
||||
for (int y = 0; y < 2; ++y)
|
||||
{
|
||||
for (int x = 0; x < 3; ++x)
|
||||
{
|
||||
int index = INPUT_SLOT + x + (y * 3);
|
||||
guiItemStacks.init(index, true, x * 18, y * 18);
|
||||
}
|
||||
}
|
||||
// guiItemStacks.set(ORB_SLOT, OrbRegistry.getOrbsDownToTier(recipe.getMinimumTier()));
|
||||
// guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
|
||||
// guiItemStacks.init(OUTPUT_SLOT, false, 125, 30);
|
||||
// guiItemStacks.init(INPUT_SLOT, true, 31, 0);
|
||||
// craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
|
||||
|
||||
guiItemStacks.set(ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends RecipeAlchemyTable> getRecipeClass()
|
||||
{
|
||||
return RecipeAlchemyTable.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(RecipeAlchemyTable recipe, IIngredients ingredients)
|
||||
{
|
||||
List<ItemStack> validOrbs = OrbRegistry.getOrbsDownToTier(recipe.getMinimumTier());
|
||||
|
||||
ItemStack[] validOrbStacks = new ItemStack[validOrbs.size()];
|
||||
for (int i = 0; i < validOrbStacks.length; i++)
|
||||
{
|
||||
validOrbStacks[i] = validOrbs.get(i);
|
||||
}
|
||||
|
||||
List<Ingredient> ingList = Lists.newArrayList();
|
||||
ingList.add(Ingredient.fromStacks(validOrbStacks));
|
||||
ingList.addAll(recipe.getInput());
|
||||
ingredients.setInputIngredients(ingList);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, recipe.getOutput());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void draw(RecipeBloodAltar recipe, MatrixStack matrixStack, double mouseX, double mouseY)
|
||||
// {
|
||||
// Minecraft mc = Minecraft.getInstance();
|
||||
// String[] infoString = new String[]
|
||||
// { TextHelper.localize("jei.bloodmagic.recipe.requiredtier", NumeralHelper.toRoman(recipe.getMinimumTier().toInt())),
|
||||
// TextHelper.localize("jei.bloodmagic.recipe.requiredlp", recipe.getSyphon()) };
|
||||
// mc.fontRenderer.drawString(matrixStack, infoString[0], 90
|
||||
// - mc.fontRenderer.getStringWidth(infoString[0]) / 2, 0, Color.gray.getRGB());
|
||||
// mc.fontRenderer.drawString(matrixStack, infoString[1], 90
|
||||
// - mc.fontRenderer.getStringWidth(infoString[1]) / 2, 10, Color.gray.getRGB());
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package wayoftime.bloodmagic.iface;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An interface for items that have custom drainage behaviour when used in
|
||||
* certain alchemy recipes.
|
||||
*/
|
||||
public interface ICustomAlchemyConsumable
|
||||
{
|
||||
ItemStack drainUseOnAlchemyCraft(ItemStack stack);
|
||||
}
|
|
@ -27,5 +27,4 @@ public class IRecipeAlchemyArray extends RecipeAlchemyArray
|
|||
{
|
||||
return BloodMagicRecipeType.ARRAY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package wayoftime.bloodmagic.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicRecipeSerializers;
|
||||
|
||||
public class IRecipeAlchemyTable extends RecipeAlchemyTable
|
||||
{
|
||||
public IRecipeAlchemyTable(ResourceLocation id, List<Ingredient> input, ItemStack output, int syphon, int ticks, int minimumTier)
|
||||
{
|
||||
super(id, input, output, syphon, ticks, minimumTier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<RecipeAlchemyTable> getSerializer()
|
||||
{
|
||||
return BloodMagicRecipeSerializers.ALCHEMYTABLE.getRecipeSerializer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<RecipeAlchemyTable> getType()
|
||||
{
|
||||
return BloodMagicRecipeType.ALCHEMYTABLE;
|
||||
}
|
||||
}
|
499
src/main/java/wayoftime/bloodmagic/tile/TileAlchemyTable.java
Normal file
499
src/main/java/wayoftime/bloodmagic/tile/TileAlchemyTable.java
Normal file
|
@ -0,0 +1,499 @@
|
|||
package wayoftime.bloodmagic.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import wayoftime.bloodmagic.api.event.BloodMagicCraftedEvent;
|
||||
import wayoftime.bloodmagic.api.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulNetwork;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
import wayoftime.bloodmagic.iface.ICustomAlchemyConsumable;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
import wayoftime.bloodmagic.orb.IBloodOrb;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemyTable;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
|
||||
public class TileAlchemyTable extends TileInventory
|
||||
implements ISidedInventory, ITickableTileEntity, INamedContainerProvider
|
||||
{
|
||||
@ObjectHolder("bloodmagic:alchemytable")
|
||||
public static TileEntityType<TileAlchemyTable> TYPE;
|
||||
|
||||
public static final int orbSlot = 6;
|
||||
public static final int outputSlot = 7;
|
||||
|
||||
public Direction direction = Direction.NORTH;
|
||||
public boolean isSlave = false;
|
||||
public int burnTime = 0;
|
||||
public int ticksRequired = 1;
|
||||
|
||||
public BlockPos connectedPos = BlockPos.ZERO;
|
||||
public boolean[] blockedSlots = new boolean[]
|
||||
{ false, false, false, false, false, false };
|
||||
|
||||
public TileAlchemyTable(TileEntityType<?> type)
|
||||
{
|
||||
super(type, 8, "alchemytable");
|
||||
}
|
||||
|
||||
public TileAlchemyTable()
|
||||
{
|
||||
this(TYPE);
|
||||
}
|
||||
|
||||
public void setInitialTableParameters(Direction direction, boolean isSlave, BlockPos connectedPos)
|
||||
{
|
||||
this.isSlave = isSlave;
|
||||
this.connectedPos = connectedPos;
|
||||
|
||||
if (!isSlave)
|
||||
{
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInvisible()
|
||||
{
|
||||
return isSlave();
|
||||
}
|
||||
|
||||
public boolean isInputSlotAccessible(int slot)
|
||||
{
|
||||
return !(slot < 6 && slot >= 0) || !blockedSlots[slot];
|
||||
}
|
||||
|
||||
public void toggleInputSlotAccessible(int slot)
|
||||
{
|
||||
if (slot < 6 && slot >= 0)
|
||||
blockedSlots[slot] = !blockedSlots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(CompoundNBT tag)
|
||||
{
|
||||
super.deserialize(tag);
|
||||
|
||||
isSlave = tag.getBoolean("isSlave");
|
||||
direction = Direction.byIndex(tag.getInt(Constants.NBT.DIRECTION));
|
||||
connectedPos = new BlockPos(tag.getInt(Constants.NBT.X_COORD), tag.getInt(Constants.NBT.Y_COORD), tag.getInt(Constants.NBT.Z_COORD));
|
||||
|
||||
burnTime = tag.getInt("burnTime");
|
||||
ticksRequired = tag.getInt("ticksRequired");
|
||||
|
||||
byte[] array = tag.getByteArray("blockedSlots");
|
||||
for (int i = 0; i < array.length; i++) blockedSlots[i] = array[i] != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT serialize(CompoundNBT tag)
|
||||
{
|
||||
super.serialize(tag);
|
||||
|
||||
tag.putBoolean("isSlave", isSlave);
|
||||
tag.putInt(Constants.NBT.DIRECTION, direction.getIndex());
|
||||
tag.putInt(Constants.NBT.X_COORD, connectedPos.getX());
|
||||
tag.putInt(Constants.NBT.Y_COORD, connectedPos.getY());
|
||||
tag.putInt(Constants.NBT.Z_COORD, connectedPos.getZ());
|
||||
|
||||
tag.putInt("burnTime", burnTime);
|
||||
tag.putInt("ticksRequired", ticksRequired);
|
||||
|
||||
byte[] blockedSlotArray = new byte[blockedSlots.length];
|
||||
for (int i = 0; i < blockedSlots.length; i++) blockedSlotArray[i] = (byte) (blockedSlots[i] ? 1 : 0);
|
||||
|
||||
tag.putByteArray("blockedSlots", blockedSlotArray);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> capability, Direction facing)
|
||||
{
|
||||
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
{
|
||||
if (this.isSlave())
|
||||
{
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
return (LazyOptional<T>) tile.getCapability(capability, facing);
|
||||
}
|
||||
} else
|
||||
{
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case DOWN:
|
||||
return new int[]
|
||||
{ outputSlot };
|
||||
case UP:
|
||||
return new int[]
|
||||
{ orbSlot };
|
||||
default:
|
||||
return new int[]
|
||||
{ 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack stack, Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DOWN:
|
||||
return index != outputSlot && index != orbSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
if (this.isSlave)
|
||||
{
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
return ((TileAlchemyTable) tile).canInsertItem(index, stack, direction);
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DOWN:
|
||||
return index == outputSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
if (this.isSlave)
|
||||
{
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
return ((TileAlchemyTable) tile).canExtractItem(index, stack, direction);
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getAccessibleInputSlots(Direction direction)
|
||||
{
|
||||
List<Integer> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (isInputSlotAccessible(i))
|
||||
{
|
||||
list.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if (isSlave())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> inputList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (!getStackInSlot(i).isEmpty())
|
||||
{
|
||||
inputList.add(getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
int tier = getTierOfOrb();
|
||||
|
||||
// Simple recipes
|
||||
RecipeAlchemyTable recipeAlchemyTable = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTable(world, inputList);
|
||||
if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote
|
||||
&& tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon())))
|
||||
{
|
||||
if (burnTime == 1)
|
||||
notifyUpdate();
|
||||
|
||||
if (canCraft(recipeAlchemyTable.getOutput()))
|
||||
{
|
||||
ticksRequired = recipeAlchemyTable.getTicks();
|
||||
burnTime++;
|
||||
if (burnTime >= ticksRequired)
|
||||
{
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
if (recipeAlchemyTable.getSyphon() > 0)
|
||||
{
|
||||
if (consumeLp(recipeAlchemyTable.getSyphon()) < recipeAlchemyTable.getSyphon())
|
||||
{
|
||||
// There was not enough LP to craft or there was no orb
|
||||
burnTime = 0;
|
||||
notifyUpdate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack[] inputs = new ItemStack[0];
|
||||
for (ItemStack stack : inputList) ArrayUtils.add(inputs, stack.copy());
|
||||
|
||||
BloodMagicCraftedEvent.AlchemyTable event = new BloodMagicCraftedEvent.AlchemyTable(recipeAlchemyTable.getOutput().copy(), inputs);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
ItemStack outputSlotStack = getStackInSlot(outputSlot);
|
||||
if (outputSlotStack.isEmpty())
|
||||
setInventorySlotContents(outputSlot, event.getOutput());
|
||||
else
|
||||
outputSlotStack.grow(event.getOutput().getCount());
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ItemStack currentStack = getStackInSlot(i);
|
||||
if (currentStack.getItem().hasContainerItem(currentStack))
|
||||
setInventorySlotContents(i, currentStack.getItem().getContainerItem(currentStack));
|
||||
else if (currentStack.getItem() instanceof ICustomAlchemyConsumable)
|
||||
setInventorySlotContents(i, ((ICustomAlchemyConsumable) currentStack.getItem()).drainUseOnAlchemyCraft(currentStack));
|
||||
else
|
||||
currentStack.shrink(1);
|
||||
}
|
||||
|
||||
burnTime = 0;
|
||||
notifyUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
burnTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double getProgressForGui()
|
||||
{
|
||||
return ((double) burnTime) / ticksRequired;
|
||||
}
|
||||
|
||||
private boolean canCraft(ItemStack output)
|
||||
{
|
||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||
if (output.isEmpty())
|
||||
return false;
|
||||
if (currentOutputStack.isEmpty())
|
||||
return true;
|
||||
if (!ItemHandlerHelper.canItemStacksStack(output, currentOutputStack))
|
||||
return false;
|
||||
int result = currentOutputStack.getCount() + output.getCount();
|
||||
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
|
||||
}
|
||||
|
||||
public int getTierOfOrb()
|
||||
{
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
|
||||
return orb == null ? 0 : orb.getTier();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getContainedLp()
|
||||
{
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
Binding binding = ((IBindable) orbStack.getItem()).getBinding(orbStack);
|
||||
if (binding == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(binding);
|
||||
|
||||
return network.getCurrentEssence();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void craftItem(List<ItemStack> inputList, RecipeAlchemyTable recipe)
|
||||
{
|
||||
ItemStack outputStack = recipe.getOutput();
|
||||
if (this.canCraft(outputStack))
|
||||
{
|
||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||
|
||||
ItemStack[] inputs = new ItemStack[0];
|
||||
for (ItemStack stack : inputList) ArrayUtils.add(inputs, stack.copy());
|
||||
|
||||
BloodMagicCraftedEvent.AlchemyTable event = new BloodMagicCraftedEvent.AlchemyTable(outputStack.copy(), inputs);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
outputStack = event.getOutput();
|
||||
|
||||
if (currentOutputStack.isEmpty())
|
||||
{
|
||||
setInventorySlotContents(outputSlot, outputStack);
|
||||
} else if (ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack))
|
||||
{
|
||||
currentOutputStack.grow(outputStack.getCount());
|
||||
}
|
||||
|
||||
consumeInventory(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
public int consumeLp(int requested)
|
||||
{
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (NetworkHelper.syphonFromContainer(orbStack, SoulTicket.item(orbStack, world, pos, requested)))
|
||||
{
|
||||
return requested;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void consumeInventory(RecipeAlchemyTable recipe)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ItemStack inputStack = getStackInSlot(i);
|
||||
if (!inputStack.isEmpty())
|
||||
{
|
||||
if (inputStack.getItem().hasContainerItem(inputStack))
|
||||
{
|
||||
setInventorySlotContents(i, inputStack.getItem().getContainerItem(inputStack));
|
||||
continue;
|
||||
}
|
||||
|
||||
inputStack.shrink(1);
|
||||
if (inputStack.isEmpty())
|
||||
{
|
||||
setInventorySlotContents(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Direction getDirection()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
public boolean isSlave()
|
||||
{
|
||||
return isSlave;
|
||||
}
|
||||
|
||||
public int getBurnTime()
|
||||
{
|
||||
return burnTime;
|
||||
}
|
||||
|
||||
public int getTicksRequired()
|
||||
{
|
||||
return ticksRequired;
|
||||
}
|
||||
|
||||
public BlockPos getConnectedPos()
|
||||
{
|
||||
return connectedPos;
|
||||
}
|
||||
|
||||
public boolean[] getBlockedSlots()
|
||||
{
|
||||
return blockedSlots;
|
||||
}
|
||||
|
||||
public static int getOrbSlot()
|
||||
{
|
||||
return orbSlot;
|
||||
}
|
||||
|
||||
public static int getOutputSlot()
|
||||
{
|
||||
return outputSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_)
|
||||
{
|
||||
assert world != null;
|
||||
return new ContainerAlchemyTable(this, p_createMenu_1_, p_createMenu_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return new StringTextComponent("Alchemy Table");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package wayoftime.bloodmagic.tile.contailer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.container.ClickType;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.orb.IBloodOrb;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
public class ContainerAlchemyTable extends Container
|
||||
{
|
||||
public final TileAlchemyTable tileTable;
|
||||
|
||||
// public ContainerSoulForge(InventoryPlayer inventoryPlayer, IInventory tileForge)
|
||||
// {
|
||||
// this.tileForge = tileForge;
|
||||
//
|
||||
// }
|
||||
|
||||
public ContainerAlchemyTable(int windowId, PlayerInventory playerInventory, PacketBuffer extraData)
|
||||
{
|
||||
this((TileAlchemyTable) playerInventory.player.world.getTileEntity(extraData.readBlockPos()), windowId, playerInventory);
|
||||
}
|
||||
|
||||
public ContainerAlchemyTable(@Nullable TileAlchemyTable tile, int windowId, PlayerInventory playerInventory)
|
||||
{
|
||||
super(BloodMagicBlocks.ALCHEMY_TABLE_CONTAINER.get(), windowId);
|
||||
this.tileTable = tile;
|
||||
this.setup(playerInventory, tile);
|
||||
}
|
||||
|
||||
public void setup(PlayerInventory inventory, IInventory tileForge)
|
||||
{
|
||||
this.addSlot(new Slot(tileTable, 0, 62, 15));
|
||||
this.addSlot(new Slot(tileTable, 1, 80, 51));
|
||||
this.addSlot(new Slot(tileTable, 2, 62, 87));
|
||||
this.addSlot(new Slot(tileTable, 3, 26, 87));
|
||||
this.addSlot(new Slot(tileTable, 4, 8, 51));
|
||||
this.addSlot(new Slot(tileTable, 5, 26, 15));
|
||||
this.addSlot(new SlotOrb(tileTable, TileAlchemyTable.orbSlot, 152, 51));
|
||||
this.addSlot(new SlotOutput(tileTable, TileAlchemyTable.outputSlot, 44, 51));
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
{
|
||||
addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 123 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
addSlot(new Slot(inventory, i, 8 + i * 18, 181));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player)
|
||||
{
|
||||
PlayerInventory inventoryPlayer = player.inventory;
|
||||
|
||||
if (slotId < 6 && slotId >= 0)
|
||||
{
|
||||
Slot slot = this.getSlot(slotId);
|
||||
if (!slot.getHasStack() && inventoryPlayer.getItemStack().isEmpty())
|
||||
{
|
||||
((TileAlchemyTable) tileTable).toggleInputSlotAccessible(slotId);
|
||||
}
|
||||
}
|
||||
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index)
|
||||
{
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
Slot slot = this.inventorySlots.get(index);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (index == 7)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 8, 8 + 36, true))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
} else if (index > 7)
|
||||
{
|
||||
if (itemstack1.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 6, 7, false))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.mergeItemStack(itemstack1, 0, 6, false))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.mergeItemStack(itemstack1, 8, 8 + 36, false))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (itemstack1.getCount() == 0)
|
||||
{
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.getCount() == itemstack.getCount())
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
slot.onTake(playerIn, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn)
|
||||
{
|
||||
return this.tileTable.isUsableByPlayer(playerIn);
|
||||
}
|
||||
|
||||
private class SlotOrb extends Slot
|
||||
{
|
||||
public SlotOrb(IInventory inventory, int slotIndex, int x, int y)
|
||||
{
|
||||
super(inventory, slotIndex, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
return itemStack.getItem() instanceof IBloodOrb;
|
||||
}
|
||||
}
|
||||
|
||||
private class SlotOutput extends Slot
|
||||
{
|
||||
public SlotOutput(IInventory inventory, int slotIndex, int x, int y)
|
||||
{
|
||||
super(inventory, slotIndex, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -153,6 +153,9 @@ public class Constants
|
|||
public static final String INPUT_FLUID = "inputfluid";
|
||||
public static final String OUTPUT_FLUID = "outputfluid";
|
||||
|
||||
public static final String SYPHON = "syphon";
|
||||
public static final String TICKS = "ticks";
|
||||
|
||||
public static final String ALTAR_TIER = Constants.NBT.ALTAR_TIER;
|
||||
public static final String ALTAR_SYPHON = "altarSyphon";
|
||||
public static final String ALTAR_CONSUMPTION_RATE = Constants.NBT.ALTAR_CONSUMPTION_RATE;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"variants": {
|
||||
"direction=north,invisible=false": {
|
||||
"model": "bloodmagic:block/alchemytable",
|
||||
"y": 90
|
||||
},
|
||||
"direction=south,invisible=false": {
|
||||
"model": "bloodmagic:block/alchemytable",
|
||||
"y": 270
|
||||
},
|
||||
"direction=east,invisible=false": {
|
||||
"model": "bloodmagic:block/alchemytable",
|
||||
"y": 180
|
||||
},
|
||||
"direction=west,invisible=false": {
|
||||
"model": "bloodmagic:block/alchemytable"
|
||||
},
|
||||
"direction=north,invisible=true": {
|
||||
"model": "bloodmagic:block/alchemytable_invis"
|
||||
},
|
||||
"direction=south,invisible=true": {
|
||||
"model": "bloodmagic:block/alchemytable_invis"
|
||||
},
|
||||
"direction=east,invisible=true": {
|
||||
"model": "bloodmagic:block/alchemytable_invis"
|
||||
},
|
||||
"direction=west,invisible=true": {
|
||||
"model": "bloodmagic:block/alchemytable_invis"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "block/block",
|
||||
"loader": "forge:obj",
|
||||
"flip-v": true,
|
||||
"model": "bloodmagic:models/block/modelalchemytable.obj",
|
||||
"textures": {
|
||||
"default": "bloodmagic:models/alchemytable",
|
||||
"particle": "#default"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"textures": {
|
||||
"particle": "bloodmagic:models/alchemytable"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# Blender v2.76 (sub 0) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib ModelAlchemyTable.mtl
|
||||
mtllib modelalchemytable.mtl
|
||||
o Decanter1
|
||||
v -0.125000 0.837500 0.718750
|
||||
v -0.306111 0.837500 0.767279
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "bloodmagic:block/alchemytable",
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ 30, 225, 0 ],
|
||||
"translation": [ -2.5, -1, 0 ],
|
||||
"scale":[ 0.4, 0.4, 0.4 ]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 16 KiB |
Loading…
Reference in a new issue