diff --git a/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 b/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 index a178adec..b790cb05 100644 --- a/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 +++ b/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 @@ -1,4 +1,4 @@ -// 1.19.2 2024-07-22T13:17:30.0184464 Registrate Provider for createindustry [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +// 1.19.2 2024-07-22T19:15:46.2542473 Registrate Provider for createindustry [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] 618a4fde84a56aca00c6990dbde278f8fb76bb1e assets/createindustry/blockstates/accumulator.json 50db526af77cf0ead08cadfd3f7daa8b84a40312 assets/createindustry/blockstates/air_intake.json 429437419b2ec98bd716e7ba15583b84da7488d5 assets/createindustry/blockstates/aluminum_bars.json @@ -1916,6 +1916,7 @@ dad9566f47a93c6e34c837223d939fdf3eebaac5 data/createindustry/recipes/yellow_conc 1e45593e1375420bd23210dc0f9099a337e94c78 data/createindustry/recipes/yellow_concrete_wall_from_yellow_concrete_stonecutting.json 0165af18f74ef648bf5bc43fa6a3e1bfecc28d37 data/createindustry/recipes/zinc_frame_from_ingots_zinc_stonecutting.json daa491cd60ae376335b7127363d95f371386facf data/createindustry/recipes/zinc_truss_from_ingots_zinc_stonecutting.json +9a8080fd49571cad3f24ea0807d9c0c44c117734 data/createindustry/tags/blocks/air_intake_transparent.json 503c7a40ea8a115006c886e6491ac53f80e7e6fe data/createindustry/tags/fluids/flammable.json 87856087484f006ce6cb7fd66fb9f604230cf4d0 data/createindustry/tags/fluids/gas.json 9790752bec1ad9dc61eb08c66e62caa28516713c data/createindustry/tags/items/stone_types/bauxite.json diff --git a/src/generated/resources/.cache/5b8c0f5df972d0059948e36f3c0712dca4487541 b/src/generated/resources/.cache/5b8c0f5df972d0059948e36f3c0712dca4487541 index b6898fa7..d3e18fbc 100644 --- a/src/generated/resources/.cache/5b8c0f5df972d0059948e36f3c0712dca4487541 +++ b/src/generated/resources/.cache/5b8c0f5df972d0059948e36f3c0712dca4487541 @@ -1,4 +1,4 @@ -// 1.19.2 2024-07-22T13:27:08.9267636 TFMG's Processing Recipes +// 1.19.2 2024-07-22T19:15:46.2532461 TFMG's Processing Recipes b37b7a8bacea5e80c7e080905b858b915af79763 data/createindustry/recipes/casting/steel.json bfa68e40711dec40213c454b51825a08fa7135bf data/createindustry/recipes/coking/charcoal.json 54e9218c4e8656d38cf51f2af80652a1bd251593 data/createindustry/recipes/coking/coal_coke.json @@ -44,6 +44,7 @@ ead743154be8c100fea443696d3c93835ac1c584 data/createindustry/recipes/mixing/conc 63ab0af81c7c3c721d1192ac610b61756c3643dc data/createindustry/recipes/mixing/cooling_fluid.json 86220a406057c4281aca95f93589e5721d2b8b82 data/createindustry/recipes/mixing/copper_sulfate.json d714d33c8ee6cd65f925464d663e06bcbd87709c data/createindustry/recipes/mixing/gun_powder.json +2f98cbeaab5ebaffea418d448ed5ea481237adad data/createindustry/recipes/mixing/heated_air_tank.json cab04677cf05d6c9f14bcaa6e201c3240c0f6998 data/createindustry/recipes/mixing/liquid_asphalt.json 01351b9d90e07c1396b574aab4fc6e0e9cdb1b2a data/createindustry/recipes/mixing/liquid_concrete.json 70db70b38822f87335fb197912837bd2ebd46348 data/createindustry/recipes/mixing/liquid_plastic_from_ethylene.json diff --git a/src/generated/resources/data/createindustry/recipes/mixing/heated_air_tank.json b/src/generated/resources/data/createindustry/recipes/mixing/heated_air_tank.json new file mode 100644 index 00000000..9ef6f635 --- /dev/null +++ b/src/generated/resources/data/createindustry/recipes/mixing/heated_air_tank.json @@ -0,0 +1,15 @@ +{ + "type": "create:mixing", + "heatRequirement": "superheated", + "ingredients": [ + { + "item": "createindustry:air_bucket" + } + ], + "processingTime": 1000, + "results": [ + { + "item": "createindustry:heated_air_bucket" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/createindustry/tags/blocks/air_intake_transparent.json b/src/generated/resources/data/createindustry/tags/blocks/air_intake_transparent.json new file mode 100644 index 00000000..450386c9 --- /dev/null +++ b/src/generated/resources/data/createindustry/tags/blocks/air_intake_transparent.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#create:fan_transparent", + "minecraft:magma_block" + ] +} \ No newline at end of file diff --git a/src/main/java/com/drmangotea/createindustry/base/TFMGTools.java b/src/main/java/com/drmangotea/createindustry/base/TFMGTools.java index ef35f74a..bbb351d3 100644 --- a/src/main/java/com/drmangotea/createindustry/base/TFMGTools.java +++ b/src/main/java/com/drmangotea/createindustry/base/TFMGTools.java @@ -23,5 +23,20 @@ public class TFMGTools { } - + + public static String formatEnergy(int n) { + double var10000; + if (n >= 1000000000) { + var10000 = (double)Math.round((double)n / 1.0E8); + return var10000 / 10.0 + "G"; + } else if (n >= 1000000) { + var10000 = (double)Math.round((double)n / 100000.0); + return var10000 / 10.0 + "M"; + } else if (n >= 1000) { + var10000 = (double)Math.round((double)n / 100.0); + return var10000 / 10.0 + "K"; + } else { + return "" + n; + } + } } diff --git a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGProcessingRecipeGen.java b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGProcessingRecipeGen.java index b8c9dfd6..c43c511f 100644 --- a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGProcessingRecipeGen.java +++ b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGProcessingRecipeGen.java @@ -72,8 +72,7 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider { * Create a processing recipe with a single itemstack ingredient, using its id * as the name of the recipe */ - protected > GeneratedRecipe create(String namespace, - Supplier singleIngredient, UnaryOperator> transform) { + protected > GeneratedRecipe create(String namespace, Supplier singleIngredient, UnaryOperator> transform) { ProcessingRecipeSerializer serializer = getSerializer(); GeneratedRecipe generatedRecipe = c -> { ItemLike itemLike = singleIngredient.get(); @@ -138,6 +137,8 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider { }; } + + @Override public String getName() { return "TFMG's Processing Recipes: " + getRecipeType().getId() diff --git a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGRecipeProvider.java b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGRecipeProvider.java index 100c4f4c..2b1583bc 100644 --- a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGRecipeProvider.java +++ b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/TFMGRecipeProvider.java @@ -300,6 +300,9 @@ public class TFMGRecipeProvider extends RecipeProvider { public static ItemLike unfinishedTurbineEngine() { return TFMGItems.UNFINISHED_TURBINE_ENGINE.get(); } + public static ItemLike magneticIngot() { + return TFMGItems.MAGNETIC_INGOT.get(); + } } public static class F { diff --git a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/create/MixingGen.java b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/create/MixingGen.java index 243d9b71..6586d39b 100644 --- a/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/create/MixingGen.java +++ b/src/main/java/com/drmangotea/createindustry/base/datagen/recipe/create/MixingGen.java @@ -105,7 +105,13 @@ public class MixingGen extends TFMGProcessingRecipeGen { zincSulfate = create(CreateTFMG.asResource("zinc_sulfate"), b -> b .require(F.sulfuricAcid(), 500) .require(IT.zincIngot()) - .output(I.zincSulfate(), 1)) + .output(I.zincSulfate(), 1)), + + heatedAirTank = create(CreateTFMG.asResource("heated_air_tank"), b -> b + .require(F.airTank()) + .output(F.heatedAirTank(), 1) + .requiresHeat(HeatCondition.SUPERHEATED) + .duration(1000)) ; public MixingGen(DataGenerator generator) { diff --git a/src/main/java/com/drmangotea/createindustry/blocks/electricity/polarizer/PolarizerBlockEntity.java b/src/main/java/com/drmangotea/createindustry/blocks/electricity/polarizer/PolarizerBlockEntity.java index 88ac1a47..87097121 100644 --- a/src/main/java/com/drmangotea/createindustry/blocks/electricity/polarizer/PolarizerBlockEntity.java +++ b/src/main/java/com/drmangotea/createindustry/blocks/electricity/polarizer/PolarizerBlockEntity.java @@ -2,8 +2,13 @@ package com.drmangotea.createindustry.blocks.electricity.polarizer; import com.drmangotea.createindustry.base.util.TFMGUtils; import com.drmangotea.createindustry.blocks.electricity.base.ElectricBlockEntity; +import com.drmangotea.createindustry.recipes.polarizing.PolarizingRecipe; import com.drmangotea.createindustry.registry.TFMGItems; +import com.drmangotea.createindustry.registry.TFMGRecipeTypes; +import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.content.kinetics.press.PressingRecipe; +import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipe; import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.SmartInventory; import com.simibubi.create.foundation.utility.Lang; @@ -12,9 +17,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -28,6 +35,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper; import javax.annotation.Nonnull; import java.util.List; +import java.util.Optional; import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; @@ -36,6 +44,7 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo public LazyOptional itemCapability; public SmartInventory inventory; + Optional recipe; public int timer = 0; public PolarizerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { @@ -45,42 +54,61 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo this.itemCapability = LazyOptional.of(() -> new CombinedInvWrapper(this.inventory)); } - - + @Override public void tick() { super.tick(); if(voltage<200) { - timer = 0; + timer = -1; return; } - - if(!inventory.getItem(0).is(TFMGItems.STEEL_INGOT.get())) { - timer = 0; + if (inventory.getItem(0).isEmpty()) { + timer = -1; return; } - - - if(energy.getEnergyStored()!=0) { - useEnergy(250); + + recipe = this.getRecipe(inventory.getItem(0)); + + if (recipe.isEmpty()) { + timer = -1; + return; + } + + + if(!recipe.get().getIngredients().get(0).test(inventory.getItem(0))) { + timer = -1; + return; + } + + if(energy.getEnergyStored() != 0) { + useEnergy(recipe.get().getEnergy()); if (!inventory.isEmpty()) { - if (timer < 100) { + if (timer < recipe.get().getProcessingDuration()) { timer++; } else { - - timer = 0; - inventory.setStackInSlot(0, TFMGItems.MAGNETIC_INGOT.asStack()); + timer = -1; + inventory.setStackInSlot(0, recipe.get().getResultItem()); TFMGUtils.spawnElectricParticles(level,getBlockPos()); sendStuff(); } } - }else timer =0; + } + else timer = -1; } - + + public Optional getRecipe(ItemStack item) { + Optional assemblyRecipe = SequencedAssemblyRecipe.getRecipe(this.level, item, TFMGRecipeTypes.POLARIZING.getType(), PolarizingRecipe.class); + if (assemblyRecipe.isPresent()) { + return assemblyRecipe; + } else { + inventory.setItem(0, item); + return TFMGRecipeTypes.POLARIZING.find(inventory, this.level); + } + } @@ -96,68 +124,42 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo } public boolean playerInteract(Player player, InteractionHand hand){ - - ; - if(inventory.isEmpty()) { - - - if (player.getItemInHand(hand).is(TFMGItems.STEEL_INGOT.get())) { - - - inventory.setStackInSlot(0, TFMGItems.STEEL_INGOT.asStack()); - sendStuff(); - - player.getItemInHand(hand).shrink(1); - - return true; - } - - + ItemStack stack = player.getItemInHand(hand).copy(); + stack.setCount(1); + inventory.setStackInSlot(0, stack); + sendStuff(); + player.getItemInHand(hand).shrink(1); + return true; } else { - if (player.getItemInHand(hand).isEmpty()) { - player.setItemInHand(hand,inventory.getItem(0)); - inventory.setStackInSlot(0, Blocks.AIR.asItem().getDefaultInstance()); + inventory.setStackInSlot(0, ItemStack.EMPTY); sendStuff(); - - - return true; } } - - - return false; } @Override - @SuppressWarnings("removal") public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - - if(energy.getEnergyStored()==0){ Lang.translate("goggles.electric_machine.no_power") .style(ChatFormatting.DARK_RED) .forGoggles(tooltip, 1); - return true; - } - if(energy.getEnergyStored()==0) { + return true; + } + if(voltage < 200) { Lang.translate("goggles.electric_machine.insufficient_voltage") .style(ChatFormatting.RED) .forGoggles(tooltip, 1); return true; } - if(timer>0) { + if(timer>0 && recipe.isPresent()) { Lang.translate("goggles.blast_furnace.status.running") .style(ChatFormatting.GOLD) .forGoggles(tooltip, 1); - Lang.translate("goggles.coke_oven.progress", timer) - .style(ChatFormatting.GREEN) - .add(Lang.translate("goggles.misc.percent_symbol") - .style(ChatFormatting.GREEN)) - .forGoggles(tooltip, 1); + tooltip.add(percent(timer, recipe.get()).withStyle(ChatFormatting.GREEN)); } else @@ -183,7 +185,14 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo } - + + + private MutableComponent percent(int timer, PolarizingRecipe recipe) { + int percent = Math.round((float) (timer / recipe.getProcessingDuration()) * 100); + return Lang.builder().text(" ") + .text(percent + "%") + .component(); + } @Override diff --git a/src/main/java/com/drmangotea/createindustry/recipes/jei/PolarizingCategory.java b/src/main/java/com/drmangotea/createindustry/recipes/jei/PolarizingCategory.java new file mode 100644 index 00000000..c3800d03 --- /dev/null +++ b/src/main/java/com/drmangotea/createindustry/recipes/jei/PolarizingCategory.java @@ -0,0 +1,69 @@ +package com.drmangotea.createindustry.recipes.jei; + +import com.drmangotea.createindustry.base.TFMGTools; +import com.drmangotea.createindustry.recipes.jei.machines.Polarizer; +import com.drmangotea.createindustry.recipes.polarizing.PolarizingRecipe; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mrh0.createaddition.util.Util; +import com.simibubi.create.compat.jei.category.CreateRecipeCategory; +import com.simibubi.create.compat.jei.category.animations.AnimatedPress; +import com.simibubi.create.compat.jei.category.sequencedAssembly.SequencedAssemblySubCategory; +import com.simibubi.create.content.kinetics.deployer.DeployerApplicationRecipe; +import com.simibubi.create.content.processing.sequenced.IAssemblyRecipe; +import com.simibubi.create.content.processing.sequenced.SequencedRecipe; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.utility.Lang; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.builder.IRecipeSlotBuilder; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.world.item.crafting.Ingredient; + +public class PolarizingCategory extends CreateRecipeCategory { + private Polarizer polarizer = new Polarizer(); + + public PolarizingCategory(Info info) { + super(info); + } + + public void setRecipe(IRecipeLayoutBuilder builder, PolarizingRecipe recipe, IFocusGroup focuses) { + builder.addSlot(RecipeIngredientRole.INPUT, 15, 9).setBackground(getRenderedSlot(), -1, -1).addIngredients(recipe.getIngredients().get(0)); + builder.addSlot(RecipeIngredientRole.OUTPUT, 140, 28).setBackground(getRenderedSlot(), -1, -1).addItemStack(recipe.getResultItem()); + } + + public void draw(PolarizingRecipe recipe, IRecipeSlotsView iRecipeSlotsView, PoseStack matrixStack, double mouseX, double mouseY) { + AllGuiTextures.JEI_ARROW.render(matrixStack, 85, 32); + AllGuiTextures.JEI_DOWN_ARROW.render(matrixStack, 43, 4); + this.polarizer.draw(matrixStack, 48, 27); + Minecraft.getInstance().font.draw(matrixStack, TFMGTools.formatEnergy(recipe.getEnergy()) + "fe", 86.0F, 9.0F, 4210752); + } + + public static class AssemblyPolarizing extends SequencedAssemblySubCategory { + Polarizer polarizer = new Polarizer(); + + public AssemblyPolarizing() { + super(25); + } + + public void setRecipe(IRecipeLayoutBuilder builder, SequencedRecipe recipe, IFocusGroup focuses, int x) { + IRecipeSlotBuilder slot = builder.addSlot(RecipeIngredientRole.INPUT, x + 4, 15).setBackground(CreateRecipeCategory.getRenderedSlot(), -1, -1).addIngredients(recipe.getRecipe().getIngredients().get(0)); + IAssemblyRecipe var7 = recipe.getAsAssemblyRecipe(); + if (var7 instanceof PolarizingRecipe polarizingRecipe) { + slot.addTooltipCallback((recipeSlotView, tooltip) -> { + tooltip.add(1, Lang.text(TFMGTools.formatEnergy(polarizingRecipe.getEnergy()) + "fe").component().withStyle(ChatFormatting.GOLD)); + }); + } + } + + public void draw(SequencedRecipe recipe, PoseStack ms, double mouseX, double mouseY, int index) { + ms.pushPose(); + ms.translate(0.0, 51.5, 0.0); + ms.scale(0.6F, 0.6F, 0.6F); + this.polarizer.draw(ms, this.getWidth() / 2, 30); + ms.popPose(); + } + } +} diff --git a/src/main/java/com/drmangotea/createindustry/recipes/jei/TFMGJei.java b/src/main/java/com/drmangotea/createindustry/recipes/jei/TFMGJei.java index 9e724578..01c38211 100644 --- a/src/main/java/com/drmangotea/createindustry/recipes/jei/TFMGJei.java +++ b/src/main/java/com/drmangotea/createindustry/recipes/jei/TFMGJei.java @@ -6,6 +6,7 @@ import com.drmangotea.createindustry.recipes.coking.CokingRecipe; import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe; import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe; import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe; +import com.drmangotea.createindustry.recipes.polarizing.PolarizingRecipe; import com.drmangotea.createindustry.registry.TFMGBlocks; import com.drmangotea.createindustry.registry.TFMGFluids; import com.drmangotea.createindustry.registry.TFMGRecipeTypes; @@ -97,8 +98,14 @@ public class TFMGJei implements IModPlugin { .catalyst(TFMGBlocks.BLAST_STOVE::get) .doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.getBucket().get()) .emptyBackground(177, 150) - .build("gas_blasting", GasBlastingCategory::new) + .build("gas_blasting", GasBlastingCategory::new), + polarizing = builder(PolarizingRecipe.class) + .addTypedRecipes(TFMGRecipeTypes.POLARIZING) + .catalyst(TFMGBlocks.POLARIZER::get) + .itemIcon(TFMGBlocks.POLARIZER.get()) + .emptyBackground(177, 53) + .build("polarizing", PolarizingCategory::new) ; diff --git a/src/main/java/com/drmangotea/createindustry/recipes/jei/machines/Polarizer.java b/src/main/java/com/drmangotea/createindustry/recipes/jei/machines/Polarizer.java new file mode 100644 index 00000000..5853d044 --- /dev/null +++ b/src/main/java/com/drmangotea/createindustry/recipes/jei/machines/Polarizer.java @@ -0,0 +1,24 @@ +package com.drmangotea.createindustry.recipes.jei.machines; + +import com.drmangotea.createindustry.blocks.electricity.polarizer.PolarizerBlock; +import com.drmangotea.createindustry.registry.TFMGBlocks; +import com.mojang.blaze3d.vertex.PoseStack; +import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.element.GuiGameElement; +import net.minecraft.core.Direction; + +public class Polarizer extends AnimatedKinetics { + public Polarizer() { + } + + public void draw(PoseStack matrixStack, int xOffset, int yOffset) { + matrixStack.pushPose(); + matrixStack.translate(xOffset, yOffset, 0.0); + AllGuiTextures.JEI_SHADOW.render(matrixStack, -16, 13); + matrixStack.translate(-2.0, 18.0, 0.0); + int scale = 22; + GuiGameElement.of(TFMGBlocks.POLARIZER.getDefaultState().setValue(PolarizerBlock.FACING, Direction.NORTH)).rotateBlock(22.5, 22.5, 0.0).scale(scale).render(matrixStack); + matrixStack.popPose(); + } +} diff --git a/src/main/java/com/drmangotea/createindustry/recipes/polarizing/PolarizingRecipe.java b/src/main/java/com/drmangotea/createindustry/recipes/polarizing/PolarizingRecipe.java new file mode 100644 index 00000000..a187ec84 --- /dev/null +++ b/src/main/java/com/drmangotea/createindustry/recipes/polarizing/PolarizingRecipe.java @@ -0,0 +1,90 @@ +package com.drmangotea.createindustry.recipes.polarizing; + +import com.drmangotea.createindustry.recipes.jei.PolarizingCategory; +import com.drmangotea.createindustry.registry.TFMGBlocks; +import com.drmangotea.createindustry.registry.TFMGRecipeTypes; +import com.google.gson.JsonObject; +import com.simibubi.create.compat.jei.category.sequencedAssembly.SequencedAssemblySubCategory; +import com.simibubi.create.content.processing.recipe.ProcessingRecipe; +import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder; +import com.simibubi.create.content.processing.sequenced.IAssemblyRecipe; +import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; +import net.minecraftforge.items.wrapper.RecipeWrapper; + +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; + +@ParametersAreNonnullByDefault +public class PolarizingRecipe extends ProcessingRecipe implements IAssemblyRecipe { + private int energy; + public PolarizingRecipe(ProcessingRecipeBuilder.ProcessingRecipeParams params) { + super(TFMGRecipeTypes.POLARIZING, params); + } + + @Override + protected int getMaxInputCount() { + return 1; + } + + @Override + protected int getMaxOutputCount() { + return 1; + } + + public boolean matches(RecipeWrapper inv, Level worldIn) { + return !inv.isEmpty() && this.ingredients.get(0).test(inv.getItem(0)); + } + + public int getEnergy() { + return this.energy; + } + + @Override + public Component getDescriptionForAssembly() { + return Lang.translateDirect("recipe.assembly.polarizing"); + } + + @Override + public void addRequiredMachines(Set set) { + set.add(TFMGBlocks.POLARIZER.get()); + } + + @Override + public void addAssemblyIngredients(List list) { + + } + + @Override + public Supplier> getJEISubCategory() { + return () -> PolarizingCategory.AssemblyPolarizing::new; + } + + @Override + public void readAdditional(JsonObject json) { + super.readAdditional(json); + this.energy = GsonHelper.getAsInt(json,"energy", 250); + } + @Override + public void writeAdditional(JsonObject json) { + super.writeAdditional(json); + json.addProperty("energy", energy); + } + @Override + public void readAdditional(FriendlyByteBuf buffer) { + super.readAdditional(buffer); + energy = buffer.readInt(); + } + @Override + public void writeAdditional(FriendlyByteBuf buffer) { + super.writeAdditional(buffer); + buffer.writeInt(energy); + } +} diff --git a/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java b/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java index b2a8636e..cdff9d6d 100644 --- a/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java +++ b/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java @@ -111,6 +111,7 @@ import com.simibubi.create.content.kinetics.BlockStressDefaults; import com.simibubi.create.content.kinetics.gearbox.GearboxBlock; import com.simibubi.create.content.kinetics.motor.CreativeMotorGenerator; import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockModel; +import com.simibubi.create.content.processing.AssemblyOperatorBlockItem; import com.simibubi.create.foundation.block.ItemUseOverrides; import com.simibubi.create.foundation.data.*; import com.simibubi.create.foundation.utility.Couple; diff --git a/src/main/java/com/drmangotea/createindustry/registry/TFMGRecipeTypes.java b/src/main/java/com/drmangotea/createindustry/registry/TFMGRecipeTypes.java index ef64d51a..5c99877b 100644 --- a/src/main/java/com/drmangotea/createindustry/registry/TFMGRecipeTypes.java +++ b/src/main/java/com/drmangotea/createindustry/registry/TFMGRecipeTypes.java @@ -8,6 +8,7 @@ import com.drmangotea.createindustry.recipes.coking.CokingRecipe; import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe; import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe; import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe; +import com.drmangotea.createindustry.recipes.polarizing.PolarizingRecipe; import com.google.common.collect.ImmutableSet; import com.simibubi.create.AllTags; import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory; @@ -34,12 +35,13 @@ import java.util.function.Supplier; public enum TFMGRecipeTypes implements IRecipeTypeInfo { -CASTING(CastingRecipe::new), -INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new), -COKING(CokingRecipe::new), -DISTILLATION(DistillationRecipe::new), -WELDING(WeldingRecipe::new), -GAS_BLASTING(GasBlastingRecipe::new) + CASTING(CastingRecipe::new), + INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new), + COKING(CokingRecipe::new), + DISTILLATION(DistillationRecipe::new), + WELDING(WeldingRecipe::new), + GAS_BLASTING(GasBlastingRecipe::new), + POLARIZING(PolarizingRecipe::new), ; private final ResourceLocation id; @@ -68,7 +70,6 @@ GAS_BLASTING(GasBlastingRecipe::new) typeObject = Registers.TYPE_REGISTER.register(name, () -> simpleType(id)); type = typeObject; } - TFMGRecipeTypes(ProcessingRecipeFactory processingFactory) { this(() -> new ProcessingRecipeSerializer<>(processingFactory)); } diff --git a/src/main/resources/data/createindustry/recipes/polarizing/magnetic_ingot.json b/src/main/resources/data/createindustry/recipes/polarizing/magnetic_ingot.json new file mode 100644 index 00000000..c5f64168 --- /dev/null +++ b/src/main/resources/data/createindustry/recipes/polarizing/magnetic_ingot.json @@ -0,0 +1,15 @@ +{ + "type": "createindustry:polarizing", + "ingredients": [ + { + "tag": "forge:ingots/steel" + } + ], + "processingTime": 400, + "results": [ + { + "item": "createindustry:magnetic_ingot" + } + ], + "energy": 300 +} \ No newline at end of file