From 5b23b1a11a0b1249f3b853c346597243f93fbe6a Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:58:14 -0400 Subject: Laser Engraver fixes (#3024) * Better renderer adder, fixes plate not appearing in NEI preview * Lower minimum casing * New casing texture --------- Co-authored-by: Martin Robertz --- .../java/gregtech/api/util/LaserRenderingUtil.java | 102 --------------------- .../machines/multi/MTEIndustrialLaserEngraver.java | 41 ++++----- .../blocks/iconsets/MACHINE_CASING_EMS.png | Bin 426 -> 800 bytes .../blocks/iconsets/MACHINE_CASING_LASER.png | Bin 373 -> 671 bytes 4 files changed, 18 insertions(+), 125 deletions(-) delete mode 100644 src/main/java/gregtech/api/util/LaserRenderingUtil.java (limited to 'src/main') diff --git a/src/main/java/gregtech/api/util/LaserRenderingUtil.java b/src/main/java/gregtech/api/util/LaserRenderingUtil.java deleted file mode 100644 index e42d23bc85..0000000000 --- a/src/main/java/gregtech/api/util/LaserRenderingUtil.java +++ /dev/null @@ -1,102 +0,0 @@ -package gregtech.api.util; - -import java.util.function.Consumer; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; - -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.structure.ICustomBlockSetting; -import com.gtnewhorizon.structurelib.structure.IItemSource; -import com.gtnewhorizon.structurelib.structure.IStructureElement; -import com.gtnewhorizon.structurelib.structure.StructureUtility; - -public class LaserRenderingUtil { - // This code is shamelessly ripped from GTNH-Intergalactic - - public interface IBlockAdder { - - /** - * Callback on block added, needs to check if block is valid (and add it) - * - * @param block block attempted to add - * @param meta meta of block attempted to add - * @param world World of the block - * @param x X coordinate of the block - * @param y Y coordinate of the block - * @param z Z coordinate of the block - * @return is structure still valid - */ - boolean apply(T t, Block block, int meta, World world, int x, int y, int z); - } - - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, - int defaultMeta) { - if (iBlockAdder == null || defaultBlock == null) { - throw new IllegalArgumentException(); - } - if (defaultBlock instanceof ICustomBlockSetting) { - return new IStructureElement() { - - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z), world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - - @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, - IItemSource s, EntityPlayerMP actor, Consumer chatter) { - if (check(t, world, x, y, z)) return PlaceResult.SKIP; - return StructureUtility - .survivalPlaceBlock(defaultBlock, defaultMeta, world, x, y, z, s, actor, chatter); - } - }; - } else { - return new IStructureElement() { - - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder - .apply(t, worldBlock, ((Block) worldBlock).getDamageValue(world, x, y, z), world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - - @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, - IItemSource s, EntityPlayerMP actor, Consumer chatter) { - if (check(t, world, x, y, z)) return IStructureElement.PlaceResult.SKIP; - return StructureUtility - .survivalPlaceBlock(defaultBlock, defaultMeta, world, x, y, z, s, actor, chatter); - } - }; - } - } -} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java index e79244f881..1516695a88 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java @@ -16,7 +16,6 @@ import java.util.Map; import javax.annotation.Nonnull; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -55,7 +54,6 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; -import gregtech.api.util.LaserRenderingUtil; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.common.blocks.BlockCasings10; import gregtech.common.tileentities.render.TileEntityLaser; @@ -88,10 +86,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase te.glassTier = t, te -> te.glassTier)) - .addElement( - 'r', - LaserRenderingUtil - .ofBlockAdder(MTEIndustrialLaserEngraver::laserRendererAdder, GregTechAPI.sLaserRender, 0)) + .addElement('r', ofBlock(GregTechAPI.sLaserRender, 0)) .addElement( 's', buildHatchAdder(MTEIndustrialLaserEngraver.class).adder(MTEIndustrialLaserEngraver::addLaserSource) @@ -136,19 +131,6 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase glassTier) return false; return true; diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_EMS.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_EMS.png index ab7bce0f92..92d02bbdcd 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_EMS.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_EMS.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_LASER.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_LASER.png index a678849976..a18bf1dab8 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_LASER.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_LASER.png differ -- cgit