aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks
diff options
context:
space:
mode:
authorMary <33456283+FourIsTheNumber@users.noreply.github.com>2024-07-31 13:13:20 -0400
committerGitHub <noreply@github.com>2024-08-01 00:13:20 +0700
commit99b0281dcf4ba451a363f811fdc6b671a239dc71 (patch)
tree7391763433587d53031b3e86dba37aa473eb332c /src/main/java/gregtech/common/blocks
parentb4ee66356b06d0fcc75654506ed67aa57755393b (diff)
downloadGT5-Unofficial-99b0281dcf4ba451a363f811fdc6b671a239dc71.tar.gz
GT5-Unofficial-99b0281dcf4ba451a363f811fdc6b671a239dc71.tar.bz2
GT5-Unofficial-99b0281dcf4ba451a363f811fdc6b671a239dc71.zip
Laser Engraver Multi (#2771)
* Laser engraver boilerplate and structure * Made a rough, untextured laser renderer * Laser renderer is kind of functional * Laser renderer follows curve * Laser turns on/off when recipe is running * Sampsa laser * Color changing boilerplate * Registered all gt lenses * Fixed default renderer to white * NBT reading functional * Stole SE code to try and get TE working. It does not * Laser renderer finally functioning with more than 1 laser! * Moved tick count to TileLaser so lasers don't tick each other * Implemented laser source hatch * Structure update + spotless * Switched to the GT_Values tier list * Update tooltip and message player about rendering toggle * Allow fluid input/output * Attempting to give proper name to laser plate * Fixed laser plate name * New laser plate texture * New casing just dropped * Allow UMV glass to use any laser source * Switched laser to a simple line renderer instead of a model * Fixed hatch texture I missed earlier * Spotless * Controller textures * render: New laser renderer - Use GL quad rendering instead of line rendering to fix scaling - Set lightmap coords (Emit bloom glow with shaders) - Set opacity to 1.0 - Slight cleanup * Got rid of the old laser model * Tweaked some numbers on the renderer * Spotless * cleanup * I give up on rotation, I've spent too much time trying to get this to work * Got block item working I think * Fixed tooltip for laser and multicanner * Support bartworks lenses * Finishing touches * Removed unneeded assignment * Allow UXV lasers to do all recipes * Forgot to call super for nbt data... * Replace magic numbers * oops, spotless * Another magic voltage number * Rotations and mirror flips Now with spotless * fixed west/east * ok but actually fixed now, mixed up west/east with north/south * Updated laser source snapping to account for rotation being allowed * Cleanup rotation axis and remove unecessary nbt * Re-added nbt but actually load it properly now * Fix NEI displaying lots of hatches --------- Co-authored-by: LekKit <50500857+LekKit@users.noreply.github.com> Co-authored-by: BucketBrigade <apple12a1@hotmail.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/common/blocks')
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings10.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Laser.java104
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Block_Laser.java24
3 files changed, 131 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings10.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings10.java
index 8f5ee9de5b..660c709886 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings10.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings10.java
@@ -18,8 +18,10 @@ public class GT_Block_Casings10 extends GT_Block_Casings_Abstract {
public GT_Block_Casings10() {
super(GT_Item_Casings10.class, "gt.blockcasings10", GT_Material_Casings.INSTANCE, 16);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "MagTech Casing");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Laser Containment Casing");
ItemList.Casing_Electromagnetic_Separator.set(new ItemStack(this, 1, 0));
+ ItemList.Casing_Laser.set(new ItemStack(this, 1, 1));
}
@Override
@@ -32,6 +34,7 @@ public class GT_Block_Casings10 extends GT_Block_Casings_Abstract {
public IIcon getIcon(int ordinalSide, int aMeta) {
return switch (aMeta) {
case 0 -> Textures.BlockIcons.MACHINE_CASING_EMS.getIcon();
+ case 1 -> Textures.BlockIcons.MACHINE_CASING_LASER.getIcon();
default -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
};
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Laser.java b/src/main/java/gregtech/common/blocks/GT_Block_Laser.java
new file mode 100644
index 0000000000..7ec03ce781
--- /dev/null
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Laser.java
@@ -0,0 +1,104 @@
+package gregtech.common.blocks;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.tileentities.render.TileLaser;
+
+public class GT_Block_Laser extends Block implements ITileEntityProvider {
+
+ public static IIcon[] textures;
+
+ public GT_Block_Laser() {
+ super(Material.iron);
+ setBlockName("LaserPlate");
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".name", "Laser Resistant Plate");
+ GregTech_API.registerMachineBlock(this, -1);
+ GameRegistry.registerBlock(this, GT_Item_Block_Laser.class, getUnlocalizedName());
+ ItemList.Laser_Plate.set(new ItemStack(this, 1));
+ }
+
+ @Override
+ public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public String getHarvestTool(int aMeta) {
+ return "wrench";
+ }
+
+ @Override
+ public int getHarvestLevel(int aMeta) {
+ return 2;
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "gt.laserplate";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iconRegister) {
+ blockIcon = Textures.BlockIcons.LASER_PLATE.getIcon();
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ return blockIcon;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public float getBlockHardness(World world, int x, int y, int z) {
+ return 1.0f;
+ }
+
+ @Override
+ public int damageDropped(int meta) {
+ return meta;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata) {
+ return true;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileLaser();
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Block_Laser.java b/src/main/java/gregtech/common/blocks/GT_Item_Block_Laser.java
new file mode 100644
index 0000000000..db4f6ddddc
--- /dev/null
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Block_Laser.java
@@ -0,0 +1,24 @@
+package gregtech.common.blocks;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.util.GT_LanguageManager;
+
+public class GT_Item_Block_Laser extends ItemBlock {
+
+ public GT_Item_Block_Laser(Block block) {
+ super(block);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean f3_h) {
+ tooltip.add(
+ GT_LanguageManager
+ .addStringLocalization("gt.laserplatingtooltip", "Engineered to withstand extreme temperatures"));
+ }
+}