now we're thinking with portals

This commit is contained in:
Boblet 2025-05-26 16:21:59 +02:00
parent b00e3b9efb
commit acbea88eca
9 changed files with 157 additions and 5 deletions

View File

@ -14,6 +14,7 @@ Things you should also avoid include:
* unused or half finished util functions (for obvious reasons)
* half finished or obviously broken features (à la "bob will fix it, i'm sure of it", please don't do that)
* updating the changelog (you're guaranteed to cause a merge conflict with that)
* any use of `I18n`, use `I18nUtil` instead
## Test your code

View File

@ -24,4 +24,6 @@
* Fixed strand caster fluid gauges going out of bounds
* Fixed arc welder and soldering station not changing buffer size based on upgrade, preventing use of higher overdrive tiers
* Fixed non-standard template folder recipes not using the correct icon
* Fixed jetpack flight time not resetting when equipped like armor, causing kicks on servers that don't have flying cheats allowed
* Fixed jetpack flight time not resetting when equipped like armor, causing kicks on servers that don't have flying cheats allowed
* Fixed missing energy damage category localization
* Fixed server crash caused by tool abilities

View File

@ -1008,7 +1008,8 @@ public class ModBlocks {
public static Block machine_soldering_station;
public static Block machine_arc_furnace;
public static Block machine_chemplant;
@Deprecated public static Block machine_chemplant;
public static Block machine_chemical_plant;
public static Block machine_chemfac;
public static Block machine_mixer;
@ -2230,6 +2231,7 @@ public class ModBlocks {
machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_chemical_plant = new MachineChemicalPlant(Material.iron).setBlockName("machine_chemical_plant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_chemfac = new MachineChemfac(Material.iron).setBlockName("machine_chemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_mixer = new MachineMixer(Material.iron).setBlockName("machine_mixer").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_fluidtank = new MachineFluidTank(Material.iron).setBlockName("machine_fluidtank").setHardness(5.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_fluidtank");
@ -3272,7 +3274,8 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName());
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
GameRegistry.registerBlock(machine_chemfac, machine_chemfac.getUnlocalizedName());
register(machine_chemical_plant);
register(machine_chemfac);
register(machine_arc_welder);
register(machine_soldering_station);
register(machine_arc_furnace);

View File

@ -0,0 +1,22 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class MachineChemicalPlant extends BlockDummyable {
public MachineChemicalPlant(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return null;
}
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
@Override public int getOffset() { return 1; }
}

View File

@ -11,6 +11,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class MachineChemplant extends BlockDummyable {
public MachineChemplant(Material p_i45386_1_) {

View File

@ -1,6 +1,6 @@
package com.hbm.handler.ability;
import net.minecraft.client.resources.I18n;
import com.hbm.util.i18n.I18nUtil;
public interface IBaseAbility extends Comparable<IBaseAbility> {
public String getName();
@ -11,7 +11,7 @@ public interface IBaseAbility extends Comparable<IBaseAbility> {
// Note: only usable client-side. Server-side, use ChatComponentTranslation manually instead
public default String getFullName(int level) {
return I18n.format(getName()) + getExtension(level);
return I18nUtil.format(getName()) + getExtension(level);
}
public default boolean isAllowed() {

View File

@ -0,0 +1,121 @@
package com.hbm.inventory.recipes.loader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import com.google.gson.JsonElement;
import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.RecipesCommon.AStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
/**
* Fully genericized recipes.
* Features:
* * Fluid in and output
* * AStack intput
* * Chance-based outputs, for selecting items and for selecting items are produced in the first place
* * Duration
* * Tags for identification
*
* @author hbm
*/
public abstract class GenericRecipes extends SerializableRecipe {
public static final Random RNG = new Random();
public List<GenericRecipe> recipeOrderedList = new ArrayList();
public HashMap<String, GenericRecipe> recipeNameMap = new HashMap();
public abstract int inputItemLimit();
public abstract int inputFluidLimit();
public abstract int outputItemLimit();
public abstract int outputFluidLimit();
@Override
public Object getRecipeObject() {
return this.recipeOrderedList;
}
@Override
public void deleteRecipes() {
this.recipeOrderedList.clear();
this.recipeNameMap.clear();
}
public void register(GenericRecipe recipe) {
this.recipeOrderedList.add(recipe);
this.recipeNameMap.put(recipe.name, recipe);
}
@Override
public void readRecipe(JsonElement recipe) {
}
@Override
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
}
///////////////
/// CLASSES ///
///////////////
public static class GenericRecipe {
public String name;
public AStack[] inputItem;
public FluidStack[] inputFluid;
public IOutput[] outputItem;
public FluidStack[] outputFluid;
public int duration;
public GenericRecipe(String name, int duration) {
this.name = name;
this.duration = duration;
}
}
public static interface IOutput {
public boolean possibleMultiOutput();
public ItemStack collapse();
}
/** A chance output, produces either an ItemStack or null */
public static class ChanceOutput extends WeightedRandom.Item implements IOutput {
public ItemStack stack;
public float chance;
public ChanceOutput(ItemStack stack) { this(stack, 1F, 1); }
public ChanceOutput(ItemStack stack, int weight) { this(stack, 1F, weight); }
public ChanceOutput(ItemStack stack, float chance, int weight) {
super(weight);
this.stack = stack;
this.chance = chance;
}
@Override
public ItemStack collapse() {
if(this.chance >= 1F) return this.stack;
return RNG.nextFloat() <= chance ? this.stack : null;
}
@Override public boolean possibleMultiOutput() { return false; }
}
/** Multiple choice chance output, produces a ChanceOutput chosen randomly by weight */
public static class ChanceOutputMulti implements IOutput {
public List<ChanceOutput> pool = new ArrayList();
@Override public ItemStack collapse() { return ((ChanceOutput) WeightedRandom.getRandomItem(RNG, pool)).collapse(); }
@Override public boolean possibleMultiOutput() { return pool.size() > 1; }
}
}

View File

@ -489,6 +489,7 @@ crucible.tcalloy=Herstellung - Technetiumstahl
damage.inset=Resistenz wenn in Set getragen:
damage.item=Resistenz wenn getragen:
damage.category.EN=Energie
damage.category.EXPL=Explosion
damage.category.FIRE=Feuer
damage.category.PROJ=Projektil

View File

@ -905,6 +905,7 @@ crucible.tcalloy=Technetium Steel Production
damage.inset=Resistances when worn in set:
damage.item=Resistances when worn:
damage.category.EN=Energy
damage.category.EXPL=Explosion
damage.category.FIRE=Fire
damage.category.PROJ=Projectile