Updating master b4 tearing it apart
This commit is contained in:
@@ -0,0 +1,77 @@
|
|||||||
|
package nmd.primal.forgecraft.common.blocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.MapColor;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.forgecraft.common.init.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.common.tiles.TileFirebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by kitsu on 11/24/2016.
|
||||||
|
*/
|
||||||
|
public class FireBox extends Block{
|
||||||
|
|
||||||
|
public FireBox(Material material, MapColor mapColor, String blockName) {
|
||||||
|
super(material, mapColor);
|
||||||
|
setBlockName(this, blockName);
|
||||||
|
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FireBox(Material materialIn, String blockName) {
|
||||||
|
this(materialIn, materialIn.getMaterialMapColor(), blockName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBlockName(Block block, String blockName) {
|
||||||
|
block.setRegistryName(ModInfo.MOD_ID, blockName);
|
||||||
|
block.setUnlocalizedName(block.getRegistryName().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************** //
|
||||||
|
// Rendering
|
||||||
|
// ***************************************************************************** //
|
||||||
|
@Override
|
||||||
|
public boolean isFullCube(IBlockState state)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFullyOpaque(IBlockState state)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube(IBlockState state)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************** //
|
||||||
|
// Placement
|
||||||
|
// ***************************************************************************** //
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||||
|
{
|
||||||
|
((TileFirebox) world.getTileEntity(pos)).rotation = (byte) (((MathHelper.floor_double((double) (placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 1) % 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package nmd.primal.forgecraft.common.tiles;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by kitsu on 11/24/2016.
|
||||||
|
*/
|
||||||
|
public class ForgeCraftTile extends TileEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes.
|
||||||
|
* Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly.
|
||||||
|
*
|
||||||
|
* @param world Current world
|
||||||
|
* @param pos Tile's world position
|
||||||
|
* @param oldState The old ID of the block
|
||||||
|
* @param newState The new ID of the block (May be the same)
|
||||||
|
* @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE
|
||||||
|
*
|
||||||
|
* Override TileEntity#shouldRefresh to return oldState.getBlock() != newSate.getBlock().
|
||||||
|
* This way the TileEntity will only be recreated when the Block changes.
|
||||||
|
*
|
||||||
|
* In 1.9, override TileEntity#getDescriptionPacket to write the data that needs syncing to a compound tag
|
||||||
|
* and then create and return an SPacketUpdateTileEntity with the position and NBT.
|
||||||
|
* Override TileEntity#onDataPacket to read from the packet's NBT.
|
||||||
|
*
|
||||||
|
* In 1.9.4, override TileEntity#getUpdateTag to write the data that needs syncing to a compound tag and return it.
|
||||||
|
* Override TileEntity#getUpdatePacket to create and return an SPacketUpdateTileEntity with the position and update tag.
|
||||||
|
* Override TileEntity#onDataPacket to read from the packet's NBT.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
|
||||||
|
//{
|
||||||
|
//return isVanilla ? (oldState.getBlock() != newSate.getBlock()) : oldState != newSate;
|
||||||
|
//}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NBT
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
|
{
|
||||||
|
super.readFromNBT(nbt);
|
||||||
|
this.readNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||||
|
{
|
||||||
|
nbt = super.writeToNBT(nbt);
|
||||||
|
return this.writeNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||||
|
{
|
||||||
|
// Override in lower tile classes
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||||
|
{
|
||||||
|
// Override in lower tile classes
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package nmd.primal.forgecraft.common.tiles;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import nmd.primal.forgecraft.common.blocks.FireBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by kitsu on 11/24/2016.
|
||||||
|
*/
|
||||||
|
public class TileFirebox extends ForgeCraftTile{
|
||||||
|
private ItemStack[] iMatrix = new ItemStack[0];
|
||||||
|
private String fireboxCustomName;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user