-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathGTFOGlassCasing.java
More file actions
90 lines (73 loc) · 2.6 KB
/
GTFOGlassCasing.java
File metadata and controls
90 lines (73 loc) · 2.6 KB
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
package gregtechfoodoption.block;
import gregtech.api.block.VariantActiveBlock;
import gregtechfoodoption.GTFOValues;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
public class GTFOGlassCasing extends VariantActiveBlock<GTFOGlassCasing.CasingType> {
public GTFOGlassCasing() {
super(Material.GLASS);
setTranslationKey("transparent_casing");
setHardness(5.0F);
setResistance(5.0F);
setSoundType(SoundType.GLASS);
setHarvestLevel("pickaxe", 1);
setCreativeTab(GTFOValues.TAB_GTFO_BLOCKS);
setDefaultState(getState(CasingType.GREENHOUSE_GLASS));
}
@Override
public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) {
return false;
}
@Override
@Nonnull
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
IBlockState sideState = world.getBlockState(pos.offset(side));
return sideState.getBlock() == this ?
getState(sideState) != getState(state) :
super.shouldSideBeRendered(state, world, pos, side);
}
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
return BlockRenderLayer.TRANSLUCENT == layer;
}
public enum CasingType implements IStringSerializable {
GREENHOUSE_GLASS("greenhouse_glass");
private final String name;
CasingType(String name) {
this.name = name;
}
@Override
@Nonnull
public String getName() {
return this.name;
}
}
}