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
|
package gtPlusPlus.xmod.thaumcraft.common.block;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.handler.GuiHandler;
import gtPlusPlus.xmod.thaumcraft.common.ItemBlockThaumcraft;
import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastAlchemyFurnace;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.common.lib.utils.InventoryUtils;
public class BlockFastAlchemyFurnace extends BlockContainer {
public IIcon[] iconFurnace;
public IIcon[] iconPedestal;
public BlockFastAlchemyFurnace() {
super(Material.iron);
this.iconFurnace = new IIcon[5];
this.iconPedestal = new IIcon[2];
this.setCreativeTab(AddToCreativeTab.tabMachines);
this.setBlockName("blockFastAlchemyFurnace");
this.setHardness(3.0f);
this.setResistance(25.0f);
this.setStepSound(Block.soundTypeStone);
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
GameRegistry.registerBlock(this, ItemBlockThaumcraft.class, "blockFastAlchemyFurnace");
LanguageRegistry.addName(this, "Upgraded Alchemical Furnace");
}
@Override
public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) {
final Block block = world.getBlock(x, y, z);
if (block != this)
{
return block.getLightValue(world, x, y, z);
}
/**
* Gets the light value of the specified block coords. Args: x, y, z
*/
return this.getLightValue();
}
@Override
public int damageDropped(final int metadata) {
return 0;
}
@Override
public TileEntity createTileEntity(final World world, final int metadata) {
if (metadata == 0){
return new TileFastAlchemyFurnace();
}
return null;
}
@Override
public TileEntity createNewTileEntity(final World var1, final int md) {
return null;
}
@Override
public int getComparatorInputOverride(final World world, final int x, final int y, final int z, final int rs) {
final TileEntity te = world.getTileEntity(x, y, z);
if ((te != null) && (te instanceof TileFastAlchemyFurnace)) {
return Container.calcRedstoneFromInventory((IInventory) te);
}
return 0;
}
@Override
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
final int side, final float par7, final float par8, final float par9) {
if (world.isRemote) {
return true;
}
final int metadata = world.getBlockMetadata(x, y, z);
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if ((metadata == 0) && (tileEntity instanceof TileFastAlchemyFurnace) && !player.isSneaking()) {
player.openGui(GTplusplus.instance, GuiHandler.GUI8, world, x, y, z);
return true;
}
return false;
}
@Override
public void addCollisionBoxesToList(final World world, final int i, final int j, final int k,
final AxisAlignedBB axisalignedbb, final List arraylist, final Entity par7Entity) {
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
@Override
public void setBlockBoundsBasedOnState(final IBlockAccess world, final int i, final int j, final int k) {
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
super.setBlockBoundsBasedOnState(world, i, j, k);
}
@Override
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4,
final int par5, final int par6) {
/*if (par5 == 1) {
if (par1World.isRemote) {
Thaumcraft.proxy.blockSparkle(par1World, par2, par3, par4, 11960575, 2);
par1World.playAuxSFX(2001, par2, par3, par4, Block.getIdFromBlock(Blocks.stonebrick) + 0);
}
return true;
}*/
return super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
}
@Override
public boolean isSideSolid(final IBlockAccess world, final int x, final int y, final int z,
final ForgeDirection side) {
return super.isSideSolid(world, x, y, z, side);
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5,
final int par6) {
InventoryUtils.dropItems(par1World, par2, par3, par4);
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
@Override
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block par5) {
final TileEntity te = world.getTileEntity(x, y, z);
if ((te != null) && (te instanceof TileFastAlchemyFurnace)) {
((TileFastAlchemyFurnace) te).getBellows();
}
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(final World w, final int i, final int j, final int k, final Random r) {
final TileEntity te = w.getTileEntity(i, j, k);
if ((te != null) && (te instanceof TileFastAlchemyFurnace) && ((TileFastAlchemyFurnace) te).isBurning()) {
final float f = i + 0.5f;
final float f2 = j + 0.2f + ((r.nextFloat() * 5.0f) / 16.0f);
final float f3 = k + 0.5f;
final float f4 = 0.52f;
final float f5 = (r.nextFloat() * 0.5f) - 0.25f;
w.spawnParticle("smoke", f - f4, f2, f3 + f5, 0.0, 0.0, 0.0);
w.spawnParticle("flame", f - f4, f2, f3 + f5, 0.0, 0.0, 0.0);
w.spawnParticle("smoke", f + f4, f2, f3 + f5, 0.0, 0.0, 0.0);
w.spawnParticle("flame", f + f4, f2, f3 + f5, 0.0, 0.0, 0.0);
w.spawnParticle("smoke", f + f5, f2, f3 - f4, 0.0, 0.0, 0.0);
w.spawnParticle("flame", f + f5, f2, f3 - f4, 0.0, 0.0, 0.0);
w.spawnParticle("smoke", f + f5, f2, f3 + f4, 0.0, 0.0, 0.0);
w.spawnParticle("flame", f + f5, f2, f3 + f4, 0.0, 0.0, 0.0);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister ir) {
this.iconPedestal[0] = ir.registerIcon("thaumcraft:pedestal_side");
this.iconPedestal[1] = ir.registerIcon("thaumcraft:pedestal_top");
this.iconFurnace[0] = ir.registerIcon("thaumcraft:al_furnace_side");
this.iconFurnace[1] = ir.registerIcon("thaumcraft:al_furnace_top");
this.iconFurnace[2] = ir.registerIcon("thaumcraft:al_furnace_front_off");
this.iconFurnace[3] = ir.registerIcon("thaumcraft:al_furnace_front_on");
this.iconFurnace[4] = ir.registerIcon("thaumcraft:al_furnace_top_filled");
}
/*@Override
public int getRenderType() {
return ConfigBlocks.blockStoneDeviceRI;
}*/
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public IIcon getIcon(final int side, final int md) {
if (md == 0) {
if (side == 1) {
return this.iconFurnace[1];
}
if (side > 1) {
return this.iconFurnace[2];
}
} else if (md == 1) {
if (side <= 1) {
return this.iconPedestal[1];
}
if (side > 1) {
return this.iconPedestal[0];
}
}
return this.iconPedestal[1];
}
@Override
public IIcon getIcon(final IBlockAccess iblockaccess, final int i, final int j, final int k, final int side) {
final int metadata = iblockaccess.getBlockMetadata(i, j, k);
if (metadata == 0) {
final TileEntity te = iblockaccess.getTileEntity(i, j, k);
if (side == 1) {
if ((te != null) && (te instanceof TileFastAlchemyFurnace) && (((TileFastAlchemyFurnace) te).vis > 0)) {
return this.iconFurnace[4];
}
return this.iconFurnace[1];
} else if (side > 1) {
if ((te != null) && (te instanceof TileFastAlchemyFurnace) && ((TileFastAlchemyFurnace) te).isBurning()) {
return this.iconFurnace[3];
}
return this.iconFurnace[2];
}
}
return this.iconFurnace[0];
}
}
|