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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
package gregtech.common.blocks;
import static gregtech.api.enums.Textures.BlockIcons.BASALT_STONE;
import static gregtech.api.enums.Textures.BlockIcons.GRANITE_BLACK_STONE;
import static gregtech.api.enums.Textures.BlockIcons.GRANITE_RED_STONE;
import static gregtech.api.enums.Textures.BlockIcons.MARBLE_STONE;
import java.util.Arrays;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GTMod;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.render.TextureFactory;
public class BlockOres extends BlockOresAbstract {
private static final String UNLOCALIZED_NAME = "gt.blockores";
public BlockOres() {
super(UNLOCALIZED_NAME, 7, false, Material.rock);
}
@Override
public String getUnlocalizedName() {
return UNLOCALIZED_NAME;
}
@Override
public OrePrefixes[] getProcessingPrefix() { // Must have 8 entries; an entry can be null to disable automatic
// recipes.
return new OrePrefixes[] { OrePrefixes.ore, OrePrefixes.oreNetherrack, OrePrefixes.oreEndstone,
OrePrefixes.oreBlackgranite, OrePrefixes.oreRedgranite, OrePrefixes.oreMarble, OrePrefixes.oreBasalt,
null };
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int ordinalSide, int meta) {
int index = ((meta / 1000) % 16);
return switch (index) {
case 1 -> Blocks.netherrack.getIcon(ordinalSide, 0);
case 2 -> Blocks.end_stone.getIcon(ordinalSide, 0);
case 3 -> GRANITE_BLACK_STONE.getIcon();
case 4 -> GRANITE_RED_STONE.getIcon();
case 5 -> MARBLE_STONE.getIcon();
case 6 -> BASALT_STONE.getIcon();
default -> Blocks.stone.getIcon(ordinalSide, 0);
};
}
/**
* @inheritDoc
*/
@Override
public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) {
return (side == ForgeDirection.UP && getDamageValue(world, x, y, z) / 1000 % 16 == 1);
}
/**
* @inheritDoc
*/
@Override
public MapColor getMapColor(int meta) {
return meta == 1 ? MapColor.netherrackColor : MapColor.stoneColor;
}
@Override
public int getBaseBlockHarvestLevel(int aMeta) {
return switch (aMeta) {
case 3, 4 -> 3;
default -> 0;
};
}
@Override
public Block getDroppedBlock() {
return GregTechAPI.sBlockOres1;
}
@Override
public Materials[] getDroppedDusts() { // Must have 8 entries; can be null.
return new Materials[] { Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack,
Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone };
}
@Override
public boolean[] getEnabledMetas() {
return new boolean[] { true, true, true, GTMod.gregtechproxy.enableBlackGraniteOres,
GTMod.gregtechproxy.enableRedGraniteOres, GTMod.gregtechproxy.enableMarbleOres,
GTMod.gregtechproxy.enableBasaltOres, true };
}
@Override
public ITexture[] getTextureSet() {
final ITexture[] rTextures = new ITexture[16]; // Must have 16 entries.
Arrays.fill(rTextures, TextureFactory.of(Blocks.stone));
rTextures[1] = TextureFactory.of(Blocks.netherrack);
rTextures[2] = TextureFactory.of(Blocks.end_stone);
rTextures[3] = TextureFactory.builder()
.addIcon(GRANITE_BLACK_STONE)
.stdOrient()
.build();
rTextures[4] = TextureFactory.builder()
.addIcon(GRANITE_RED_STONE)
.stdOrient()
.build();
rTextures[5] = TextureFactory.builder()
.addIcon(MARBLE_STONE)
.stdOrient()
.build();
rTextures[6] = TextureFactory.builder()
.addIcon(BASALT_STONE)
.stdOrient()
.build();
return rTextures;
}
@Override
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) {
if (EnchantmentHelper.getSilkTouchModifier(player)) {
TileEntityOres.shouldSilkTouch = true;
super.harvestBlock(worldIn, player, x, y, z, meta);
if (TileEntityOres.shouldSilkTouch) {
TileEntityOres.shouldSilkTouch = false;
}
return;
}
if (!(player instanceof FakePlayer)) {
TileEntityOres.shouldFortune = true;
}
super.harvestBlock(worldIn, player, x, y, z, meta);
if (TileEntityOres.shouldFortune) {
TileEntityOres.shouldFortune = false;
}
}
}
|