More changes to the BlockFabric class

This commit is contained in:
ZombieHDGaming 2017-12-10 16:03:36 -05:00
parent 825dc5831e
commit fa469df71f

View file

@ -9,6 +9,7 @@ import com.zixiken.dimdoors.shared.util.RandomUtils;
import com.zixiken.dimdoors.shared.util.Location; import com.zixiken.dimdoors.shared.util.Location;
import com.zixiken.dimdoors.shared.world.limbodimension.LimboDecay; import com.zixiken.dimdoors.shared.world.limbodimension.LimboDecay;
import com.zixiken.dimdoors.shared.world.limbodimension.WorldProviderLimbo; import com.zixiken.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import lombok.Getter;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -25,6 +26,7 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.Explosion; import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -38,8 +40,26 @@ public class BlockFabric extends Block {
private static final float SUPER_HIGH_HARDNESS = 10000000000000F; private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F; private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
public enum EnumType implements IStringSerializable {
REALITY("reality", 0),
ANCIENT("ancient", 1),
ALTERED("altered", 2),
UNRAVELED("unraveled", 3),
ETERNAL("eternal", 4);
@Getter private final String name;
@Getter private final int meta;
EnumType(String name, int meta) { this.name = name; this.meta = meta; }
public String toString() {
return name;
}
}
public BlockFabric() { public BlockFabric() {
super(Material.IRON); super(Material.CLOTH);
setCreativeTab(DimDoors.dimDoorsCreativeTab); setCreativeTab(DimDoors.dimDoorsCreativeTab);
setLightLevel(1.0F); setLightLevel(1.0F);
setHardness(0.1F); setHardness(0.1F);
@ -50,6 +70,19 @@ public class BlockFabric extends Block {
setTickRandomly(true); setTickRandomly(true);
} }
/**
* Theoretically, this shouldn't be needed, but just for precautions
* this is added just incase
* @param world world the block is in
* @param pos block position
* @param face the block face
* @return fire begone!
*/
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
return false;
}
@Override @Override
public IBlockState getStateFromMeta(int meta) { public IBlockState getStateFromMeta(int meta) {
if (meta >= 0 && meta <= 4) { if (meta >= 0 && meta <= 4) {
@ -98,6 +131,15 @@ public class BlockFabric extends Block {
} }
} }
/**
* Adds sub blocks to the creative tab based on type.
* This method has been optimized to add future sub blocks
* without major code editing.
*
* @param itemIn the creative tab blocks are getting dropped into
* @param items the list that holds items that are registered to the creative
* tab
*/
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) { public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
@ -122,7 +164,7 @@ public class BlockFabric extends Block {
} }
/** /**
* replaces the block clicked with the held block, instead of placing the * Replaces the block clicked with the held block, instead of placing the
* block on top of it. Shift click to disable. * block on top of it. Shift click to disable.
* *
* @param worldIn the world that this block is in * @param worldIn the world that this block is in
@ -132,7 +174,7 @@ public class BlockFabric extends Block {
* @param hand the hand the player is using * @param hand the hand the player is using
* @param facing the side of the block that is being clicked * @param facing the side of the block that is being clicked
* @param hitX the x coordinate of the exact place the player is clicking on * @param hitX the x coordinate of the exact place the player is clicking on
* the block * the block
* @param hitY the y coordinate ... * @param hitY the y coordinate ...
* @param hitZ the z coordinate ... * @param hitZ the z coordinate ...
* @return whether or not the item in the player's hand should be used or * @return whether or not the item in the player's hand should be used or
@ -161,30 +203,6 @@ public class BlockFabric extends Block {
return false; return false;
} }
public enum EnumType implements IStringSerializable {
REALITY("reality", 0),
ANCIENT("ancient", 1),
ALTERED("altered", 2),
UNRAVELED("unraveled", 3),
ETERNAL("eternal", 4);
private final String name;
private final int meta;
EnumType(String name, int meta) { this.name = name; this.meta = meta; }
public String toString() {
return name;
}
@Override
public String getName() {
return name;
}
public int getMeta() { return meta; }
}
@Override @Override
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
IBlockState state = worldIn.getBlockState(pos); IBlockState state = worldIn.getBlockState(pos);