base mod created
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
package net.minecraft.block;
|
||||
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityEndGateway;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockEndGateway extends BlockContainer
|
||||
{
|
||||
protected BlockEndGateway(Material p_i46687_1_)
|
||||
{
|
||||
super(p_i46687_1_);
|
||||
this.setLightLevel(1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityEndGateway();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
|
||||
Block block = iblockstate.getBlock();
|
||||
return !iblockstate.isOpaqueCube() && block != Blocks.END_GATEWAY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityEndGateway)
|
||||
{
|
||||
int i = ((TileEntityEndGateway)tileentity).getParticleAmount();
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
double d0 = (double)((float)pos.getX() + rand.nextFloat());
|
||||
double d1 = (double)((float)pos.getY() + rand.nextFloat());
|
||||
double d2 = (double)((float)pos.getZ() + rand.nextFloat());
|
||||
double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
|
||||
int k = rand.nextInt(2) * 2 - 1;
|
||||
|
||||
if (rand.nextBoolean())
|
||||
{
|
||||
d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k;
|
||||
d5 = (double)(rand.nextFloat() * 2.0F * (float)k);
|
||||
}
|
||||
else
|
||||
{
|
||||
d0 = (double)pos.getX() + 0.5D + 0.25D * (double)k;
|
||||
d3 = (double)(rand.nextFloat() * 2.0F * (float)k);
|
||||
}
|
||||
|
||||
worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MapColor for this Block and the given BlockState
|
||||
*/
|
||||
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return MapColor.BLACK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the geometry of the queried face at the given position and state. This is used to decide whether things like
|
||||
* buttons are allowed to be placed on the face, or how glass panes connect to the face, among other things.
|
||||
* <p>
|
||||
* Common values are {@code SOLID}, which is the default, and {@code UNDEFINED}, which represents something that
|
||||
* does not fit the other descriptions and will generally cause other things not to connect to the face.
|
||||
*
|
||||
* @return an approximation of the form of the given face
|
||||
*/
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user