1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
package gregtech.common.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.util.GTLanguageManager;
public class BlockTintedIndustrialGlass extends BlockCasingsAbstract {
public BlockTintedIndustrialGlass() {
super(ItemGlass1.class, "gt.blocktintedglass", Material.glass, 4);
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Tinted Industrial Glass (White)");
GTLanguageManager
.addStringLocalization(getUnlocalizedName() + ".1.name", "Tinted Industrial Glass (Light Gray)");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Tinted Industrial Glass (Gray)");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Tinted Industrial Glass (Black)");
ItemList.GlassTintedIndustrialWhite.set(new ItemStack(this, 1, 0));
ItemList.GlassTintedIndustrialLightGray.set(new ItemStack(this, 1, 1));
ItemList.GlassTintedIndustrialGray.set(new ItemStack(this, 1, 2));
ItemList.GlassTintedIndustrialBlack.set(new ItemStack(this, 1, 3));
// Register tinted industrial glass as EV-Tier glass
OreDictionary.registerOre("blockGlassEV", this);
this.opaque = false;
}
@Override
public int getTextureIndex(int aMeta) {
// Page 16, 32-47
return (16 << 7) | (aMeta + 32);
}
@Override
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return 1;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int ordinalSide, int aMeta) {
return switch (aMeta) {
case 0 -> Textures.BlockIcons.GLASS_TINTED_INDUSTRIAL_WHITE.getIcon();
case 1 -> Textures.BlockIcons.GLASS_TINTED_INDUSTRIAL_LIGHT_GRAY.getIcon();
case 2 -> Textures.BlockIcons.GLASS_TINTED_INDUSTRIAL_GRAY.getIcon();
case 3 -> Textures.BlockIcons.GLASS_TINTED_INDUSTRIAL_BLACK.getIcon();
default -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
};
}
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
@SideOnly(Side.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
Block block = worldIn.getBlock(x, y, z);
if (worldIn.getBlockMetadata(x, y, z) != worldIn.getBlockMetadata(
x - Facing.offsetsXForSide[side],
y - Facing.offsetsYForSide[side],
z - Facing.offsetsZForSide[side])) {
return true;
}
if (block == this) {
return false;
}
return super.shouldSideBeRendered(worldIn, x, y, z, side);
}
}
|