Polarizing Recipe
This commit is contained in:
@@ -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
|
618a4fde84a56aca00c6990dbde278f8fb76bb1e assets/createindustry/blockstates/accumulator.json
|
||||||
50db526af77cf0ead08cadfd3f7daa8b84a40312 assets/createindustry/blockstates/air_intake.json
|
50db526af77cf0ead08cadfd3f7daa8b84a40312 assets/createindustry/blockstates/air_intake.json
|
||||||
429437419b2ec98bd716e7ba15583b84da7488d5 assets/createindustry/blockstates/aluminum_bars.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
|
1e45593e1375420bd23210dc0f9099a337e94c78 data/createindustry/recipes/yellow_concrete_wall_from_yellow_concrete_stonecutting.json
|
||||||
0165af18f74ef648bf5bc43fa6a3e1bfecc28d37 data/createindustry/recipes/zinc_frame_from_ingots_zinc_stonecutting.json
|
0165af18f74ef648bf5bc43fa6a3e1bfecc28d37 data/createindustry/recipes/zinc_frame_from_ingots_zinc_stonecutting.json
|
||||||
daa491cd60ae376335b7127363d95f371386facf data/createindustry/recipes/zinc_truss_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
|
503c7a40ea8a115006c886e6491ac53f80e7e6fe data/createindustry/tags/fluids/flammable.json
|
||||||
87856087484f006ce6cb7fd66fb9f604230cf4d0 data/createindustry/tags/fluids/gas.json
|
87856087484f006ce6cb7fd66fb9f604230cf4d0 data/createindustry/tags/fluids/gas.json
|
||||||
9790752bec1ad9dc61eb08c66e62caa28516713c data/createindustry/tags/items/stone_types/bauxite.json
|
9790752bec1ad9dc61eb08c66e62caa28516713c data/createindustry/tags/items/stone_types/bauxite.json
|
||||||
|
|||||||
@@ -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
|
b37b7a8bacea5e80c7e080905b858b915af79763 data/createindustry/recipes/casting/steel.json
|
||||||
bfa68e40711dec40213c454b51825a08fa7135bf data/createindustry/recipes/coking/charcoal.json
|
bfa68e40711dec40213c454b51825a08fa7135bf data/createindustry/recipes/coking/charcoal.json
|
||||||
54e9218c4e8656d38cf51f2af80652a1bd251593 data/createindustry/recipes/coking/coal_coke.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
|
63ab0af81c7c3c721d1192ac610b61756c3643dc data/createindustry/recipes/mixing/cooling_fluid.json
|
||||||
86220a406057c4281aca95f93589e5721d2b8b82 data/createindustry/recipes/mixing/copper_sulfate.json
|
86220a406057c4281aca95f93589e5721d2b8b82 data/createindustry/recipes/mixing/copper_sulfate.json
|
||||||
d714d33c8ee6cd65f925464d663e06bcbd87709c data/createindustry/recipes/mixing/gun_powder.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
|
cab04677cf05d6c9f14bcaa6e201c3240c0f6998 data/createindustry/recipes/mixing/liquid_asphalt.json
|
||||||
01351b9d90e07c1396b574aab4fc6e0e9cdb1b2a data/createindustry/recipes/mixing/liquid_concrete.json
|
01351b9d90e07c1396b574aab4fc6e0e9cdb1b2a data/createindustry/recipes/mixing/liquid_concrete.json
|
||||||
70db70b38822f87335fb197912837bd2ebd46348 data/createindustry/recipes/mixing/liquid_plastic_from_ethylene.json
|
70db70b38822f87335fb197912837bd2ebd46348 data/createindustry/recipes/mixing/liquid_plastic_from_ethylene.json
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"type": "create:mixing",
|
||||||
|
"heatRequirement": "superheated",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"item": "createindustry:air_bucket"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"processingTime": 1000,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"item": "createindustry:heated_air_bucket"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"#create:fan_transparent",
|
||||||
|
"minecraft:magma_block"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
|
|||||||
* Create a processing recipe with a single itemstack ingredient, using its id
|
* Create a processing recipe with a single itemstack ingredient, using its id
|
||||||
* as the name of the recipe
|
* as the name of the recipe
|
||||||
*/
|
*/
|
||||||
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(String namespace,
|
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(String namespace, Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
|
||||||
Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
|
|
||||||
ProcessingRecipeSerializer<T> serializer = getSerializer();
|
ProcessingRecipeSerializer<T> serializer = getSerializer();
|
||||||
GeneratedRecipe generatedRecipe = c -> {
|
GeneratedRecipe generatedRecipe = c -> {
|
||||||
ItemLike itemLike = singleIngredient.get();
|
ItemLike itemLike = singleIngredient.get();
|
||||||
@@ -138,6 +137,8 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "TFMG's Processing Recipes: " + getRecipeType().getId()
|
return "TFMG's Processing Recipes: " + getRecipeType().getId()
|
||||||
|
|||||||
@@ -300,6 +300,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
|
|||||||
public static ItemLike unfinishedTurbineEngine() {
|
public static ItemLike unfinishedTurbineEngine() {
|
||||||
return TFMGItems.UNFINISHED_TURBINE_ENGINE.get();
|
return TFMGItems.UNFINISHED_TURBINE_ENGINE.get();
|
||||||
}
|
}
|
||||||
|
public static ItemLike magneticIngot() {
|
||||||
|
return TFMGItems.MAGNETIC_INGOT.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class F {
|
public static class F {
|
||||||
|
|||||||
@@ -105,7 +105,13 @@ public class MixingGen extends TFMGProcessingRecipeGen {
|
|||||||
zincSulfate = create(CreateTFMG.asResource("zinc_sulfate"), b -> b
|
zincSulfate = create(CreateTFMG.asResource("zinc_sulfate"), b -> b
|
||||||
.require(F.sulfuricAcid(), 500)
|
.require(F.sulfuricAcid(), 500)
|
||||||
.require(IT.zincIngot())
|
.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) {
|
public MixingGen(DataGenerator generator) {
|
||||||
|
|||||||
@@ -2,8 +2,13 @@ package com.drmangotea.createindustry.blocks.electricity.polarizer;
|
|||||||
|
|
||||||
import com.drmangotea.createindustry.base.util.TFMGUtils;
|
import com.drmangotea.createindustry.base.util.TFMGUtils;
|
||||||
import com.drmangotea.createindustry.blocks.electricity.base.ElectricBlockEntity;
|
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.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.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.ItemHelper;
|
||||||
import com.simibubi.create.foundation.item.SmartInventory;
|
import com.simibubi.create.foundation.item.SmartInventory;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
@@ -12,9 +17,11 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
@@ -28,6 +35,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
|
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
|
||||||
|
|
||||||
@@ -36,6 +44,7 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo
|
|||||||
public LazyOptional<IItemHandlerModifiable> itemCapability;
|
public LazyOptional<IItemHandlerModifiable> itemCapability;
|
||||||
|
|
||||||
public SmartInventory inventory;
|
public SmartInventory inventory;
|
||||||
|
Optional<PolarizingRecipe> recipe;
|
||||||
|
|
||||||
public int timer = 0;
|
public int timer = 0;
|
||||||
public PolarizerBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
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));
|
this.itemCapability = LazyOptional.of(() -> new CombinedInvWrapper(this.inventory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if(voltage<200) {
|
if(voltage<200) {
|
||||||
timer = 0;
|
timer = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (inventory.getItem(0).isEmpty()) {
|
||||||
if(!inventory.getItem(0).is(TFMGItems.STEEL_INGOT.get())) {
|
timer = -1;
|
||||||
timer = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recipe = this.getRecipe(inventory.getItem(0));
|
||||||
if(energy.getEnergyStored()!=0) {
|
|
||||||
useEnergy(250);
|
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 (!inventory.isEmpty()) {
|
||||||
if (timer < 100) {
|
if (timer < recipe.get().getProcessingDuration()) {
|
||||||
timer++;
|
timer++;
|
||||||
} else {
|
} else {
|
||||||
|
timer = -1;
|
||||||
timer = 0;
|
inventory.setStackInSlot(0, recipe.get().getResultItem());
|
||||||
inventory.setStackInSlot(0, TFMGItems.MAGNETIC_INGOT.asStack());
|
|
||||||
TFMGUtils.spawnElectricParticles(level,getBlockPos());
|
TFMGUtils.spawnElectricParticles(level,getBlockPos());
|
||||||
sendStuff();
|
sendStuff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else timer =0;
|
}
|
||||||
|
else timer = -1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<PolarizingRecipe> getRecipe(ItemStack item) {
|
||||||
|
Optional<PolarizingRecipe> 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){
|
public boolean playerInteract(Player player, InteractionHand hand){
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
if(inventory.isEmpty()) {
|
if(inventory.isEmpty()) {
|
||||||
|
ItemStack stack = player.getItemInHand(hand).copy();
|
||||||
|
stack.setCount(1);
|
||||||
if (player.getItemInHand(hand).is(TFMGItems.STEEL_INGOT.get())) {
|
inventory.setStackInSlot(0, stack);
|
||||||
|
sendStuff();
|
||||||
|
player.getItemInHand(hand).shrink(1);
|
||||||
inventory.setStackInSlot(0, TFMGItems.STEEL_INGOT.asStack());
|
return true;
|
||||||
sendStuff();
|
|
||||||
|
|
||||||
player.getItemInHand(hand).shrink(1);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (player.getItemInHand(hand).isEmpty()) {
|
if (player.getItemInHand(hand).isEmpty()) {
|
||||||
|
|
||||||
player.setItemInHand(hand,inventory.getItem(0));
|
player.setItemInHand(hand,inventory.getItem(0));
|
||||||
inventory.setStackInSlot(0, Blocks.AIR.asItem().getDefaultInstance());
|
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||||
sendStuff();
|
sendStuff();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||||
|
|
||||||
|
|
||||||
if(energy.getEnergyStored()==0){
|
if(energy.getEnergyStored()==0){
|
||||||
Lang.translate("goggles.electric_machine.no_power")
|
Lang.translate("goggles.electric_machine.no_power")
|
||||||
.style(ChatFormatting.DARK_RED)
|
.style(ChatFormatting.DARK_RED)
|
||||||
.forGoggles(tooltip, 1);
|
.forGoggles(tooltip, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(energy.getEnergyStored()==0) {
|
if(voltage < 200) {
|
||||||
Lang.translate("goggles.electric_machine.insufficient_voltage")
|
Lang.translate("goggles.electric_machine.insufficient_voltage")
|
||||||
.style(ChatFormatting.RED)
|
.style(ChatFormatting.RED)
|
||||||
.forGoggles(tooltip, 1);
|
.forGoggles(tooltip, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(timer>0) {
|
if(timer>0 && recipe.isPresent()) {
|
||||||
Lang.translate("goggles.blast_furnace.status.running")
|
Lang.translate("goggles.blast_furnace.status.running")
|
||||||
.style(ChatFormatting.GOLD)
|
.style(ChatFormatting.GOLD)
|
||||||
.forGoggles(tooltip, 1);
|
.forGoggles(tooltip, 1);
|
||||||
Lang.translate("goggles.coke_oven.progress", timer)
|
tooltip.add(percent(timer, recipe.get()).withStyle(ChatFormatting.GREEN));
|
||||||
.style(ChatFormatting.GREEN)
|
|
||||||
.add(Lang.translate("goggles.misc.percent_symbol")
|
|
||||||
.style(ChatFormatting.GREEN))
|
|
||||||
.forGoggles(tooltip, 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
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
|
@Override
|
||||||
|
|||||||
@@ -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<PolarizingRecipe> {
|
||||||
|
private Polarizer polarizer = new Polarizer();
|
||||||
|
|
||||||
|
public PolarizingCategory(Info<PolarizingRecipe> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.drmangotea.createindustry.recipes.coking.CokingRecipe;
|
|||||||
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
|
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
|
||||||
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
|
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
|
||||||
import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe;
|
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.TFMGBlocks;
|
||||||
import com.drmangotea.createindustry.registry.TFMGFluids;
|
import com.drmangotea.createindustry.registry.TFMGFluids;
|
||||||
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
|
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
|
||||||
@@ -97,8 +98,14 @@ public class TFMGJei implements IModPlugin {
|
|||||||
.catalyst(TFMGBlocks.BLAST_STOVE::get)
|
.catalyst(TFMGBlocks.BLAST_STOVE::get)
|
||||||
.doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.getBucket().get())
|
.doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.getBucket().get())
|
||||||
.emptyBackground(177, 150)
|
.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)
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<RecipeWrapper> 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<ItemLike> set) {
|
||||||
|
set.add(TFMGBlocks.POLARIZER.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAssemblyIngredients(List<Ingredient> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Supplier<Supplier<SequencedAssemblySubCategory>> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.gearbox.GearboxBlock;
|
||||||
import com.simibubi.create.content.kinetics.motor.CreativeMotorGenerator;
|
import com.simibubi.create.content.kinetics.motor.CreativeMotorGenerator;
|
||||||
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockModel;
|
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.block.ItemUseOverrides;
|
||||||
import com.simibubi.create.foundation.data.*;
|
import com.simibubi.create.foundation.data.*;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.drmangotea.createindustry.recipes.coking.CokingRecipe;
|
|||||||
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
|
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
|
||||||
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
|
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
|
||||||
import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe;
|
import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe;
|
||||||
|
import com.drmangotea.createindustry.recipes.polarizing.PolarizingRecipe;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.simibubi.create.AllTags;
|
import com.simibubi.create.AllTags;
|
||||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
|
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
|
||||||
@@ -34,12 +35,13 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
public enum TFMGRecipeTypes implements IRecipeTypeInfo {
|
public enum TFMGRecipeTypes implements IRecipeTypeInfo {
|
||||||
|
|
||||||
CASTING(CastingRecipe::new),
|
CASTING(CastingRecipe::new),
|
||||||
INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new),
|
INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new),
|
||||||
COKING(CokingRecipe::new),
|
COKING(CokingRecipe::new),
|
||||||
DISTILLATION(DistillationRecipe::new),
|
DISTILLATION(DistillationRecipe::new),
|
||||||
WELDING(WeldingRecipe::new),
|
WELDING(WeldingRecipe::new),
|
||||||
GAS_BLASTING(GasBlastingRecipe::new)
|
GAS_BLASTING(GasBlastingRecipe::new),
|
||||||
|
POLARIZING(PolarizingRecipe::new),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final ResourceLocation id;
|
private final ResourceLocation id;
|
||||||
@@ -68,7 +70,6 @@ GAS_BLASTING(GasBlastingRecipe::new)
|
|||||||
typeObject = Registers.TYPE_REGISTER.register(name, () -> simpleType(id));
|
typeObject = Registers.TYPE_REGISTER.register(name, () -> simpleType(id));
|
||||||
type = typeObject;
|
type = typeObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFMGRecipeTypes(ProcessingRecipeFactory<?> processingFactory) {
|
TFMGRecipeTypes(ProcessingRecipeFactory<?> processingFactory) {
|
||||||
this(() -> new ProcessingRecipeSerializer<>(processingFactory));
|
this(() -> new ProcessingRecipeSerializer<>(processingFactory));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"type": "createindustry:polarizing",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"tag": "forge:ingots/steel"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"processingTime": 400,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"item": "createindustry:magnetic_ingot"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"energy": 300
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user