From efc5284049aa5e4177b16b743ea0d2ed7f130f47 Mon Sep 17 00:00:00 2001 From: LittleCube Date: Wed, 26 Feb 2025 12:03:04 +0800 Subject: [PATCH 01/12] feature: curtain coating machine --- .../VariantHorizontalRotatableBlock.java | 5 + .../api/recipes/SuSyRecipeMaps.java | 4 + .../supersymmetry/common/CommonProxy.java | 2 + .../common/blocks/BlockConveyor.java | 90 +++++++++ .../common/blocks/SuSyBlocks.java | 5 + .../SuSyMetaTileEntities.java | 4 + .../electric/MetaTileEntityCurtainCoater.java | 175 ++++++++++++++++++ .../conveyor_belt/lv/front.png | Bin 0 -> 500 bytes .../conveyor_belt/lv/front.png.mcmeta | 5 + .../conveyor_belt/lv/side.png | Bin 0 -> 225 bytes .../conveyor_belt/lv/side.png.mcmeta | 13 ++ .../conveyor_belt/lv/side_ctm.png | Bin 0 -> 345 bytes .../conveyor_belt/lv/top.png | Bin 0 -> 758 bytes .../conveyor_belt/lv/top.png.mcmeta | 5 + .../susy/blockstates/conveyor_belt.json | 9 + .../resources/assets/susy/lang/en_us.lang | 4 + .../susy/models/block/conveyor_belt/lv.json | 24 +++ 17 files changed, 345 insertions(+) create mode 100644 src/main/java/supersymmetry/common/blocks/BlockConveyor.java create mode 100644 src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png.mcmeta create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side_ctm.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta create mode 100644 src/main/resources/assets/susy/blockstates/conveyor_belt.json create mode 100644 src/main/resources/assets/susy/models/block/conveyor_belt/lv.json diff --git a/src/main/java/supersymmetry/api/blocks/VariantHorizontalRotatableBlock.java b/src/main/java/supersymmetry/api/blocks/VariantHorizontalRotatableBlock.java index ed7110d65..7ba1b1d8b 100644 --- a/src/main/java/supersymmetry/api/blocks/VariantHorizontalRotatableBlock.java +++ b/src/main/java/supersymmetry/api/blocks/VariantHorizontalRotatableBlock.java @@ -42,6 +42,11 @@ public ItemStack getItemVariant(T variant, int amount) { return new ItemStack(this, amount, variant.ordinal() * 4); } + public IBlockState getState(T variant, EnumFacing facing) { + return getDefaultState().withProperty(VARIANT, variant).withProperty(FACING, facing); + } + + @Nonnull @Override public BlockStateContainer createBlockState() { diff --git a/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java b/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java index 89a0ed34a..a6cccb41e 100644 --- a/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java +++ b/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java @@ -338,6 +338,10 @@ public class SuSyRecipeMaps { .setSound(GTSoundEvents.TURBINE) .allowEmptyOutput(); + public static final RecipeMap CURTAIN_COATER = new RecipeMap<>("curtain_coater", 1, 1, 1, 0, new SimpleRecipeBuilder().EUt(VA[LV]), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BATH); + public static void init(){ RecipeMaps.SIFTER_RECIPES.setMaxFluidInputs(1); RecipeMaps.SIFTER_RECIPES.setMaxFluidOutputs(1); diff --git a/src/main/java/supersymmetry/common/CommonProxy.java b/src/main/java/supersymmetry/common/CommonProxy.java index a12949fd0..a01e470f0 100644 --- a/src/main/java/supersymmetry/common/CommonProxy.java +++ b/src/main/java/supersymmetry/common/CommonProxy.java @@ -88,6 +88,7 @@ public static void registerBlocks(@NotNull RegistryEvent.Register event) registry.register(SuSyBlocks.SERPENTINE); registry.register(SuSyBlocks.HARDBLOCKS); registry.register(SuSyBlocks.CUSTOMSHEETS); + registry.register(SuSyBlocks.CONVEYOR_BELT); SHEETED_FRAMES.values().stream().distinct().forEach(registry::register); } @@ -119,6 +120,7 @@ public static void registerItems(@NotNull RegistryEvent.Register event) { registry.register(createItemBlock(SuSyBlocks.SERPENTINE, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.HARDBLOCKS, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.CUSTOMSHEETS, VariantItemBlock::new)); + registry.register(createItemBlock(SuSyBlocks.CONVEYOR_BELT, VariantItemBlock::new)); SHEETED_FRAMES.values() .stream().distinct() diff --git a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java new file mode 100644 index 000000000..b649d0a6a --- /dev/null +++ b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java @@ -0,0 +1,90 @@ +package supersymmetry.common.blocks; + +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import supersymmetry.api.SusyLog; +import supersymmetry.api.blocks.VariantHorizontalRotatableBlock; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.jetbrains.annotations.NotNull; + +import static net.minecraft.block.material.Material.IRON; + +public class BlockConveyor extends VariantHorizontalRotatableBlock { + + static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D); + + public BlockConveyor() { + super(IRON); + setTranslationKey("conveyor_belt"); + setHardness(5.0f); + setResistance(10.0f); + setSoundType(SoundType.METAL); + setHarvestLevel("wrench", 2); + setDefaultState(getState(ConveyorType.LV_CONVEYOR)); + } + + @Override + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { + return false; + } + + @Override + @NotNull + @SuppressWarnings("deprecation") + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return AABB_BOTTOM_HALF; + } + + @Override + @SuppressWarnings("deprecation") + public boolean isFullCube(@NotNull IBlockState state) { + return false; + } + + @Override + @SuppressWarnings("deprecation") + public boolean isOpaqueCube(@NotNull IBlockState state) { + return false; + } + + public boolean setFacing(World world, BlockPos pos, EnumFacing facing) + { + if (!FACING.getAllowedValues().contains(facing)) + return false; + SusyLog.logger.info("rotated!"); + SusyLog.logger.info(facing); + IBlockState state = world.getBlockState(pos); + world.setBlockState(pos, state.withProperty(FACING, facing)); + return true; + } + + public enum ConveyorType implements IStringSerializable { + LV_CONVEYOR("lv"); + + public final String name; + + ConveyorType(String name) { + this.name = name; + } + + @NotNull + @Override + public String getName() { + return this.name; + } + + @NotNull + @Override + public String toString() { + return getName(); + } + } +} diff --git a/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java b/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java index 7febc3627..e80805ce4 100644 --- a/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java +++ b/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java @@ -42,6 +42,7 @@ public class SuSyBlocks { public static BlockSerpentine SERPENTINE; public static BlocksHardened HARDBLOCKS; public static BlocksCustomSheets CUSTOMSHEETS; + public static BlockConveyor CONVEYOR_BELT; public static void init() { COOLING_COIL = new BlockCoolingCoil(); @@ -108,6 +109,9 @@ public static void init() { CUSTOMSHEETS = new BlocksCustomSheets(); CUSTOMSHEETS.setRegistryName("custom_sheets"); + + CONVEYOR_BELT = new BlockConveyor(); + CONVEYOR_BELT.setRegistryName("conveyor_belt"); } @SideOnly(Side.CLIENT) @@ -134,6 +138,7 @@ public static void registerItemModels() { SERPENTINE.onModelRegister(); registerItemModel(HARDBLOCKS); registerItemModel(CUSTOMSHEETS); + registerItemModel(CONVEYOR_BELT); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index 2acca121f..30bc93de3 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -169,6 +169,8 @@ public class SuSyMetaTileEntities { public static MetaTileEntitySieveDistillationTower SIEVE_DISTILLATION_TOWER; + public static MetaTileEntityCurtainCoater CURTAIN_COATER; + public static MetaTileEntityBridge INV_BRIDGE; public static MetaTileEntityBridge TANK_BRIDGE; public static MetaTileEntityBridge INV_TANK_BRIDGE; @@ -268,6 +270,8 @@ public static void init() { registerSimpleMTE(CVD, 12, 14653, "cvd", SuSyRecipeMaps.CVD_RECIPES, SusyTextures.CVD_OVERLAY, true, GTUtility.defaultTankSizeFunction); registerSimpleMTE(ION_IMPLANTER, 12, 14666, "ion_implanter", SuSyRecipeMaps.ION_IMPLANTATION_RECIPES, SusyTextures.ION_IMPLANTER_OVERLAY, true, GTUtility.defaultTankSizeFunction); + CURTAIN_COATER = registerMetaTileEntity(14513, new MetaTileEntityCurtainCoater(susyId("curtain_coater"))); + ArrayList ids = new ArrayList<>(); for (int id = 14500; id < 15000; id++) { if (GregTechAPI.MTE_REGISTRY.getObjectById(id) == null) ids.add(id); diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java new file mode 100644 index 000000000..19ecdf5d5 --- /dev/null +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -0,0 +1,175 @@ +package supersymmetry.common.metatileentities.multi.electric; + +import gregtech.api.GTValues; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; +import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.pattern.*; +import gregtech.api.util.BlockInfo; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; +import gregtech.common.blocks.*; +import gregtech.common.metatileentities.MetaTileEntities; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +import net.minecraft.world.World; +import org.apache.commons.lang3.ArrayUtils; +import supersymmetry.api.recipes.SuSyRecipeMaps; +import supersymmetry.common.blocks.BlockConveyor; +import supersymmetry.common.blocks.SuSyBlocks; +import supersymmetry.common.metatileentities.SuSyMetaTileEntities; + +import javax.annotation.Nonnull; +import java.util.*; + +public class MetaTileEntityCurtainCoater extends RecipeMapMultiblockController { + + public static TraceabilityPredicate conveyors(BlockConveyor.ConveyorType... variants) { + + return new TraceabilityPredicate(blockWorldState -> { + IBlockState state = blockWorldState.getBlockState(); + if (state.getBlock() instanceof BlockConveyor) { + blockWorldState.getMatchContext().getOrPut("Conveyors", new LinkedList<>()).add(blockWorldState.getPos()); + BlockConveyor.ConveyorType property = ((BlockConveyor) state.getBlock()).getState(state); + return ArrayUtils.contains(variants, property); + } + return false; + }, () -> Arrays.stream(variants).map(m -> new BlockInfo(SuSyBlocks.CONVEYOR_BELT.getState(m), null)).toArray(BlockInfo[]::new)); + } + + + public MetaTileEntityCurtainCoater(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, SuSyRecipeMaps.CURTAIN_COATER); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MetaTileEntityCurtainCoater(metaTileEntityId); + } + + @Override + protected BlockPattern createStructurePattern() { + TraceabilityPredicate inputBus = abilities(MultiblockAbility.IMPORT_ITEMS).setMinGlobalLimited(1).setMaxGlobalLimited(1); + TraceabilityPredicate outputBus = abilities(MultiblockAbility.EXPORT_ITEMS).setMinGlobalLimited(1).setMaxGlobalLimited(1); + return FactoryBlockPattern.start() + .aisle(" X ", " X ", " X ") + .aisle("IXXXI", "BBBBB", " X ") + .aisle(" S ", " F ", " G ") + .where('S', selfPredicate()) + .where('I', inputBus.or(outputBus)) + .where('X', states(getCasingState()).setMinGlobalLimited(4) + .or(autoAbilities(true, true, false, false, false, false, false))) + .where('G', states(getGearBoxState())) + .where('F', abilities(MultiblockAbility.IMPORT_FLUIDS)) + .where('B', conveyors(BlockConveyor.ConveyorType.LV_CONVEYOR)) + .where(' ', any()) + .build(); + } + + @Override + public List getMatchingShapes() { + ArrayList shapeInfo = new ArrayList<>(); + MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() + .where('S', SuSyMetaTileEntities.CURTAIN_COATER, EnumFacing.SOUTH) + .where('X', getCasingState()) + .where('I', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.LV], EnumFacing.SOUTH) + .where('O', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.LV], EnumFacing.SOUTH) + .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.SOUTH) + .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LV], EnumFacing.NORTH) + .where('G', getGearBoxState()) + .where('>', getConveyorState(BlockConveyor.ConveyorType.LV_CONVEYOR, EnumFacing.EAST)) + .where('<', getConveyorState(BlockConveyor.ConveyorType.LV_CONVEYOR, EnumFacing.WEST)) + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getCasingState(), EnumFacing.SOUTH); + shapeInfo.add(baseBuilder.shallowCopy() + .aisle(" E ", " X ", " X ") + .aisle("IMXXO", ">>>>>", " X ") + .aisle(" S ", " F ", " G ") + .build()); + shapeInfo.add(baseBuilder.shallowCopy() + .aisle(" E ", " X ", " X ") + .aisle("OMXXI", "<<<<<", " X ") + .aisle(" S ", " F ", " G ") + .build()); + return shapeInfo; + } + + @Override + protected void formStructure(PatternMatchContext context) { + super.formStructure(context); + Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); + ArrayList parts = new ArrayList<>(rawPartsSet); + + BlockPos inputBusPos = null, outputBusPos = null; + for (IMultiblockPart part : parts) { + // these entities should be IMultiblockAbilityPart, and they should be a MTE + if (part instanceof IMultiblockAbilityPart && part instanceof MetaTileEntityMultiblockPart) { + MultiblockAbility ability = ((IMultiblockAbilityPart) part).getAbility(); + if (ability == MultiblockAbility.IMPORT_ITEMS) + inputBusPos = ((MetaTileEntityMultiblockPart) part).getPos(); + if (ability == MultiblockAbility.EXPORT_ITEMS) + outputBusPos = ((MetaTileEntityMultiblockPart) part).getPos(); + } + } + + // Set a default facing in case some weirdness happened so the direction cannot be determined + EnumFacing conveyorFacing = this.getFrontFacing().rotateYCCW(); + if (inputBusPos != null && outputBusPos != null) { + Vec3i direction = outputBusPos.subtract(inputBusPos); + conveyorFacing = EnumFacing.getFacingFromVector(direction.getX(), direction.getY(), direction.getZ()); + } + + List conveyorBlocks = context.getOrDefault("Conveyors", new LinkedList<>()); + if (conveyorBlocks != null && !conveyorBlocks.isEmpty()) { + World world = getWorld(); + for (BlockPos blockPos : conveyorBlocks) { + Block conveyor = world.getBlockState(blockPos).getBlock(); + if (conveyor instanceof BlockConveyor) { + ((BlockConveyor) conveyor).setFacing(world, blockPos, conveyorFacing); + } + } + } + } + + protected IBlockState getCasingState() { + return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STAINLESS_CLEAN); + } + + protected IBlockState getGearBoxState() { + return MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX); + } + + protected IBlockState getConveyorState(BlockConveyor.ConveyorType type, EnumFacing facing) { + return SuSyBlocks.CONVEYOR_BELT.getState(type, facing); + } + + @Override + public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) { + return Textures.CLEAN_STAINLESS_STEEL_CASING; + } + + @Nonnull + @Override + protected ICubeRenderer getFrontOverlay() { + return Textures.BLAST_FURNACE_OVERLAY; + } + + @Override + public boolean allowsExtendedFacing() { + return false; + } + + public boolean allowsFlip() { + return false; + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png new file mode 100644 index 0000000000000000000000000000000000000000..dbb062ebc187f2ec6363c30e3f26c63014f77e9d GIT binary patch literal 500 zcmVPx$u1Q2eR9J=Wmpw=vK^TUg-CN{1uDOc}fk3MJ5p0q|#L`AmTob`YLW&fEO^A(% zmA1)667WDR#6kk8m2`qZBnU}!jTc+Fm}FTk?r$gTOp0~SIXGnt%XymJ`M!O>*=8Pg zt$Z%03dJI|(^Hn-ZxPXK`{?-MU-y1v-*og$^ zzddco-T^v##=){sN`Yl@w7UjCDwQIW$&gGY5kk;xHfb~(2yy)uTE<{7gjmIVUgZh} z&T2Il%bVTCT|U@aT_DOhG6(>WK@i&qdd9)F!>Vn^_JN*pl$0o?P*TSBfu1oK3?aAr zU}9jEeDVN*pPfne{w{QTv3#)8o@3@wc=|q{&(ZNOyS>;x_~_1FuWstmv(eS~z+kv1 zdVH{7c?`hU_Hy6vgJ%!k0r32Fy}u7yzF;(cNXr*|a_4&nOh5dwNj1 qWpTR=RE!S{hCZ181>*yQA>u#H(te)=y96)*0000>$wc@P1-RNI*gA9gjzIZKfVCc^S7`Hop7Fgb6YS^TS#11{_?gQy#~Z-0}EF zPeeAOz{K+9t18}e9u{~mBlh5;3B#6L?^(-yF1Hl-Ez$@GZA(m$asOnqe3jO&b<7Li z|9;*aEaI9H*|t?o&@nV}T5D;n=cJb0+aK=L&l9-wx=Q@&e&HTNhBKf4m_97p`NxW( Yhu>m(zJ=UupfedfUHx3vIVCg!0PoORTmS$7 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta new file mode 100644 index 000000000..347cb23ac --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta @@ -0,0 +1,13 @@ +{ + "ctm": { + "ctm_version": 1, + "type": "CTM", + "layer": "SOLID", + "textures": [ + "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side_ctm" + ], + "extra": { + "connect_inside": true + } + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side_ctm.png b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side_ctm.png new file mode 100644 index 0000000000000000000000000000000000000000..cebe6d177dc6fdcd520a98e75c044971a1eeb581 GIT binary patch literal 345 zcmV-f0jBPx$6G=otR9HvtmQ9L;Fc5`b{0$<4Aa=WHX8KO9JW0PUQKYLYc(ols4(4a z&t`^k5e8BaFcqun ztgdTG&1iL9hadU$06;p65T-XIX}_ zEYxiE?><7p-9q|*) r_yG+bPx%ut`KgR9J=W)=x+jVHn5p-}BD9?6i4k{a0Gi$=WS128nbC>LMM4sE8uMz=P4D zSP>*TDPadQDM=EE@DM?lx^)X&Ohm|wMCwswU2R-D?7FivJMVOue3jkVcP|}Ec22|c zorQ;aKDk9iq~5C9-V!uVDEfSI%Y-0ftX zX&L~gX{+n0oqyeZKwdKAAaY$7MAPp^0E9xJa5${%x@B3JOeUR9Tb2btW}Fe3rpbst zjT`|G&ps}g;d0G00M}zlFXKdHnkEr#=d9+csqLKg-ncIxxYqC@8k(6;otK%`(AXFZ z2JL)){qViI1M4k^z8=I%d?k|J&fYpPcCL1IcBA$6_s-Hs6 z7J5*dmKl?aKDN*~XS6j}O?A`_Cyi9nNOjZ=pRJym-DrKaaL3=nG%(av+ukx~rPdtb zwAFj2v%pwM52Z}2JouU}eIv;#zD04m(&+s?S2lY99^?Fp_K#jAng9R*07*qoM6N<$f&?>WY5)KL literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta new file mode 100644 index 000000000..addfdd553 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/susy/blockstates/conveyor_belt.json b/src/main/resources/assets/susy/blockstates/conveyor_belt.json new file mode 100644 index 000000000..d78950f3c --- /dev/null +++ b/src/main/resources/assets/susy/blockstates/conveyor_belt.json @@ -0,0 +1,9 @@ +{ + "forge_marker" : 1, + "variants" : { + "facing=north,variant=lv": { "model": "susy:conveyor_belt/lv" }, + "facing=south,variant=lv": { "model": "susy:conveyor_belt/lv", "y": 180 }, + "facing=west,variant=lv": { "model": "susy:conveyor_belt/lv", "y": 270 }, + "facing=east,variant=lv": { "model": "susy:conveyor_belt/lv", "y": 90 } + } +} diff --git a/src/main/resources/assets/susy/lang/en_us.lang b/src/main/resources/assets/susy/lang/en_us.lang index f15982509..db7795df4 100644 --- a/src/main/resources/assets/susy/lang/en_us.lang +++ b/src/main/resources/assets/susy/lang/en_us.lang @@ -100,6 +100,8 @@ tile.home_block.home_renewal_brutalist.tooltip=Renewal Brutalist tile.home_block.home_scifi.name=Home Block tile.home_block.home_scifi.tooltip=Sci-Fi +tile.conveyor_belt.lv.name=Conveyor Belt + # Rocks tile.susy_stone_smooth.gabbro.name=Gabbro tile.susy_stone_smooth.gneiss.name=Gneiss @@ -303,6 +305,7 @@ gregtech.machine.single_column_cryogenic_distillation_plant.name=Single Column C gregtech.machine.reverberatory_furnace.name=Reverberatory Furnace gregtech.machine.blender.name=Blender gregtech.machine.sieve_distillation_tower.name=Sieve Distillation Tower +gregtech.machine.curtain_coater.name=Curtain Coater gregtech.machine.drone_pad.name=Drone Pad gregtech.machine.primitive_smelter.name=Primitive Smelter @@ -740,6 +743,7 @@ recipemap.primitive_smelter.name=Primitive Smelting recipemap.large_fluid_pump.name=Large Fluid Pump recipemap.sieve_distillation.name=Fractional Distillation recipemap.jet_wingpack_fuels.name=Jet Wingpack Fuels +recipemap.curtain_coater.name=Curtain Coater gregtech.multiblock.primitive_mud_pump.description=The Primitive Mud Pump is a Steam Era multiblock that collects mud once per second, but only if it is in a river biome, and when the controller is between Y = 64 and Y = 80 (Inclusive). It can use a Pump, ULV, or LV Output Hatch. diff --git a/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json b/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json new file mode 100644 index 000000000..2eb8e6b83 --- /dev/null +++ b/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json @@ -0,0 +1,24 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/orientable", + "textures": { + "front": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/front", + "side": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side", + "top": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/top", + "particle": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side_ctm" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 4, 16], + "faces": { + "north": {"uv": [0, 0, 16, 4], "texture": "#front", "cullface": "north"}, + "east": {"uv": [0, 4, 16, 0], "texture": "#side", "cullface": "east"}, + "south": {"uv": [16, 4, 0, 0], "texture": "#front", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 16, 16, 0], "texture": "#top", "cullface": "up"}, + "down": {"uv": [16, 16, 0, 0], "texture": "#top", "cullface": "down"} + } + } + ] +} \ No newline at end of file From 371b82802075b1222f4ad33a3f653e0d399d687d Mon Sep 17 00:00:00 2001 From: LittleCube Date: Wed, 26 Feb 2025 16:15:21 +0800 Subject: [PATCH 02/12] refactor texture path --- .../conveyor_belt/lv/front.png | Bin .../conveyor_belt/lv/front.png.mcmeta | 0 .../conveyor_belt/lv/side.png | Bin .../conveyor_belt/lv/side.png.mcmeta | 2 +- .../conveyor_belt/lv/side_ctm.png | Bin .../conveyor_belt/lv/top.png | Bin .../conveyor_belt/lv/top.png.mcmeta | 0 .../assets/susy/models/block/conveyor_belt/lv.json | 10 +++++----- 8 files changed, 6 insertions(+), 6 deletions(-) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/front.png (100%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/front.png.mcmeta (100%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/side.png (100%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/side.png.mcmeta (72%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/side_ctm.png (100%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/top.png (100%) rename src/main/resources/assets/gregtech/textures/blocks/{multiblock_casing => casings}/conveyor_belt/lv/top.png.mcmeta (100%) diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png.mcmeta similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/front.png.mcmeta rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png.mcmeta diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side.png similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side.png.mcmeta similarity index 72% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side.png.mcmeta index 347cb23ac..078457faf 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side.png.mcmeta +++ b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side.png.mcmeta @@ -4,7 +4,7 @@ "type": "CTM", "layer": "SOLID", "textures": [ - "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side_ctm" + "gregtech:blocks/casings/conveyor_belt/lv/side_ctm" ], "extra": { "connect_inside": true diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side_ctm.png b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side_ctm.png similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/side_ctm.png rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/side_ctm.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/top.png similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/top.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/top.png.mcmeta similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/multiblock_casing/conveyor_belt/lv/top.png.mcmeta rename to src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/top.png.mcmeta diff --git a/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json b/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json index 2eb8e6b83..49d93b743 100644 --- a/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json +++ b/src/main/resources/assets/susy/models/block/conveyor_belt/lv.json @@ -2,10 +2,10 @@ "credit": "Made with Blockbench", "parent": "block/orientable", "textures": { - "front": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/front", - "side": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side", - "top": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/top", - "particle": "gregtech:blocks/multiblock_casing/conveyor_belt/lv/side_ctm" + "front": "gregtech:blocks/casings/conveyor_belt/lv/front", + "side": "gregtech:blocks/casings/conveyor_belt/lv/side", + "top": "gregtech:blocks/casings/conveyor_belt/lv/top", + "particle": "gregtech:blocks/casings/conveyor_belt/lv/side_ctm" }, "elements": [ { @@ -21,4 +21,4 @@ } } ] -} \ No newline at end of file +} From 6091ac65b30820af0f060d42ba7f9bec82a93d4d Mon Sep 17 00:00:00 2001 From: LittleCube Date: Wed, 26 Feb 2025 22:10:27 +0800 Subject: [PATCH 03/12] feature: precise milling machine --- .../api/recipes/SuSyRecipeMaps.java | 3 + .../renderer/textures/SusyTextures.java | 1 + .../supersymmetry/common/CommonProxy.java | 2 + .../common/blocks/BlockConveyor.java | 3 - .../common/blocks/BlockDrillBit.java | 63 +++++++++ .../common/blocks/SuSyBlocks.java | 5 + .../SuSyMetaTileEntities.java | 2 + .../MetaTileEntityPreciseMillingMachine.java | 131 ++++++++++++++++++ .../blocks/casings/drill_bit/steel/side.png | Bin 0 -> 787 bytes .../multiblocks/milling/overlay_front.png | Bin 0 -> 484 bytes .../milling/overlay_front_active.png | Bin 0 -> 965 bytes .../milling/overlay_front_active.png.mcmeta | 6 + .../milling/overlay_front_active_emissive.png | Bin 0 -> 725 bytes .../overlay_front_active_emissive.png.mcmeta | 6 + .../milling/overlay_front_emissive.png | Bin 0 -> 113 bytes .../milling/overlay_front_paused.png | Bin 0 -> 486 bytes .../milling/overlay_front_paused_emissive.png | Bin 0 -> 144 bytes .../assets/susy/blockstates/drill_bit.json | 6 + .../resources/assets/susy/lang/en_us.lang | 4 + .../susy/models/block/drill_bit/steel.json | 8 ++ 20 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 src/main/java/supersymmetry/common/blocks/BlockDrillBit.java create mode 100644 src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/casings/drill_bit/steel/side.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active.png.mcmeta create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active_emissive.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active_emissive.png.mcmeta create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_emissive.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_paused.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_paused_emissive.png create mode 100644 src/main/resources/assets/susy/blockstates/drill_bit.json create mode 100644 src/main/resources/assets/susy/models/block/drill_bit/steel.json diff --git a/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java b/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java index a6cccb41e..01263af5b 100644 --- a/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java +++ b/src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java @@ -342,6 +342,9 @@ public class SuSyRecipeMaps { .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL) .setSound(GTSoundEvents.BATH); + public static final RecipeMap MILLING_RECIPES = new RecipeMap<>("milling", 2, 1, 0, 0, new SimpleRecipeBuilder().EUt(VA[LV]), false) + .setSound(GTSoundEvents.CUT); + public static void init(){ RecipeMaps.SIFTER_RECIPES.setMaxFluidInputs(1); RecipeMaps.SIFTER_RECIPES.setMaxFluidOutputs(1); diff --git a/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java b/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java index 322069299..c3eb097d8 100644 --- a/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java +++ b/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java @@ -81,6 +81,7 @@ public SusyTextures(){ public static final OrientedOverlayRenderer SINTERING_OVERLAY = new OrientedOverlayRenderer("machines/multiblocks/sintering"); public static final OrientedOverlayRenderer SMOKE_STACK_OVERLAY = new OrientedOverlayRenderer("machines/multiblocks/smoke_stack"); public static final OrientedOverlayRenderer PRIMITIVE_SMELTER_OVERLAY = new OrientedOverlayRenderer("machines/multiblocks/primitive_smelter"); + public static final OrientedOverlayRenderer MILLING_OVERLAY = new OrientedOverlayRenderer("machines/multiblocks/milling"); public static final SimpleOverlayRenderer SILICON_CARBIDE_CASING = new SimpleOverlayRenderer("multiblock_casing/silicon_carbide_casing"); public static final SimpleOverlayRenderer ULV_STRUCTURAL_CASING = new SimpleOverlayRenderer("multiblock_casing/ulv_structural_casing"); diff --git a/src/main/java/supersymmetry/common/CommonProxy.java b/src/main/java/supersymmetry/common/CommonProxy.java index a01e470f0..42afd0c2a 100644 --- a/src/main/java/supersymmetry/common/CommonProxy.java +++ b/src/main/java/supersymmetry/common/CommonProxy.java @@ -77,6 +77,7 @@ public static void registerBlocks(@NotNull RegistryEvent.Register event) registry.register(SuSyBlocks.STRUCTURAL_BLOCK); registry.register(SuSyBlocks.STRUCTURAL_BLOCK_1); registry.register(SuSyBlocks.DRILL_HEAD); + registry.register(SuSyBlocks.DRILL_BIT); registry.register(SuSyBlocks.DEPOSIT_BLOCK); registry.register(SuSyBlocks.RESOURCE_BLOCK); registry.register(SuSyBlocks.RESOURCE_BLOCK_1); @@ -105,6 +106,7 @@ public static void registerItems(@NotNull RegistryEvent.Register event) { registry.register(createItemBlock(block, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.ALTERNATOR_COIL, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.DRILL_HEAD, VariantItemBlock::new)); + registry.register(createItemBlock(SuSyBlocks.DRILL_BIT, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.TURBINE_ROTOR, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.SEPARATOR_ROTOR, VariantItemBlock::new)); registry.register(createItemBlock(SuSyBlocks.STRUCTURAL_BLOCK, VariantItemBlock::new)); diff --git a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java index b649d0a6a..7e6fff3e8 100644 --- a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java +++ b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java @@ -2,7 +2,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -import supersymmetry.api.SusyLog; import supersymmetry.api.blocks.VariantHorizontalRotatableBlock; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; @@ -59,8 +58,6 @@ public boolean setFacing(World world, BlockPos pos, EnumFacing facing) { if (!FACING.getAllowedValues().contains(facing)) return false; - SusyLog.logger.info("rotated!"); - SusyLog.logger.info(facing); IBlockState state = world.getBlockState(pos); world.setBlockState(pos, state.withProperty(FACING, facing)); return true; diff --git a/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java b/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java new file mode 100644 index 000000000..37350ba13 --- /dev/null +++ b/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java @@ -0,0 +1,63 @@ +package supersymmetry.common.blocks; + +import gregtech.api.block.IStateHarvestLevel; +import gregtech.api.block.VariantBlock; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; + +public class BlockDrillBit extends VariantBlock { + public BlockDrillBit(){ + super(net.minecraft.block.material.Material.IRON); + setTranslationKey("drill_head"); + setHardness(5.0f); + setResistance(10.0f); + setSoundType(SoundType.METAL); + setHarvestLevel("wrench", 2); + setDefaultState(getState(DrillBitType.STEEL)); + } + + @Override + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { + return false; + } + + @NotNull + @Override + public BlockRenderLayer getRenderLayer() { + return BlockRenderLayer.SOLID; + } + + public enum DrillBitType implements IStringSerializable, IStateHarvestLevel { + STEEL("steel", 3); + + private final String name; + private final int harvestLevel; + + DrillBitType(String name, int harvestLevel) { + this.name = name; + this.harvestLevel = harvestLevel; + } + + @Nonnull + public String getName() { + return this.name; + } + + public int getHarvestLevel(IBlockState state) { + return this.harvestLevel; + } + + public String getHarvestTool(IBlockState state) { + return "wrench"; + } + } +} diff --git a/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java b/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java index e80805ce4..2b91b86c7 100644 --- a/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java +++ b/src/main/java/supersymmetry/common/blocks/SuSyBlocks.java @@ -29,6 +29,7 @@ public class SuSyBlocks { public static BlockTurbineRotor TURBINE_ROTOR; public static BlockSeparatorRotor SEPARATOR_ROTOR; public static BlockDrillHead DRILL_HEAD; + public static BlockDrillBit DRILL_BIT; public static BlockStructural STRUCTURAL_BLOCK; public static BlockStructural1 STRUCTURAL_BLOCK_1; public static BlockDeposit DEPOSIT_BLOCK; @@ -54,6 +55,9 @@ public static void init() { DRILL_HEAD = new BlockDrillHead(); DRILL_HEAD.setRegistryName("drill_head"); + DRILL_BIT = new BlockDrillBit(); + DRILL_BIT.setRegistryName("drill_bit"); + COAGULATION_TANK_WALL = new BlockCoagulationTankWall(); COAGULATION_TANK_WALL.setRegistryName("coagulation_tank_wall"); @@ -123,6 +127,7 @@ public static void registerItemModels() { registerItemModel(block); registerItemModel(ALTERNATOR_COIL); registerItemModel(DRILL_HEAD); + registerItemModel(DRILL_BIT); registerItemModel(TURBINE_ROTOR); registerItemModel(SEPARATOR_ROTOR); registerItemModel(STRUCTURAL_BLOCK); diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index 30bc93de3..ae4d27c0f 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -170,6 +170,7 @@ public class SuSyMetaTileEntities { public static MetaTileEntitySieveDistillationTower SIEVE_DISTILLATION_TOWER; public static MetaTileEntityCurtainCoater CURTAIN_COATER; + public static MetaTileEntityPreciseMillingMachine MILLING; public static MetaTileEntityBridge INV_BRIDGE; public static MetaTileEntityBridge TANK_BRIDGE; @@ -271,6 +272,7 @@ public static void init() { registerSimpleMTE(ION_IMPLANTER, 12, 14666, "ion_implanter", SuSyRecipeMaps.ION_IMPLANTATION_RECIPES, SusyTextures.ION_IMPLANTER_OVERLAY, true, GTUtility.defaultTankSizeFunction); CURTAIN_COATER = registerMetaTileEntity(14513, new MetaTileEntityCurtainCoater(susyId("curtain_coater"))); + MILLING = registerMetaTileEntity(14514, new MetaTileEntityPreciseMillingMachine(susyId("milling"))); ArrayList ids = new ArrayList<>(); for (int id = 14500; id < 15000; id++) { diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java new file mode 100644 index 000000000..fa89a712c --- /dev/null +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java @@ -0,0 +1,131 @@ +package supersymmetry.common.metatileentities.multi.electric; + +import gregtech.api.GTValues; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.pattern.BlockPattern; +import gregtech.api.pattern.FactoryBlockPattern; +import gregtech.api.pattern.MultiblockShapeInfo; +import gregtech.api.pattern.TraceabilityPredicate; +import gregtech.api.util.RelativeDirection; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; +import gregtech.common.blocks.BlockGlassCasing; +import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; +import gregtech.common.blocks.BlockTurbineCasing; +import gregtech.common.blocks.MetaBlocks; +import gregtech.common.metatileentities.MetaTileEntities; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.Vec3i; +import org.jetbrains.annotations.NotNull; +import supersymmetry.api.recipes.SuSyRecipeMaps; +import supersymmetry.client.renderer.textures.SusyTextures; +import supersymmetry.common.blocks.BlockDrillBit; +import supersymmetry.common.blocks.SuSyBlocks; +import supersymmetry.common.metatileentities.SuSyMetaTileEntities; + +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; + +public class MetaTileEntityPreciseMillingMachine extends RecipeMapMultiblockController { + public MetaTileEntityPreciseMillingMachine(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, SuSyRecipeMaps.MILLING_RECIPES); + } + + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new MetaTileEntityPreciseMillingMachine(this.metaTileEntityId); + } + + @NotNull + protected BlockPattern createStructurePattern() { + // autoAbilities() creates new predicate each time, so don't do that + TraceabilityPredicate autoAbilitiesPredicate = autoAbilities(); + return FactoryBlockPattern.start() + .aisle("BBBBBB", "CCCCCC", "CGGGGC", "CCCCCC") + .aisle("BBBBBB", "C C", "CDDDDC", "CCCCCC") + .aisle("BBBBBB", "C C", "C C", "CCCCCC") + .aisle("BBBBBB", "CWWWWS", "CWWWWC", "CCCCCC") + .where('S', selfPredicate()) + .where('B', states(getBaseCasingState()).setMinGlobalLimited(18).or(autoAbilitiesPredicate)) + .where('C', states(getUpperCasingState()).setMinGlobalLimited(35).or(autoAbilitiesPredicate)) + .where('D', states(getDrillBitState())) + .where('G', states(getGearBoxState())) + .where('W', states(getGlassState())) + .build(); + } + + @Override + public List getMatchingShapes() { + ArrayList shapeInfo = new ArrayList<>(); + MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() + .where('S', SuSyMetaTileEntities.MILLING, EnumFacing.SOUTH) + .where('B', getBaseCasingState()) + .where('C', getUpperCasingState()) + .where('D', getDrillBitState()) + .where('G', getGearBoxState()) + .where('W', getGlassState()) + .where('I', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.HV], EnumFacing.SOUTH) + .where('O', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.HV], EnumFacing.SOUTH) + .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.HV], EnumFacing.SOUTH) + .where('G', getGearBoxState()) + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getBaseCasingState(), EnumFacing.SOUTH); + shapeInfo.add(baseBuilder.shallowCopy() + .aisle("BBBBBB", "CCCCCC", "CGGGGC", "CCCCCC") + .aisle("BBBBBB", "C C", "CDDDDC", "CCCCCC") + .aisle("BBBBBB", "C C", "C C", "CCCCCC") + .aisle("BBBBEM", "OWWWWS", "IWWWWC", "CCCCCC") + .build()); + return shapeInfo; + } + + public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { + if (sourcePart instanceof MetaTileEntityMultiblockPart) { + Vec3i facingVec = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getDirectionVec(); + Vec3i positionalVec = ((MetaTileEntityMultiblockPart) sourcePart).getPos().subtract(getPos()); + // For the only non-zero component, the vector sign should be the same (or zero, which means it is on the controller's level + // No need to worry about overflow: |facingVec| = 1 + if (facingVec.getX() * positionalVec.getX() >= 0 && + facingVec.getY() * positionalVec.getY() >= 0 && + facingVec.getZ() * positionalVec.getZ() >= 0) { + return Textures.CLEAN_STAINLESS_STEEL_CASING; + } + return Textures.SOLID_STEEL_CASING; + } + return Textures.CLEAN_STAINLESS_STEEL_CASING; + } + + protected static IBlockState getBaseCasingState() { + return MetaBlocks.METAL_CASING.getState(MetalCasingType.STEEL_SOLID); + } + + protected static IBlockState getUpperCasingState() { + return MetaBlocks.METAL_CASING.getState(MetalCasingType.STAINLESS_CLEAN); + } + + protected static IBlockState getDrillBitState() { + return SuSyBlocks.DRILL_BIT.getState(BlockDrillBit.DrillBitType.STEEL); + } + + protected static IBlockState getGlassState() { + return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.TEMPERED_GLASS); + } + + protected static IBlockState getGearBoxState() { + return MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX); + } + + @Nonnull + @Override + protected ICubeRenderer getFrontOverlay() { + return SusyTextures.MILLING_OVERLAY; + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/casings/drill_bit/steel/side.png b/src/main/resources/assets/gregtech/textures/blocks/casings/drill_bit/steel/side.png new file mode 100644 index 0000000000000000000000000000000000000000..20a1bda2558f8f6673cb6ce8a49b16a2f1603e01 GIT binary patch literal 787 zcmV+u1MK{XP)Px%%}GQ-R5(vPQ%y)zQ562}a~FXimcDs26K&gwk^Km6#9-X%EC&2(2GbxcB29$} znNlG&Br$QYiDot~M06wmAml>VQJWwf=g*}GE?o8Qz3<(+=UNvohx_h5-}%1poX2){ zc9fJ7hMDlw2;LI{pm!^2RFfdOEQX(A>ng(}NJJe~lT9FhwIu(GnE zLZL8TJbwmQ7Cnq7;^3S^2m$VLaPES0fp5FJ#L5ED*3*MxsRWkGqheVsJ7J!~Th+I=0% zdwV#qt;My|Q{0Nh@M~=iRSgYb3kwSbFg^W_lJ>vulN(iFec8;%@M%-{0BaE?(U|uHkAv3Qn?JfuAU;BnwnBU$1zE|byCtJ{WzP=;^N{0eSLjY zl|0ciASAW9T&aM)Nu`wIIN*Q(2PsVNg&ry?u(Y)FUlP%lx}^qOGp$rkz>>)%NhlTz zumd(-YIAJcMkbR%b#*l&k#>|yMcDQArX!Uy>gwuH)&QepW6H5@Gj&wOv`z1=tu36L zogo^H5+lRRjIm~Xq9qKy98!9=J>d~Oo#=T+@4>+VNx0qEcu8FYT!N4ki9da@_`vI_ RxfcKc002ovPDHLkV1m(pYVH64 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front.png b/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front.png new file mode 100644 index 0000000000000000000000000000000000000000..05d31bdb39653165db94e77635aaf255dfcea124 GIT binary patch literal 484 zcmVPx$o=HSOR5*>zlD&!)Q4oc{duMLl?w)l86|oT~SQ7(5UuVI{NH8$*4IB&%TyQ~| zM3|@8ci7x)*`P5pa22+v`&R#41DUqlc>q0GRdG(8`hkB91F&2!<1W!O4FHS90svLr zBZ&yAN>LPMzDvCSys0zq%|Vj**Dqh7s)z`ylMkU(^<`aGubv&JU(U~Awc_d7831;y zoO&^#ZT325-v0?!E0Xnk2<^_MF@~<|MLB zV@T7Kcc0c_ZfCTyqwPCHgok;~qvdj6pzC97+b%XuL*|`*b8@P;ZywJ27_k^E236(g z=rMQiJQ$WeAKUr%<7a=Er4}GdoT;kNf4?qc6%=cK_X^b(pJv0ACISFuUB|MnBS6!3 z(O7HDsP5B@P;H0U0OWZdopZyD|6b(o?qi4u7Z(>3aq>Km_nth*&ETrEBodKXr0EUG zJaSc9!sUjdCPx&e@R3^RA_=tb#4ylE<- zt$666N@#;fuq_x`i3kxvrJ!C!5R3Mp|3Q%+0$M$+snsQ!CHr)qnP$_yP4W32{R4(AG-E6P02 zi2_d@KlL`d?rNx_EYT=*smQXN(cwoRuU7@v08tbJaCJ4oq_#|LM!dtvn3P{v+oee@ zT5B4O2F>LqMn`sIOm_rcuZRFPP1Q=Cb?+@;^Bk>f%J=-LCZi({(Oh1tMxX%p?0K;C zeGlhKio&6Ft=g`wwF$$JEX#?am^4l4UH0Y6KdRoz0NA_t;j$G!$MBG*?zM=c?wLC# zqm$LSn)t-6MV6M9s&?LuQ*->@HR^Fd;e0wKV=doBYxNohKEp#An*{6U$&DQ(KYh+` z)>ivzn&RskzVC5urC%>eKjOhacu*Db*%Oa531*b7v6dTV~qM_=7KyQhzB1@S;UxHB1a54Q970|iX=-x<_r$G@#=BJT_0!A21e2HOMrCMaVJ=U)3- zJP;55HsZnHdtmdNLr0#j{z;gylj4DRuwlf5?csseH8p+cDcWO>ar=OHARcTO@nHLS n;CnvPhxc<2_lXDpOAr14$G^O7Px%k4Z#9RA_bZw*JsgzuM5byRNo(fVy4SEsUi#Kg0w1P*K zP>V>g5e%(F1ih#ftZzVS1z$ps1rHWtt5}lkVc5y+j)!zN30B4Gh7CU7Q$l7ZGXwdM ze?Z?y;f>X`_j)j$#?ed$H?LoVloGaWqflIgr!{Jg2ByxQq1~-5y-+QpG*%`6Fgs_; z3=L{eHL3F%Ov}Yd^=(@OTf*=TB zStbpn)3{e&){f(#__(4?BL$^>DDAff=0M1`w;oO4`vH7E&`K#dwn_7)M>uvkLxI*X zKrnRcn(@<9`uONc{o@t@e62SiJgGg|#GwHTLU{O6ceU^&45Kx)y1j{!;nDUPb?w>n zsHU3H`lM1Yj1*a>6^$7g9z}I~6CC$XV-J$xK{UbTyW=enT$gsf?c&qt9ek`-QExQ5 z4wXINVu?LSf(OwdUU_g1LI`?YSm*Z#T<>EK66HaDE(bU3lMn){h4t1Mum@bPVhkugJ=bz2jQy@d!X#=K}Y*~@UZd(j^p6zi;V^7>_Or^kV;|p#>MDA31APn zxMC0b!UMxdQGWIU+-z$L>;V@`>_OjnV3`*3b2)%LNNC>yHAcu30xX(^00000NkvXX Hu0mjf%|JpO literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active_emissive.png.mcmeta new file mode 100644 index 000000000..e8b3d8834 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_active_emissive.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "frametime": 1, + "frames": [0, 1, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 8, 8, 7, 7, 6, 6, 10, 11, 12, 13, 14] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_emissive.png b/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_emissive.png new file mode 100644 index 0000000000000000000000000000000000000000..c8259210adaf3a084f9b39f9493ee6dccbae4a50 GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|v^`xMLo9le z6C^4h++ao#v literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_paused.png b/src/main/resources/assets/gregtech/textures/blocks/machines/multiblocks/milling/overlay_front_paused.png new file mode 100644 index 0000000000000000000000000000000000000000..98d6d8efc50cde709611d5a029607f6787e3ac13 GIT binary patch literal 486 zcmV@P)Px$ph-kQR5*>zlEG>eK@f(&?wPLMnaQ#tia3fZH;9o-l%;)p44Kz&yK$c|y zIOlGNLne$U)b2h>4ll z39sIrkt7MHA3hRC5k9o|&>|u{xtH_w;rwQSw(an~#ruZT3NPQj=hp6wE(A0R9Td(v z_V*9CbNfL*?09JB`_+nRnh=208rIc@Wm&PV9a{hCRj(^-lJ;8~6=2iXY9pbq9}UZ=nKXeer+_?1n%#3RP{C!*my-^12tpB*Esd%IYESPgEJNp%CdyP ciT^+N4OP^oHC^L$`2YX_07*qoM6N<$f+FXN*^`9UA!~gNIMebXfaN4u%;A8)r|M!3NOASbGd7*lbP0l+XkK)k-u! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/susy/blockstates/drill_bit.json b/src/main/resources/assets/susy/blockstates/drill_bit.json new file mode 100644 index 000000000..7c9512c8e --- /dev/null +++ b/src/main/resources/assets/susy/blockstates/drill_bit.json @@ -0,0 +1,6 @@ +{ + "forge_marker" : 1, + "variants" : { + "variant=steel": { "model": "susy:drill_bit/steel" } + } +} diff --git a/src/main/resources/assets/susy/lang/en_us.lang b/src/main/resources/assets/susy/lang/en_us.lang index db7795df4..a011debf8 100644 --- a/src/main/resources/assets/susy/lang/en_us.lang +++ b/src/main/resources/assets/susy/lang/en_us.lang @@ -102,6 +102,8 @@ tile.home_block.home_scifi.tooltip=Sci-Fi tile.conveyor_belt.lv.name=Conveyor Belt +tile.drill_bit.steel.name=Steel Drill Bit Block + # Rocks tile.susy_stone_smooth.gabbro.name=Gabbro tile.susy_stone_smooth.gneiss.name=Gneiss @@ -306,6 +308,7 @@ gregtech.machine.reverberatory_furnace.name=Reverberatory Furnace gregtech.machine.blender.name=Blender gregtech.machine.sieve_distillation_tower.name=Sieve Distillation Tower gregtech.machine.curtain_coater.name=Curtain Coater +gregtech.machine.milling.name=Precise Milling Machine gregtech.machine.drone_pad.name=Drone Pad gregtech.machine.primitive_smelter.name=Primitive Smelter @@ -744,6 +747,7 @@ recipemap.large_fluid_pump.name=Large Fluid Pump recipemap.sieve_distillation.name=Fractional Distillation recipemap.jet_wingpack_fuels.name=Jet Wingpack Fuels recipemap.curtain_coater.name=Curtain Coater +recipemap.milling.name=Precise Milling Machine gregtech.multiblock.primitive_mud_pump.description=The Primitive Mud Pump is a Steam Era multiblock that collects mud once per second, but only if it is in a river biome, and when the controller is between Y = 64 and Y = 80 (Inclusive). It can use a Pump, ULV, or LV Output Hatch. diff --git a/src/main/resources/assets/susy/models/block/drill_bit/steel.json b/src/main/resources/assets/susy/models/block/drill_bit/steel.json new file mode 100644 index 000000000..8dcb759bc --- /dev/null +++ b/src/main/resources/assets/susy/models/block/drill_bit/steel.json @@ -0,0 +1,8 @@ +{ + "parent": "block/orientable", + "textures": { + "top": "gregtech:blocks/casings/solid/machine_casing_solid_steel", + "front": "gregtech:blocks/casings/drill_bit/steel/side", + "side": "gregtech:blocks/casings/drill_bit/steel/side" + } +} From 36c0761242d9df86f29c1358f5b23ce357bf4eba Mon Sep 17 00:00:00 2001 From: LittleCube Date: Thu, 27 Feb 2025 14:28:23 +0800 Subject: [PATCH 04/12] refactor: change conveyor predicate and re-orientation logic --- .../multiblock/SuSyPredicates.java | 29 +++++++- .../common/blocks/BlockConveyor.java | 9 --- .../electric/MetaTileEntityCurtainCoater.java | 66 +++++-------------- 3 files changed, 43 insertions(+), 61 deletions(-) diff --git a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java index 0061ac032..3c3953d7f 100644 --- a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java +++ b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java @@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.Loader; import org.jetbrains.annotations.NotNull; import supersymmetry.SuSyValues; +import supersymmetry.common.blocks.BlockConveyor; import supersymmetry.common.blocks.BlockCoolingCoil; import supersymmetry.common.blocks.BlockSinteringBrick; import supersymmetry.common.blocks.SuSyBlocks; @@ -59,7 +60,7 @@ public class SuSyPredicates { ); private static final Supplier RAILS = () -> new TraceabilityPredicate(blockWorldState -> { - if(!Loader.isModLoaded(SuSyValues.MODID_IMMERSIVERAILROADING)) return true; + if (!Loader.isModLoaded(SuSyValues.MODID_IMMERSIVERAILROADING)) return true; IBlockState state = blockWorldState.getBlockState(); @@ -68,6 +69,27 @@ public class SuSyPredicates { return block == IRBlocks.BLOCK_RAIL.internal || block == IRBlocks.BLOCK_RAIL_GAG.internal; }); + // Allow all conveyor belts, and require them to have the same type. + private static final Supplier CONVEYOR_BELT = + () -> new TraceabilityPredicate(blockWorldState -> { + IBlockState state = blockWorldState.getBlockState(); + if (state.getBlock() instanceof BlockConveyor) { + BlockConveyor.ConveyorType type = ((BlockConveyor) state.getBlock()).getState(state); + Object currentConveyor = blockWorldState.getMatchContext().getOrPut("CoilType", type); + if (!currentConveyor.equals(type)) { + blockWorldState.setError(new PatternStringError("gregtech.multiblock.pattern.error.conveyor")); + return false; + } + // Adds the position of the conveyor to the match context + blockWorldState.getMatchContext().getOrPut("ConveyorBelt", new LinkedList<>()).add(blockWorldState.getPos()); + return true; + } + return false; + }, () -> Arrays.stream(BlockConveyor.ConveyorType.values()) + .map(entry -> new BlockInfo(SuSyBlocks.CONVEYOR_BELT.getState(entry), null)) + .toArray(BlockInfo[]::new) + ).addTooltips("gregtech.multiblock.pattern.error.conveyor"); + @NotNull public static TraceabilityPredicate coolingCoils() { return COOLING_COILS.get(); @@ -82,4 +104,9 @@ public static TraceabilityPredicate sinteringBricks() { public static TraceabilityPredicate rails() { return RAILS.get(); } + + @NotNull + public static TraceabilityPredicate conveyorBelts() { + return CONVEYOR_BELT.get(); + } } diff --git a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java index 7e6fff3e8..e01b367ce 100644 --- a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java +++ b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java @@ -54,15 +54,6 @@ public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } - public boolean setFacing(World world, BlockPos pos, EnumFacing facing) - { - if (!FACING.getAllowedValues().contains(facing)) - return false; - IBlockState state = world.getBlockState(pos); - world.setBlockState(pos, state.withProperty(FACING, facing)); - return true; - } - public enum ConveyorType implements IStringSerializable { LV_CONVEYOR("lv"); diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java index 19ecdf5d5..eedca0ce6 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -3,26 +3,22 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.*; -import gregtech.api.util.BlockInfo; +import gregtech.api.util.RelativeDirection; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; import gregtech.common.blocks.*; import gregtech.common.metatileentities.MetaTileEntities; -import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; -import org.apache.commons.lang3.ArrayUtils; import supersymmetry.api.recipes.SuSyRecipeMaps; import supersymmetry.common.blocks.BlockConveyor; import supersymmetry.common.blocks.SuSyBlocks; @@ -31,21 +27,9 @@ import javax.annotation.Nonnull; import java.util.*; -public class MetaTileEntityCurtainCoater extends RecipeMapMultiblockController { - - public static TraceabilityPredicate conveyors(BlockConveyor.ConveyorType... variants) { - - return new TraceabilityPredicate(blockWorldState -> { - IBlockState state = blockWorldState.getBlockState(); - if (state.getBlock() instanceof BlockConveyor) { - blockWorldState.getMatchContext().getOrPut("Conveyors", new LinkedList<>()).add(blockWorldState.getPos()); - BlockConveyor.ConveyorType property = ((BlockConveyor) state.getBlock()).getState(state); - return ArrayUtils.contains(variants, property); - } - return false; - }, () -> Arrays.stream(variants).map(m -> new BlockInfo(SuSyBlocks.CONVEYOR_BELT.getState(m), null)).toArray(BlockInfo[]::new)); - } +import static supersymmetry.api.metatileentity.multiblock.SuSyPredicates.conveyorBelts; +public class MetaTileEntityCurtainCoater extends RecipeMapMultiblockController { public MetaTileEntityCurtainCoater(ResourceLocation metaTileEntityId) { super(metaTileEntityId, SuSyRecipeMaps.CURTAIN_COATER); @@ -58,19 +42,18 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEnti @Override protected BlockPattern createStructurePattern() { - TraceabilityPredicate inputBus = abilities(MultiblockAbility.IMPORT_ITEMS).setMinGlobalLimited(1).setMaxGlobalLimited(1); - TraceabilityPredicate outputBus = abilities(MultiblockAbility.EXPORT_ITEMS).setMinGlobalLimited(1).setMaxGlobalLimited(1); return FactoryBlockPattern.start() .aisle(" X ", " X ", " X ") - .aisle("IXXXI", "BBBBB", " X ") + .aisle("IXXXO", "BBBBB", " X ") .aisle(" S ", " F ", " G ") .where('S', selfPredicate()) - .where('I', inputBus.or(outputBus)) + .where('I', abilities(MultiblockAbility.IMPORT_ITEMS)) + .where('O', abilities(MultiblockAbility.EXPORT_ITEMS)) .where('X', states(getCasingState()).setMinGlobalLimited(4) .or(autoAbilities(true, true, false, false, false, false, false))) .where('G', states(getGearBoxState())) .where('F', abilities(MultiblockAbility.IMPORT_FLUIDS)) - .where('B', conveyors(BlockConveyor.ConveyorType.LV_CONVEYOR)) + .where('B', conveyorBelts()) .where(' ', any()) .build(); } @@ -86,11 +69,10 @@ public List getMatchingShapes() { .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LV], EnumFacing.NORTH) .where('G', getGearBoxState()) - .where('>', getConveyorState(BlockConveyor.ConveyorType.LV_CONVEYOR, EnumFacing.EAST)) - .where('<', getConveyorState(BlockConveyor.ConveyorType.LV_CONVEYOR, EnumFacing.WEST)) + .where('>', SuSyBlocks.CONVEYOR_BELT.getDefaultState().withProperty(BlockConveyor.FACING, EnumFacing.EAST)) + .where('<', SuSyBlocks.CONVEYOR_BELT.getDefaultState().withProperty(BlockConveyor.FACING, EnumFacing.WEST)) .where('M', - () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : - getCasingState(), EnumFacing.SOUTH); + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.SOUTH); shapeInfo.add(baseBuilder.shallowCopy() .aisle(" E ", " X ", " X ") .aisle("IMXXO", ">>>>>", " X ") @@ -107,35 +89,17 @@ public List getMatchingShapes() { @Override protected void formStructure(PatternMatchContext context) { super.formStructure(context); - Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); - ArrayList parts = new ArrayList<>(rawPartsSet); - - BlockPos inputBusPos = null, outputBusPos = null; - for (IMultiblockPart part : parts) { - // these entities should be IMultiblockAbilityPart, and they should be a MTE - if (part instanceof IMultiblockAbilityPart && part instanceof MetaTileEntityMultiblockPart) { - MultiblockAbility ability = ((IMultiblockAbilityPart) part).getAbility(); - if (ability == MultiblockAbility.IMPORT_ITEMS) - inputBusPos = ((MetaTileEntityMultiblockPart) part).getPos(); - if (ability == MultiblockAbility.EXPORT_ITEMS) - outputBusPos = ((MetaTileEntityMultiblockPart) part).getPos(); - } - } - // Set a default facing in case some weirdness happened so the direction cannot be determined - EnumFacing conveyorFacing = this.getFrontFacing().rotateYCCW(); - if (inputBusPos != null && outputBusPos != null) { - Vec3i direction = outputBusPos.subtract(inputBusPos); - conveyorFacing = EnumFacing.getFacingFromVector(direction.getX(), direction.getY(), direction.getZ()); - } + // RelativeDirection will take into account of the multi flipping pattern + EnumFacing conveyorFacing = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - List conveyorBlocks = context.getOrDefault("Conveyors", new LinkedList<>()); + List conveyorBlocks = context.getOrDefault("ConveyorBelt", new LinkedList<>()); if (conveyorBlocks != null && !conveyorBlocks.isEmpty()) { World world = getWorld(); for (BlockPos blockPos : conveyorBlocks) { Block conveyor = world.getBlockState(blockPos).getBlock(); if (conveyor instanceof BlockConveyor) { - ((BlockConveyor) conveyor).setFacing(world, blockPos, conveyorFacing); + world.setBlockState(blockPos, world.getBlockState(blockPos).withProperty(BlockConveyor.FACING, conveyorFacing)); } } } @@ -170,6 +134,6 @@ public boolean allowsExtendedFacing() { } public boolean allowsFlip() { - return false; + return true; } } From e90dafc7fd20227f21ef96dc36cb2b518e11edfb Mon Sep 17 00:00:00 2001 From: LittleCube Date: Thu, 27 Feb 2025 15:39:38 +0800 Subject: [PATCH 05/12] fix: disable extended facing of milling machine and restrict components to upper/lower parts --- .../common/blocks/BlockDrillBit.java | 2 +- .../MetaTileEntityPreciseMillingMachine.java | 41 ++++++++++--------- .../resources/assets/susy/lang/en_us.lang | 5 +++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java b/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java index 37350ba13..2e49e8111 100644 --- a/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java +++ b/src/main/java/supersymmetry/common/blocks/BlockDrillBit.java @@ -16,7 +16,7 @@ public class BlockDrillBit extends VariantBlock { public BlockDrillBit(){ super(net.minecraft.block.material.Material.IRON); - setTranslationKey("drill_head"); + setTranslationKey("drill_bit"); setHardness(5.0f); setResistance(10.0f); setSoundType(SoundType.METAL); diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java index fa89a712c..9059164e4 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java @@ -3,13 +3,13 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.MultiblockShapeInfo; -import gregtech.api.pattern.TraceabilityPredicate; -import gregtech.api.util.RelativeDirection; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; @@ -18,11 +18,9 @@ import gregtech.common.blocks.BlockTurbineCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; -import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.Vec3i; import org.jetbrains.annotations.NotNull; import supersymmetry.api.recipes.SuSyRecipeMaps; import supersymmetry.client.renderer.textures.SusyTextures; @@ -30,7 +28,6 @@ import supersymmetry.common.blocks.SuSyBlocks; import supersymmetry.common.metatileentities.SuSyMetaTileEntities; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -45,16 +42,20 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @NotNull protected BlockPattern createStructurePattern() { - // autoAbilities() creates new predicate each time, so don't do that - TraceabilityPredicate autoAbilitiesPredicate = autoAbilities(); return FactoryBlockPattern.start() .aisle("BBBBBB", "CCCCCC", "CGGGGC", "CCCCCC") .aisle("BBBBBB", "C C", "CDDDDC", "CCCCCC") .aisle("BBBBBB", "C C", "C C", "CCCCCC") .aisle("BBBBBB", "CWWWWS", "CWWWWC", "CCCCCC") .where('S', selfPredicate()) - .where('B', states(getBaseCasingState()).setMinGlobalLimited(18).or(autoAbilitiesPredicate)) - .where('C', states(getUpperCasingState()).setMinGlobalLimited(35).or(autoAbilitiesPredicate)) + .where('B', states(getBaseCasingState()).setMinGlobalLimited(18) + .or(abilities(MultiblockAbility.INPUT_ENERGY).addTooltip("gregtech.multiblock.pattern.error.milling.lower")) + .or(abilities(MultiblockAbility.MAINTENANCE_HATCH).addTooltip("gregtech.multiblock.pattern.error.milling.lower")) + ) + .where('C', states(getUpperCasingState()).setMinGlobalLimited(35) + .or(abilities(MultiblockAbility.IMPORT_ITEMS).addTooltip("gregtech.multiblock.pattern.error.milling.upper")) + .or(abilities(MultiblockAbility.EXPORT_ITEMS).addTooltip("gregtech.multiblock.pattern.error.milling.upper")) + ) .where('D', states(getDrillBitState())) .where('G', states(getGearBoxState())) .where('W', states(getGlassState())) @@ -88,18 +89,13 @@ public List getMatchingShapes() { } public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { - if (sourcePart instanceof MetaTileEntityMultiblockPart) { - Vec3i facingVec = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getDirectionVec(); - Vec3i positionalVec = ((MetaTileEntityMultiblockPart) sourcePart).getPos().subtract(getPos()); - // For the only non-zero component, the vector sign should be the same (or zero, which means it is on the controller's level - // No need to worry about overflow: |facingVec| = 1 - if (facingVec.getX() * positionalVec.getX() >= 0 && - facingVec.getY() * positionalVec.getY() >= 0 && - facingVec.getZ() * positionalVec.getZ() >= 0) { - return Textures.CLEAN_STAINLESS_STEEL_CASING; + if (sourcePart instanceof IMultiblockAbilityPart) { + MultiblockAbility ability = ((IMultiblockAbilityPart) sourcePart).getAbility(); + if (ability.equals(MultiblockAbility.MAINTENANCE_HATCH) || ability.equals(MultiblockAbility.INPUT_ENERGY)) { + return Textures.SOLID_STEEL_CASING; } - return Textures.SOLID_STEEL_CASING; } + // for IO Buses and other unrecognized parts return Textures.CLEAN_STAINLESS_STEEL_CASING; } @@ -123,7 +119,12 @@ protected static IBlockState getGearBoxState() { return MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX); } - @Nonnull + @Override + public boolean allowsExtendedFacing() { + return false; + } + + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return SusyTextures.MILLING_OVERLAY; diff --git a/src/main/resources/assets/susy/lang/en_us.lang b/src/main/resources/assets/susy/lang/en_us.lang index a011debf8..1724e37ab 100644 --- a/src/main/resources/assets/susy/lang/en_us.lang +++ b/src/main/resources/assets/susy/lang/en_us.lang @@ -307,8 +307,13 @@ gregtech.machine.single_column_cryogenic_distillation_plant.name=Single Column C gregtech.machine.reverberatory_furnace.name=Reverberatory Furnace gregtech.machine.blender.name=Blender gregtech.machine.sieve_distillation_tower.name=Sieve Distillation Tower + gregtech.machine.curtain_coater.name=Curtain Coater +gregtech.multiblock.pattern.error.conveyor=§cAll conveyor belts must be the same§r + gregtech.machine.milling.name=Precise Milling Machine +gregtech.multiblock.pattern.error.milling.upper=§cOnly allowed on the upper part of the machine§r +gregtech.multiblock.pattern.error.milling.lower=§cOnly allowed on the lower part of the machine§r gregtech.machine.drone_pad.name=Drone Pad gregtech.machine.primitive_smelter.name=Primitive Smelter From 4be0194cc2b342927222c350c20ee43bdece05e1 Mon Sep 17 00:00:00 2001 From: LittleCube Date: Thu, 27 Feb 2025 15:44:53 +0800 Subject: [PATCH 06/12] clean up --- src/main/java/supersymmetry/common/blocks/BlockConveyor.java | 2 -- .../multi/electric/MetaTileEntityCurtainCoater.java | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java index e01b367ce..70ace6cfd 100644 --- a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java +++ b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java @@ -1,7 +1,5 @@ package supersymmetry.common.blocks; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; import supersymmetry.api.blocks.VariantHorizontalRotatableBlock; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java index eedca0ce6..25d673e00 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -113,10 +113,6 @@ protected IBlockState getGearBoxState() { return MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX); } - protected IBlockState getConveyorState(BlockConveyor.ConveyorType type, EnumFacing facing) { - return SuSyBlocks.CONVEYOR_BELT.getState(type, facing); - } - @Override public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) { return Textures.CLEAN_STAINLESS_STEEL_CASING; From 0f4f9a5583319572bb9697f28e614f4f5c03e9f4 Mon Sep 17 00:00:00 2001 From: LittleCube Date: Sat, 1 Mar 2025 01:00:27 +0800 Subject: [PATCH 07/12] feature: auto conveyor direction correction --- .../multiblock/SuSyPredicates.java | 44 ++++++++++--------- .../electric/MetaTileEntityCurtainCoater.java | 31 ++++++++----- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java index 3c3953d7f..3b9cfdebf 100644 --- a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java +++ b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java @@ -6,6 +6,7 @@ import gregtech.api.util.BlockInfo; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.Loader; import org.jetbrains.annotations.NotNull; import supersymmetry.SuSyValues; @@ -16,7 +17,9 @@ import java.util.Arrays; import java.util.LinkedList; +import java.util.Map; import java.util.function.Supplier; +import java.util.stream.Collectors; /** * Class containing global predicates @@ -70,25 +73,26 @@ public class SuSyPredicates { }); // Allow all conveyor belts, and require them to have the same type. - private static final Supplier CONVEYOR_BELT = - () -> new TraceabilityPredicate(blockWorldState -> { - IBlockState state = blockWorldState.getBlockState(); - if (state.getBlock() instanceof BlockConveyor) { - BlockConveyor.ConveyorType type = ((BlockConveyor) state.getBlock()).getState(state); - Object currentConveyor = blockWorldState.getMatchContext().getOrPut("CoilType", type); - if (!currentConveyor.equals(type)) { - blockWorldState.setError(new PatternStringError("gregtech.multiblock.pattern.error.conveyor")); + private static final Map> CONVEYOR_BELT = + Arrays.stream(EnumFacing.values()).collect(Collectors.toMap(facing -> facing, + facing -> () -> new TraceabilityPredicate(blockWorldState -> { + IBlockState state = blockWorldState.getBlockState(); + if (state.getBlock() instanceof BlockConveyor) { + BlockConveyor.ConveyorType type = ((BlockConveyor) state.getBlock()).getState(state); + Object currentConveyor = blockWorldState.getMatchContext().getOrPut("ConveyorType", type); + if (!currentConveyor.equals(type)) { + blockWorldState.setError(new PatternStringError("gregtech.multiblock.pattern.error.conveyor")); + return false; + } + // Adds the position of the conveyor to the match context + blockWorldState.getMatchContext().getOrPut("ConveyorBelt", new LinkedList<>()).add(blockWorldState.getPos()); + return true; + } return false; - } - // Adds the position of the conveyor to the match context - blockWorldState.getMatchContext().getOrPut("ConveyorBelt", new LinkedList<>()).add(blockWorldState.getPos()); - return true; - } - return false; - }, () -> Arrays.stream(BlockConveyor.ConveyorType.values()) - .map(entry -> new BlockInfo(SuSyBlocks.CONVEYOR_BELT.getState(entry), null)) - .toArray(BlockInfo[]::new) - ).addTooltips("gregtech.multiblock.pattern.error.conveyor"); + }, () -> Arrays.stream(BlockConveyor.ConveyorType.values()) + .map(entry -> new BlockInfo(SuSyBlocks.CONVEYOR_BELT.getState(entry), null)) + .toArray(BlockInfo[]::new) + ).addTooltips("gregtech.multiblock.pattern.error.conveyor"))); @NotNull public static TraceabilityPredicate coolingCoils() { @@ -106,7 +110,7 @@ public static TraceabilityPredicate rails() { } @NotNull - public static TraceabilityPredicate conveyorBelts() { - return CONVEYOR_BELT.get(); + public static TraceabilityPredicate conveyorBelts(EnumFacing facing) { + return CONVEYOR_BELT.get(facing).get(); } } diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java index 25d673e00..30df96e1c 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -31,6 +31,8 @@ public class MetaTileEntityCurtainCoater extends RecipeMapMultiblockController { + private final List conveyorBlocks = new ArrayList<>(); + public MetaTileEntityCurtainCoater(ResourceLocation metaTileEntityId) { super(metaTileEntityId, SuSyRecipeMaps.CURTAIN_COATER); } @@ -53,7 +55,7 @@ protected BlockPattern createStructurePattern() { .or(autoAbilities(true, true, false, false, false, false, false))) .where('G', states(getGearBoxState())) .where('F', abilities(MultiblockAbility.IMPORT_FLUIDS)) - .where('B', conveyorBelts()) + .where('B', conveyorBelts(getFrontFacing().rotateYCCW())) .where(' ', any()) .build(); } @@ -90,21 +92,30 @@ public List getMatchingShapes() { protected void formStructure(PatternMatchContext context) { super.formStructure(context); + conveyorBlocks.addAll(context.getOrDefault("ConveyorBelt", new LinkedList<>())); + } + + public void invalidateStructure() { + super.invalidateStructure(); + this.conveyorBlocks.clear(); + } + + protected void updateFormedValid() { + super.updateFormedValid(); + // RelativeDirection will take into account of the multi flipping pattern EnumFacing conveyorFacing = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - - List conveyorBlocks = context.getOrDefault("ConveyorBelt", new LinkedList<>()); - if (conveyorBlocks != null && !conveyorBlocks.isEmpty()) { - World world = getWorld(); - for (BlockPos blockPos : conveyorBlocks) { - Block conveyor = world.getBlockState(blockPos).getBlock(); - if (conveyor instanceof BlockConveyor) { - world.setBlockState(blockPos, world.getBlockState(blockPos).withProperty(BlockConveyor.FACING, conveyorFacing)); - } + World world = getWorld(); + for (BlockPos blockPos : conveyorBlocks) { + IBlockState blockState = world.getBlockState(blockPos); + Block conveyor = blockState.getBlock(); + if (conveyor instanceof BlockConveyor && blockState.getValue(BlockConveyor.FACING) != conveyorFacing) { + world.setBlockState(blockPos, blockState.withProperty(BlockConveyor.FACING, conveyorFacing)); } } } + protected IBlockState getCasingState() { return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STAINLESS_CLEAN); } From 5c417357656b0c03fc01fc582a9589ea27fc0935 Mon Sep 17 00:00:00 2001 From: LittleCube Date: Sat, 1 Mar 2025 02:39:35 +0800 Subject: [PATCH 08/12] fix: disable grid overlay on conveyor belt --- .../multiblock/SuSyPredicates.java | 16 +++++---- .../common/blocks/BlockConveyor.java | 34 +++++++++++++++++++ .../electric/MetaTileEntityCurtainCoater.java | 13 ++++--- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java index 3b9cfdebf..7a28de1c2 100644 --- a/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java +++ b/src/main/java/supersymmetry/api/metatileentity/multiblock/SuSyPredicates.java @@ -4,10 +4,11 @@ import gregtech.api.pattern.PatternStringError; import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.util.BlockInfo; +import gregtech.api.util.RelativeDirection; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.Loader; +import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; import supersymmetry.SuSyValues; import supersymmetry.common.blocks.BlockConveyor; @@ -73,19 +74,22 @@ public class SuSyPredicates { }); // Allow all conveyor belts, and require them to have the same type. - private static final Map> CONVEYOR_BELT = - Arrays.stream(EnumFacing.values()).collect(Collectors.toMap(facing -> facing, + // This will create a list of Pair allowing the multiblock to reorient the facing. + private static final Map> CONVEYOR_BELT = + Arrays.stream(RelativeDirection.values()).collect(Collectors.toMap(facing -> facing, facing -> () -> new TraceabilityPredicate(blockWorldState -> { IBlockState state = blockWorldState.getBlockState(); if (state.getBlock() instanceof BlockConveyor) { + // Check conveyor type BlockConveyor.ConveyorType type = ((BlockConveyor) state.getBlock()).getState(state); Object currentConveyor = blockWorldState.getMatchContext().getOrPut("ConveyorType", type); if (!currentConveyor.equals(type)) { blockWorldState.setError(new PatternStringError("gregtech.multiblock.pattern.error.conveyor")); return false; } - // Adds the position of the conveyor to the match context - blockWorldState.getMatchContext().getOrPut("ConveyorBelt", new LinkedList<>()).add(blockWorldState.getPos()); + // Adds the position of the conveyor (and target facing) to the match context + blockWorldState.getMatchContext().getOrPut("ConveyorBelt", new LinkedList<>()) + .add(Pair.of(blockWorldState.getPos(), facing)); return true; } return false; @@ -110,7 +114,7 @@ public static TraceabilityPredicate rails() { } @NotNull - public static TraceabilityPredicate conveyorBelts(EnumFacing facing) { + public static TraceabilityPredicate conveyorBelts(RelativeDirection facing) { return CONVEYOR_BELT.get(facing).get(); } } diff --git a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java index 70ace6cfd..e9f7567c6 100644 --- a/src/main/java/supersymmetry/common/blocks/BlockConveyor.java +++ b/src/main/java/supersymmetry/common/blocks/BlockConveyor.java @@ -1,5 +1,12 @@ package supersymmetry.common.blocks; +import gregtech.api.cover.CoverRayTracer; +import gregtech.common.items.tool.rotation.CustomBlockRotations; +import gregtech.common.items.tool.rotation.ICustomRotationBehavior; +import net.minecraft.block.BlockHorizontal; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; import supersymmetry.api.blocks.VariantHorizontalRotatableBlock; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; @@ -16,8 +23,35 @@ public class BlockConveyor extends VariantHorizontalRotatableBlock conveyorBlocks = new ArrayList<>(); + private final List> conveyorBlocks = new ArrayList<>(); public MetaTileEntityCurtainCoater(ResourceLocation metaTileEntityId) { super(metaTileEntityId, SuSyRecipeMaps.CURTAIN_COATER); @@ -55,7 +56,7 @@ protected BlockPattern createStructurePattern() { .or(autoAbilities(true, true, false, false, false, false, false))) .where('G', states(getGearBoxState())) .where('F', abilities(MultiblockAbility.IMPORT_FLUIDS)) - .where('B', conveyorBelts(getFrontFacing().rotateYCCW())) + .where('B', conveyorBelts(RelativeDirection.LEFT)) .where(' ', any()) .build(); } @@ -103,10 +104,12 @@ public void invalidateStructure() { protected void updateFormedValid() { super.updateFormedValid(); - // RelativeDirection will take into account of the multi flipping pattern - EnumFacing conveyorFacing = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); World world = getWorld(); - for (BlockPos blockPos : conveyorBlocks) { + for (Pair posDirPair : conveyorBlocks) { + // RelativeDirection will take into account of the multi flipping pattern + EnumFacing conveyorFacing = posDirPair.getRight().getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + + BlockPos blockPos = posDirPair.getLeft(); IBlockState blockState = world.getBlockState(blockPos); Block conveyor = blockState.getBlock(); if (conveyor instanceof BlockConveyor && blockState.getValue(BlockConveyor.FACING) != conveyorFacing) { From 59139f00cbe307de2c4074f2cbfe4050c08dc7cb Mon Sep 17 00:00:00 2001 From: LittleCube Date: Sat, 1 Mar 2025 02:43:17 +0800 Subject: [PATCH 09/12] fix: make conveyor belt texture connected on top/bottom --- .../blocks/casings/conveyor_belt/lv/front.png | Bin 500 -> 212 bytes .../blocks/casings/conveyor_belt/lv/top.png | Bin 758 -> 778 bytes .../susy/models/block/conveyor_belt/lv.json | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png b/src/main/resources/assets/gregtech/textures/blocks/casings/conveyor_belt/lv/front.png index dbb062ebc187f2ec6363c30e3f26c63014f77e9d..cf7e54f0df6e39b7016157ea983472bf5acdaaeb 100644 GIT binary patch delta 197 zcmV;$06PEl1JnVK7k>~41^@s6AM^iV00001b5ch_0Itp)=>Px#j!8s8R5*?8jyOt`>}rA*CTriSzaTx8M=wyA+P8v<9Hknm*IzR$TloC@CF-QskUL zDGvJ$0M=TZbJTT>h!8@+dymNbi^7?hm>75gHj_HQQqUxn00000NkvXXu0mjfo#s>w delta 487 zcmVPx$u1Q2eR9J=Wmpw=v zK^TUg-CN{1uDOc}fk3MJ5p0q|#L`AmTob`YLW&fEO^A(%mA1)667WDR#6kk8m2`qZ zBnU}!jTc+Fm}FTk?r$gTOp0~SIXGnt%XymJ`M!O>*=8Pgt$%zjrwYX)wbN6U-ft1n zZ2Rc=;$QcEW91D|#zD%kDkXLI>ec}rU)(ITjAJJf0N9BH=f6E|$KC-tdd9)BP)dPi zakRSzKq{3YlgW@wCJ{o=Y&K~$8VGUy7Fxz&Foamed|u@W1>d~{&)%d_*xF>piuwQu$z}NP2-|vHG z58eUr{B^y*4_dxpG<`_R7kqN(dj?ED{J==+m>=Fmk6;gM{cKmNFFA3?8BHHj8Y*+) zdR(|3rJ*uUv&VePx%#7RU!R7i>KmQP3& zQ5?s=@6FqsHV>_c7^Eg8N+J;+BI;6y zpiY5eB0^rIQja3KtK-^X*PTB*Z#qo-l-=1k7Y_x_X;?mQ;eW&XefGDcwx;G(B(k`$ z@bK9f008NXf!t%5misc=9dj`T&H;e)Rqc1-0o^eFzU44R6$JoQl$As>_pLhz#3L{U zLLA2dAyaP#0R)4=P$;CTs%e_(bUKwvnWhOqV2l!?>pCUmyKwto$?zI0;SFyCtT#DS|-&+CHIbIB%wDOJ_gB_$+QrnrECr8ee&&;ehy!_D`Uz~F>a;B~>6b^4~Zc@eo^tG)uN43d?6E?RmoL>F> zy{zl?F#tT9bup$;3P7PW);k1X4Or59&PToiSkf>4s(F6Dj z%+gp-hl??8+W@$2%V$Yo43q)@rSe%47;`vx9LMo<5Evtr5<&>2a);6Gn2Y_>J;)ti zJ?_l!L4WQbFs1|o0F*#L?jSH`TNVJ@vV3MKn{~0B9zIB$zR|gn--Enqfl)E&BlE4Z zT4R0bL`%g$Tua8aWJ|@s*|O=G^@id3+ul7)0ex-d&Cyvixn^^_vC?fi1B?{yp;*(h z9z2`&>7lUcJ?)|CKu@ju#dY|!(e2-Zr-M%qg?JA8J?!2O#T;b&!PCKKKNLFb#eR_Q z=_?Ob^LvmtEiftuUEZ{J50a)mddN8p4JQnQ0N`f=My2)cX+MC=_x1c9|i delta 747 zcmVPx%ut`KgR9J=W)=x+j zVHn5p-}BD9?6i4k{a0Gi$=WS128nbC>LMM4sE8uMz=P4DSP>*TDPadQDM=EE@DM?l zx^)X&Ohm|wMCwswU2R-D?7FivJMVOue3jkVcP|}Ec22|coqvUgc|N>DC!3m1MIuX! zi;td9005B5=CE_+EZe&o?~i#IhY$cDM8f!0{D7IW{@m?koM{>WrfI9|shxk_eL!9^ z;~;Wf7ev$VMgW9Dp>Q~?>$+uGnM@{~PFt1*KxUi~nWo8zK8+j!5YIj?nBj8GGXU3P zNiX9>WSS-sZGY#i=Blafob}$gFCVzp@FE(TnNOXUnby$Q7z_sOe184#y}ASIEr-4y z#7cZ6lHShVIx%*xc6N57_4W780lKaeu=hQ@G;RX`QgV8kaUq1R>p}?idypB2>k<)Mw`Xuv zu}c#JJzmCz;{XtjquwQ%aWDn|jH!1?X51CRbzQgI3^L=y7!eU;>KVrSV_x=8dr;5t z=1Fg%2Y>YpGUHkx06+@_)HBG8JGKqLvF$Rul+SzFu7{6G(>Hs67J5*dmKl?aKDN*~ zXS6j}O?A`_Cyi9nNOjZ=pRJym-DrKaaL3=nG%(av+ukx~rPdtbwAFj2v%pwM52Z}2 zJouU}eIv;#zD04m(&+s?S2W0g*ef43Y(1Y5v%$QtswP}A33ezP$ zlrpXI;A^^!hhoze5BtZ%e)wKeo4)eEEcBo@Ei)z;U2WRmgTi!452Z}2JouU} Date: Sat, 1 Mar 2025 03:22:30 +0800 Subject: [PATCH 10/12] fix: milling machine was able to form without any hatches --- .../MetaTileEntityPreciseMillingMachine.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java index 9059164e4..35bcea761 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityPreciseMillingMachine.java @@ -49,12 +49,20 @@ protected BlockPattern createStructurePattern() { .aisle("BBBBBB", "CWWWWS", "CWWWWC", "CCCCCC") .where('S', selfPredicate()) .where('B', states(getBaseCasingState()).setMinGlobalLimited(18) - .or(abilities(MultiblockAbility.INPUT_ENERGY).addTooltip("gregtech.multiblock.pattern.error.milling.lower")) - .or(abilities(MultiblockAbility.MAINTENANCE_HATCH).addTooltip("gregtech.multiblock.pattern.error.milling.lower")) + .or(abilities(MultiblockAbility.INPUT_ENERGY) + .setMinGlobalLimited(1).setMaxGlobalLimited(3) + .addTooltip("gregtech.multiblock.pattern.error.milling.lower")) + .or(abilities(MultiblockAbility.MAINTENANCE_HATCH) + .setExactLimit(1) + .addTooltip("gregtech.multiblock.pattern.error.milling.lower")) ) .where('C', states(getUpperCasingState()).setMinGlobalLimited(35) - .or(abilities(MultiblockAbility.IMPORT_ITEMS).addTooltip("gregtech.multiblock.pattern.error.milling.upper")) - .or(abilities(MultiblockAbility.EXPORT_ITEMS).addTooltip("gregtech.multiblock.pattern.error.milling.upper")) + .or(abilities(MultiblockAbility.IMPORT_ITEMS) + .setMinGlobalLimited(1) + .addTooltip("gregtech.multiblock.pattern.error.milling.upper")) + .or(abilities(MultiblockAbility.EXPORT_ITEMS) + .setMinGlobalLimited(1) + .addTooltip("gregtech.multiblock.pattern.error.milling.upper")) ) .where('D', states(getDrillBitState())) .where('G', states(getGearBoxState())) From 0088687541cc62f6d92a71dca8100243ac2854ff Mon Sep 17 00:00:00 2001 From: LittleCube Date: Mon, 3 Mar 2025 01:08:39 +0800 Subject: [PATCH 11/12] feature: change the curtain coating multiblock shape so they can no longer wall share conveyors --- .../electric/MetaTileEntityCurtainCoater.java | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java index 62bf5e1b5..4835312ac 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -1,5 +1,6 @@ package supersymmetry.common.metatileentities.multi.electric; + import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -46,17 +47,18 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEnti @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() - .aisle(" X ", " X ", " X ") - .aisle("IXXXO", "BBBBB", " X ") - .aisle(" S ", " F ", " G ") + .aisle("CCCCC", "CWGWC", " G ") + .aisle("CCCCC", "I>>>O", "CCGCC") + .aisle("CCSCC", "CWHWC", " G ") .where('S', selfPredicate()) .where('I', abilities(MultiblockAbility.IMPORT_ITEMS)) .where('O', abilities(MultiblockAbility.EXPORT_ITEMS)) - .where('X', states(getCasingState()).setMinGlobalLimited(4) + .where('H', abilities(MultiblockAbility.IMPORT_FLUIDS)) + .where('C', states(getCasingState()).setMinGlobalLimited(18) .or(autoAbilities(true, true, false, false, false, false, false))) .where('G', states(getGearBoxState())) - .where('F', abilities(MultiblockAbility.IMPORT_FLUIDS)) - .where('B', conveyorBelts(RelativeDirection.LEFT)) + .where('W', states(getGlassState())) + .where('>', conveyorBelts(RelativeDirection.LEFT)) .where(' ', any()) .build(); } @@ -66,25 +68,26 @@ public List getMatchingShapes() { ArrayList shapeInfo = new ArrayList<>(); MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() .where('S', SuSyMetaTileEntities.CURTAIN_COATER, EnumFacing.SOUTH) - .where('X', getCasingState()) + .where('C', getCasingState()) .where('I', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.LV], EnumFacing.SOUTH) .where('O', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.LV], EnumFacing.SOUTH) - .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.SOUTH) + .where('H', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LV], EnumFacing.NORTH) .where('G', getGearBoxState()) + .where('W', getGlassState()) .where('>', SuSyBlocks.CONVEYOR_BELT.getDefaultState().withProperty(BlockConveyor.FACING, EnumFacing.EAST)) .where('<', SuSyBlocks.CONVEYOR_BELT.getDefaultState().withProperty(BlockConveyor.FACING, EnumFacing.WEST)) .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.SOUTH); shapeInfo.add(baseBuilder.shallowCopy() - .aisle(" E ", " X ", " X ") - .aisle("IMXXO", ">>>>>", " X ") - .aisle(" S ", " F ", " G ") + .aisle("CCCCC", "CWGWC", " G ") + .aisle("CCCCC", "I>>>O", "CCGCC") + .aisle("CESMC", "CWHWC", " G ") .build()); shapeInfo.add(baseBuilder.shallowCopy() - .aisle(" E ", " X ", " X ") - .aisle("OMXXI", "<<<<<", " X ") - .aisle(" S ", " F ", " G ") + .aisle("CCCCC", "CWGWC", " G ") + .aisle("CCCCC", "O<< getMatchingShapes() { @Override protected void formStructure(PatternMatchContext context) { super.formStructure(context); - conveyorBlocks.addAll(context.getOrDefault("ConveyorBelt", new LinkedList<>())); } @@ -127,11 +129,15 @@ protected IBlockState getGearBoxState() { return MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX); } + protected static IBlockState getGlassState() { + return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.TEMPERED_GLASS); + } + + @Override public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) { return Textures.CLEAN_STAINLESS_STEEL_CASING; } - @Nonnull @Override protected ICubeRenderer getFrontOverlay() { From fc0810daa2a20a8835a00ad586c4f9303c23b056 Mon Sep 17 00:00:00 2001 From: littlecube8152 Date: Wed, 5 Mar 2025 01:33:01 +0800 Subject: [PATCH 12/12] fix curain coater preview cannot see I/O buses --- .../multi/electric/MetaTileEntityCurtainCoater.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java index 4835312ac..ea277dd99 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityCurtainCoater.java @@ -69,8 +69,10 @@ public List getMatchingShapes() { MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() .where('S', SuSyMetaTileEntities.CURTAIN_COATER, EnumFacing.SOUTH) .where('C', getCasingState()) - .where('I', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.LV], EnumFacing.SOUTH) - .where('O', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.LV], EnumFacing.SOUTH) + .where('I', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.LV], EnumFacing.WEST) + .where('i', MetaTileEntities.ITEM_IMPORT_BUS[GTValues.LV], EnumFacing.EAST) + .where('O', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.LV], EnumFacing.WEST) + .where('o', MetaTileEntities.ITEM_EXPORT_BUS[GTValues.LV], EnumFacing.EAST) .where('H', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LV], EnumFacing.NORTH) .where('G', getGearBoxState()) @@ -81,12 +83,12 @@ public List getMatchingShapes() { () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.SOUTH); shapeInfo.add(baseBuilder.shallowCopy() .aisle("CCCCC", "CWGWC", " G ") - .aisle("CCCCC", "I>>>O", "CCGCC") + .aisle("CCCCC", "I>>>o", "CCGCC") .aisle("CESMC", "CWHWC", " G ") .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("CCCCC", "CWGWC", " G ") - .aisle("CCCCC", "O<<