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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
package gregtech.common.blocks;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.SoundResource;
import gregtech.api.enums.Textures;
import gregtech.api.items.GTGenericBlock;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTLanguageManager;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.WorldSpawnedEventBuilder;
public class BlockReinforced extends GTGenericBlock {
public BlockReinforced(String aName) {
super(ItemStorage.class, aName, new MaterialReinforced());
for (int i = 0; i < 16; i++) {
Textures.BlockIcons.casingTexturePages[1][i + 80] = TextureFactory.of(this, i);
}
setStepSound(soundTypeStone);
setCreativeTab(GregTechAPI.TAB_GREGTECH);
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Bronzeplate Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Iridium Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Plascrete Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Tungstensteel Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Brittle Charcoal");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Powderbarrel");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Solid Super Fuel");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Magic Solid Super Fuel");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Steel Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Titanium Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Naquadah Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Neutronium Reinforced Block");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Raw Deep Dark Portal Block");
ItemList.Block_BronzePlate.set(
new ItemStack(
this.setHardness(60.0f)
.setResistance(150.0f),
1,
0));
ItemList.Block_IridiumTungstensteel.set(
new ItemStack(
this.setHardness(400.0f)
.setResistance(600.0f),
1,
1));
ItemList.Block_Plascrete.set(
new ItemStack(
this.setHardness(5.0f)
.setResistance(6.0f),
1,
2));
ItemList.Block_TungstenSteelReinforced.set(
new ItemStack(
this.setHardness(250.0f)
.setResistance(400.0f),
1,
3));
ItemList.Block_BrittleCharcoal.set(
new ItemStack(
this.setHardness(0.5f)
.setResistance(8.0f),
1,
4));
ItemList.Block_Powderbarrel.set(
new ItemStack(
this.setHardness(2.5f)
.setResistance(2.0f),
1,
5));
ItemList.Block_SSFUEL.set(
new ItemStack(
this.setHardness(2.5f)
.setResistance(2.0f),
1,
6));
ItemList.Block_MSSFUEL.set(
new ItemStack(
this.setHardness(2.5f)
.setResistance(2.0f),
1,
7));
ItemList.Block_SteelPlate.set(
new ItemStack(
this.setHardness(150.0f)
.setResistance(200.0f),
1,
8));
ItemList.Block_TitaniumPlate.set(
new ItemStack(
this.setHardness(200.0f)
.setResistance(300.0f),
1,
9));
ItemList.Block_NaquadahPlate.set(
new ItemStack(
this.setHardness(500.0f)
.setResistance(1000.0f),
1,
10));
ItemList.Block_NeutroniumPlate.set(
new ItemStack(
this.setHardness(750.0f)
.setResistance(2500.0f),
1,
11));
ItemList.Block_BedrockiumCompressed.set(
new ItemStack(
this.setHardness(1500.0f)
.setResistance(5000.0f),
1,
12));
GTModHandler.addShapelessCraftingRecipe(
new ItemStack(Items.coal, 1, 1),
new Object[] { ItemList.Block_BrittleCharcoal.get(1) });
GTModHandler.addCraftingRecipe(
ItemList.Block_Powderbarrel.get(1L),
GTModHandler.RecipeBits.REVERSIBLE,
new Object[] { "WSW", "GGG", "WGW", 'W', OrePrefixes.plate.get(Materials.Wood), 'G',
new ItemStack(Items.gunpowder, 1), 'S', new ItemStack(Items.string, 1) });
}
@Override
public String getHarvestTool(int aMeta) {
if (aMeta == 5 || aMeta == 4 || aMeta == 6 || aMeta == 7) return "axe";
if (aMeta == 2) return "wrench";
return "pickaxe";
}
@Override
public int getHarvestLevel(int aMeta) {
if (aMeta == 4 || aMeta == 5 || aMeta == 6 || aMeta == 7) return 1;
if (aMeta == 2) return 2;
if (aMeta == 9 || aMeta == 3 || aMeta == 1) return 5;
if (aMeta == 10 || aMeta == 11) return 7;
return 4;
}
@Override
public IIcon getIcon(int ordinalSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
switch (aMeta) {
case 0 -> {
return Textures.BlockIcons.BLOCK_BRONZEPREIN.getIcon();
}
case 1 -> {
return Textures.BlockIcons.BLOCK_IRREIN.getIcon();
}
case 2 -> {
return Textures.BlockIcons.BLOCK_PLASCRETE.getIcon();
}
case 3 -> {
return Textures.BlockIcons.BLOCK_TSREIN.getIcon();
}
case 4, 6, 7 -> {
return Blocks.coal_block.getIcon(0, 0);
}
case 5 -> {
return Textures.BlockIcons.COVER_WOOD_PLATE.getIcon();
}
case 8 -> {
return Textures.BlockIcons.BLOCK_STEELPREIN.getIcon();
}
case 9 -> {
return Textures.BlockIcons.BLOCK_TITANIUMPREIN.getIcon();
}
case 10 -> {
return Textures.BlockIcons.BLOCK_NAQUADAHPREIN.getIcon();
}
case 11 -> {
return Textures.BlockIcons.BLOCK_NEUTRONIUMPREIN.getIcon();
}
case 12 -> {
return Textures.BlockIcons.BLOCK_DEEP_DARK_RAW.getIcon();
}
}
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
}
@Override
public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
if (aWorld == null) {
return 0.0F;
}
if (aWorld.isAirBlock(aX, aY, aZ)) {
return 0.0F;
}
int tMeta = aWorld.getBlockMetadata(aX, aY, aZ);
if (tMeta == 0) {
return 60.0F;
}
if (tMeta == 1) {
return 400.0F;
}
if (tMeta == 2) {
return 5.0F;
}
if (tMeta == 3) {
return 250.0F;
}
if (tMeta == 4 || tMeta == 5 || tMeta == 6 || tMeta == 7) {
return 0.5F;
}
if (tMeta == 8) {
return 150.0F;
}
if (tMeta == 9) {
return 200.0F;
}
if (tMeta == 10) {
return 500.0F;
}
if (tMeta == 11) {
return 750.0F;
}
return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ);
}
@Override
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX,
double explosionY, double explosionZ) {
if (world == null) {
return 0.0F;
}
int tMeta = world.getBlockMetadata(x, y, z);
if (tMeta == 0) {
return 150.0F;
}
if (tMeta == 1) {
return 600.0F;
}
if (tMeta == 2) {
return 6.0F;
}
if (tMeta == 3) {
return 400.0F;
}
if (tMeta == 4 || tMeta == 6 || tMeta == 7) {
return 8.0F;
}
if (tMeta == 5) {
return 1.0F;
}
if (tMeta == 8) {
return 200.0F;
}
if (tMeta == 9) {
return 300.0F;
}
if (tMeta == 10) {
return 1000.0F;
}
if (tMeta == 11) {
return 2500.0F;
}
return super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ);
}
@Override
public String getUnlocalizedName() {
return this.mUnlocalizedName;
}
@Override
public String getLocalizedName() {
return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
}
@Override
public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
@Override
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return true;
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return false;
}
@Override
public int damageDropped(int metadata) {
return metadata;
}
@Override
public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
return aWorld.getBlockMetadata(aX, aY, aZ);
}
@Override
public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int aMetadata, float chance,
int aFortune) {
if (aMetadata == 4) {
this.dropBlockAsItem(aWorld, aX, aY, aZ, new ItemStack(Items.coal, XSTR_INSTANCE.nextInt(2) + 1, 1));
} else {
super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, aMetadata, chance, aFortune);
}
}
@SuppressWarnings("deprecation")
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
if (!world.isRemote && world.getBlockMetadata(x, y, z) == 5) {
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player);
world.spawnEntityInWorld(entitytntprimed);
new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder().setPitch(1f)
.setVolume(1f)
.setIdentifier(SoundResource.GAME_TNT_PRIMED)
.setEntity(entitytntprimed)
.setWorld(world)
.run();
world.setBlockToAir(x, y, z);
return false;
}
return super.removedByPlayer(world, player, x, y, z);
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
if (world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockMetadata(x, y, z) == 5) {
removedByPlayer(world, null, x, y, z);
}
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
if (world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockMetadata(x, y, z) == 5) {
removedByPlayer(world, null, x, y, z);
}
}
@Override
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
if (!world.isRemote && world.getBlockMetadata(x, y, z) == 5) {
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(
world,
x + 0.5F,
y + 0.5F,
z + 0.5F,
explosion.getExplosivePlacedBy());
entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8);
world.spawnEntityInWorld(entitytntprimed);
}
super.onBlockExploded(world, x, y, z, explosion);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int ordinalSide,
float xOffset, float yOffset, float zOffset) {
if ((player.getCurrentEquippedItem() != null) && (player.getCurrentEquippedItem()
.getItem() == Items.flint_and_steel) && world.getBlockMetadata(x, y, z) == 5) {
removedByPlayer(world, player, x, y, z);
return true;
}
return super.onBlockActivated(world, x, y, z, player, ordinalSide, xOffset, yOffset, zOffset);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister aIconRegister) {}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item aItem, CreativeTabs aCreativeTab, List<ItemStack> aList) {
for (int i = 0; i < 16; i++) {
ItemStack aStack = new ItemStack(aItem, 1, i);
if (!aStack.getDisplayName()
.contains(".name")) aList.add(aStack);
}
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return !(entity instanceof EntityWither);
}
}
|