From 33bd961e0c0647ef4787ac07245779df7152348c Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 24 Jul 2023 12:03:13 +0200 Subject: [PATCH] toora loora --- changelog | 29 ++++++++--- gradle.properties | 2 +- .../hbm/blocks/generic/BlockStorageCrate.java | 36 ++++++++++++- .../blocks/machine/BlockCustomMachine.java | 52 +++++++++++++++++++ .../hbm/config/CustomMachineConfigJSON.java | 6 +-- .../com/hbm/items/machine/ItemRBMKRod.java | 2 +- src/main/java/com/hbm/lib/RefStrings.java | 2 +- .../java/com/hbm/main/CraftingManager.java | 20 +++++++ .../hbm/tileentity/TileEntityProxyBase.java | 6 +-- .../machine/TileEntityCustomMachine.java | 3 +- src/main/resources/assets/hbm/lang/en_US.lang | 5 ++ 11 files changed, 143 insertions(+), 20 deletions(-) diff --git a/changelog b/changelog index ec89d27e1..e06e326bf 100644 --- a/changelog +++ b/changelog @@ -1,11 +1,24 @@ ## Added -* Rubber ball - * can be thrown at people -* New chlorine processing chain - * Involves 240 processing steps of washing, electrolyzing, centrifuging and treating chlorocalcite +* Custom machines + * Simple processing multiblocks that can be created via config + * The config found in `hbmConfig/hbmCustomMachines.json` defines the input and output slots, fluid amount, speed and consumption multipliers as well as the multiblock + * The config in `hbmRecipes/hbmCustomMachines.json` defines the recipes for all multiblocks with inputs, outputs base speed and consumption rates + * Currently, custom machine recipes do not show up in NEI, a handler will be added soon + * All recipes are shaped, even the fluid types, this was done to improve performance + * Item inputs have filter slots for automation, this allows the right ingredients to be inserted into the right slot easily. For simple machines, this slot can be left empty so any item can be inserted. + * By default, the standard config creates one custom machine with one recipe called the paper press, turning sawdust and water into paper + * More examples can be found in the configs attached to this github release + * Custom machines can also be configured as generators, using up item and fluid inputs and turning them into energy + * While changing the configs and adding/removing machines in an existing world is possible, this is not recommended because of potential ID shifts of the machines, breaking existing custom machines in the world + * With custom machines, quite a few otherwise unused construction blocks have been added which are recommended to be used for custom machines as they come in tiers, have reasonable cost and mesh well visually with the multiblocks + * However, using them is not mandatory, the only functional block is the port which is most likely needed for automation, although the machine's controller itself also serves as a port ## Changed -* Glyphids now have a higher tracking range, being 256 blocks -* Standard glyphids now have a base health of 100 -* Glyphid scouts are now immune to fire and explosive damage, have a 50% damage reduction against projectiles and have passive regeneration -* Increased hive block blast resistance, they can no longer be blown up wiith conventional explosives +* Additional OC compat for fluid gauges +* Crates now display their contents when in item form + +## Fixed +* Hopefully fixed an issue where pollution-based mob buffs apply multiple times, resulting in near-unkillable mobs +* Fixed exploit allowing the cap for shield infusions to be bypassed +* Fixed tier detection mode in the radar detecting the Y-position instead of the actual tier +* Fixed missing parenthesis in sigmoid curve's description \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index aca4be12e..a5787a31d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=4663 +mod_build_number=4670 credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\ \ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\ diff --git a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java index 8e8f5097f..718f26c54 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java +++ b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java @@ -1,9 +1,12 @@ package com.hbm.blocks.generic; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.Random; import com.hbm.blocks.IBlockMulti; +import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ModBlocks; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemLock; @@ -36,7 +39,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockStorageCrate extends BlockContainer implements IBlockMulti { +public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ITooltipProvider { @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -282,4 +285,35 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti { public int getComparatorInputOverride(World world, int x, int y, int z, int side) { return Container.calcRedstoneFromInventory((IInventory) world.getTileEntity(x, y, z)); } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + if(stack.hasTagCompound()) { + + List contents = new ArrayList(); + int amount = 0; + + for(int i = 0; i < 100; i++) { //whatever the biggest container is, i can't be bothered to check + ItemStack content = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)); + + if(content != null) { + amount++; + + if(contents.size() < 10) { + contents.add(EnumChatFormatting.AQUA + " - " + content.getDisplayName() + (content.stackSize > 1 ? (" x" + content.stackSize) : "")); + } + } + } + + if(!contents.isEmpty()) { + list.add(EnumChatFormatting.AQUA + "Contains:"); + list.addAll(contents); + amount -= contents.size(); + + if(amount > 0) { + list.add(EnumChatFormatting.AQUA + "...and " + amount + " more."); + } + } + } + } } diff --git a/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java b/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java index e007403ef..0dac71ca5 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java +++ b/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java @@ -1,6 +1,7 @@ package com.hbm.blocks.machine; import java.util.ArrayList; +import java.util.Random; import com.hbm.config.CustomMachineConfigJSON; import com.hbm.items.ModItems; @@ -11,11 +12,14 @@ import com.hbm.tileentity.machine.TileEntityCustomMachine; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -145,4 +149,52 @@ public class BlockCustomMachine extends BlockContainer { return super.getPickBlock(target, world, x, y, z); } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + + ISidedInventory sided = (ISidedInventory) world.getTileEntity(x, y, z); + Random rand = world.rand; + + if(sided != null) { + for(int i1 = 0; i1 < sided.getSizeInventory(); ++i1) { + + if(i1 >= 10 && i1 <= 15) + continue; // do NOT drop the filters + + ItemStack itemstack = sided.getStackInSlot(i1); + + if(itemstack != null) { + float f = rand.nextFloat() * 0.8F + 0.1F; + float f1 = rand.nextFloat() * 0.8F + 0.1F; + float f2 = rand.nextFloat() * 0.8F + 0.1F; + + while(itemstack.stackSize > 0) { + int j1 = rand.nextInt(21) + 10; + + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (float) rand.nextGaussian() * f3; + entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) rand.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } + } + } + + world.func_147453_f(x, y, z, block); + } + + super.breakBlock(world, x, y, z, block, meta); + } } diff --git a/src/main/java/com/hbm/config/CustomMachineConfigJSON.java b/src/main/java/com/hbm/config/CustomMachineConfigJSON.java index 886a7741a..79a659261 100644 --- a/src/main/java/com/hbm/config/CustomMachineConfigJSON.java +++ b/src/main/java/com/hbm/config/CustomMachineConfigJSON.java @@ -90,7 +90,7 @@ public class CustomMachineConfigJSON { for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { for(int z = 0; z <= 2; z++) { - if(!(x == 0 && y == 0 && z == 1) && !(x == 0 && z == 1) && !(x == 0 && y == 0 && z == 0)) { + if(!(x == 0 && y == 0 && z == 1) && !(x == 0 && z == 0)) { writer.beginObject().setIndent(""); writer.name("block").value(y == 0 ? "hbm:tile.cm_sheet" : "hbm:tile.cm_block"); writer.name("x").value(x); @@ -109,7 +109,7 @@ public class CustomMachineConfigJSON { writer.name("block").value("hbm:tile.cm_port"); writer.name("x").value(0); writer.name("y").value(-1); - writer.name("z").value(1); + writer.name("z").value(0); writer.name("metas").beginArray(); writer.value(0); writer.endArray(); @@ -119,7 +119,7 @@ public class CustomMachineConfigJSON { writer.name("block").value("hbm:tile.cm_port"); writer.name("x").value(0); writer.name("y").value(1); - writer.name("z").value(1); + writer.name("z").value(0); writer.name("metas").beginArray(); writer.value(0); writer.endArray(); diff --git a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java index 01c83055c..68158958f 100644 --- a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java +++ b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java @@ -275,7 +275,7 @@ public class ItemRBMKRod extends Item { break; case ARCH: function = "(%1$s - %1$s² / 10000) / 100 * %2$s [0;∞]"; break; - case SIGMOID: function = "%2$s / (1 + e^(-(%1$s - 50) / 10)"; + case SIGMOID: function = "%2$s / (1 + e^(-(%1$s - 50) / 10))"; break; case SQUARE_ROOT: function = "sqrt(%1$s) * %2$s / 10"; break; diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 55bb20699..5e3527635 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (4663)"; + public static final String VERSION = "1.0.27 BETA (4670)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 1893862f8..1a4b56848 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -1096,6 +1096,26 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModItems.sliding_blast_door_skin, 1, 1), new ItemStack(ModItems.sliding_blast_door_skin, 1, 0)); addShapelessAuto(new ItemStack(ModItems.sliding_blast_door_skin, 1, 2), new ItemStack(ModItems.sliding_blast_door_skin, 1, 1)); addShapelessAuto(new ItemStack(ModItems.sliding_blast_door_skin), new ItemStack(ModItems.sliding_blast_door_skin, 1, 2)); + + addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 0), " I ", "IPI", " I ", 'I', STEEL.ingot(), 'P', STEEL.plateCast()); + addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 1), " I ", "IPI", " I ", 'I', ALLOY.ingot(), 'P', ALLOY.plateCast()); + addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 2), " I ", "IPI", " I ", 'I', DESH.ingot(), 'P', DESH.plateCast()); + addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 3), " I ", "IPI", " I ", 'I', ANY_RESISTANTALLOY.ingot(), 'P', ANY_RESISTANTALLOY.plateCast()); + + for(int i = 0; i < 4; i++) { + addRecipeAuto(new ItemStack(ModBlocks.cm_sheet, 16, i), "BB", "BB", 'B', new ItemStack(ModBlocks.cm_block, 1, i)); + addRecipeAuto(new ItemStack(ModBlocks.cm_tank, 4, i), " B ", "BGB", " B ", 'B', new ItemStack(ModBlocks.cm_block, 1, i), 'G', KEY_ANYGLASS); + addRecipeAuto(new ItemStack(ModBlocks.cm_port, 1, i), "P", "B", "P", 'B', new ItemStack(ModBlocks.cm_block, 1, i), 'P', IRON.plate()); + } + + addRecipeAuto(new ItemStack(ModBlocks.cm_engine, 1, 0), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.motor); + addRecipeAuto(new ItemStack(ModBlocks.cm_engine, 1, 1), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.motor_desh); + addRecipeAuto(new ItemStack(ModBlocks.cm_engine, 1, 2), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.motor_bismuth); + addRecipeAuto(new ItemStack(ModBlocks.cm_circuit, 1, 0), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.circuit_aluminium); + addRecipeAuto(new ItemStack(ModBlocks.cm_circuit, 1, 1), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.circuit_copper); + addRecipeAuto(new ItemStack(ModBlocks.cm_circuit, 1, 2), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.circuit_red_copper); + addRecipeAuto(new ItemStack(ModBlocks.cm_circuit, 1, 3), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.circuit_gold); + addRecipeAuto(new ItemStack(ModBlocks.cm_circuit, 1, 4), " I ", "IMI", " I ", 'I', STEEL.ingot(), 'M', ModItems.circuit_schrabidium); } public static void crumple() { diff --git a/src/main/java/com/hbm/tileentity/TileEntityProxyBase.java b/src/main/java/com/hbm/tileentity/TileEntityProxyBase.java index bf19bb353..36a123851 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityProxyBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityProxyBase.java @@ -20,7 +20,7 @@ public class TileEntityProxyBase extends TileEntityLoadedBase { if(cachedPosition != null) { TileEntity te = Compat.getTileStandard(worldObj, cachedPosition.getX(), cachedPosition.getY(), cachedPosition.getZ()); - if(te != null && te != this) return te; + if(te != null && !(te instanceof TileEntityProxyBase)) return te; cachedPosition = null; this.markDirty(); } @@ -34,7 +34,7 @@ public class TileEntityProxyBase extends TileEntityLoadedBase { if(pos != null) { TileEntity te = Compat.getTileStandard(worldObj, pos[0], pos[1], pos[2]); - if(te != null && te != this) return te; + if(te != null && !(te instanceof TileEntityProxyBase)) return te; } } @@ -42,7 +42,7 @@ public class TileEntityProxyBase extends TileEntityLoadedBase { IProxyController controller = (IProxyController) this.getBlockType(); TileEntity tile = controller.getCore(worldObj, xCoord, yCoord, zCoord); - if(tile != null && tile != this) return tile; + if(tile != null && !(tile instanceof TileEntityProxyBase)) return tile; } return null; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java index 700da5e04..6a7d3973d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java @@ -6,7 +6,6 @@ import java.util.List; import com.hbm.config.CustomMachineConfigJSON; import com.hbm.config.CustomMachineConfigJSON.MachineConfiguration; import com.hbm.config.CustomMachineConfigJSON.MachineConfiguration.ComponentDefinition; -import com.hbm.inventory.FluidStack; import com.hbm.inventory.container.ContainerMachineCustom; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -465,7 +464,7 @@ public class TileEntityCustomMachine extends TileEntityMachineBase implements IF @Override public long getMaxPower() { - return this.config != null ? this.getMaxPower() : 1; + return this.config != null ? this.config.maxPower : 1; } @Override diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 5b786acdb..f0d31585c 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4526,6 +4526,11 @@ tile.cm_block.alloy.name=Advanced Alloy Machine Casing tile.cm_block.desh.name=Desh Machine Casing tile.cm_block.steel.name=Steel Machine Casing tile.cm_block.tcalloy.name=Technetium Steel Machine Casing +tile.cm_circuit.aluminium.name=Tier 1 Circuit Block +tile.cm_circuit.copper.name=Tier 2 Circuit Block +tile.cm_circuit.gold.name=Tier 4 Circuit Block +tile.cm_circuit.red_copper.name=Tier 3 Circuit Block +tile.cm_circuit.schrabidium.name=Tier 5 Circuit Block tile.cm_engine.bismuth.name=Bismuth Motor Block tile.cm_engine.desh.name=Desh Motor Block tile.cm_engine.standard.name=Motor Block