cleanup
This commit is contained in:
parent
c22c04a6d1
commit
ca8880757d
1 changed files with 17 additions and 210 deletions
|
@ -10,217 +10,24 @@ import game.world.Facing;
|
|||
import game.world.State;
|
||||
import game.world.World;
|
||||
|
||||
public class BlockJukebox extends Block
|
||||
{
|
||||
// public static final PropertyBool HAS_RECORD = PropertyBool.create("has_record");
|
||||
|
||||
public BlockJukebox()
|
||||
{
|
||||
public class BlockJukebox extends Block {
|
||||
public BlockJukebox() {
|
||||
super(Material.wood);
|
||||
// this.setDefaultState(this.blockState.getBaseState().withProperty(HAS_RECORD, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.tabTech);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!worldIn.client) {
|
||||
// if (((Boolean)state.getValue(HAS_RECORD)).booleanValue())
|
||||
// {
|
||||
// // this.dropRecord(worldIn, pos, state);
|
||||
// state = state.withProperty(HAS_RECORD, Boolean.valueOf(false));
|
||||
// worldIn.setBlockState(pos, state, 2);
|
||||
// }
|
||||
// playerIn.triggerAchievement(StatRegistry.jukeboxClickedStat);
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) {
|
||||
if(!worldIn.client)
|
||||
worldIn.playSound(worldIn.rand.pick(SoundEvent.values()), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1.0f);
|
||||
}
|
||||
// else {
|
||||
// File dir = new File("midi");
|
||||
// if(!dir.exists())
|
||||
// dir.mkdirs();
|
||||
// if(playerIn.isSneaking()) {
|
||||
// Game.getGame().getAudioInterface().alPlayMidi(null);
|
||||
// }
|
||||
// else {
|
||||
// File[] files = dir.listFiles(new FileFilter() {
|
||||
// public boolean accept(File file) {
|
||||
// return file.isFile() && (file.getName().toLowerCase().endsWith(".mid") || file.getName().toLowerCase().endsWith(".kar") || file.getName().toLowerCase().endsWith(".midi"));
|
||||
// }
|
||||
// });
|
||||
// if(files == null || files.length == 0) {
|
||||
// Log.JNI.error("Keine MIDIs vorhanden");
|
||||
// }
|
||||
// else {
|
||||
// Game.getGame().getAudioInterface().alPlayMidi(worldIn.rand.pick(files).toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
// public void insertRecord(World worldIn, BlockPos pos, IBlockState state, ItemStack recordStack)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
//
|
||||
// if (tileentity instanceof BlockJukebox.TileEntityJukebox)
|
||||
// {
|
||||
// ((BlockJukebox.TileEntityJukebox)tileentity).setRecord(new ItemStack(recordStack.getItem(), 1, recordStack.getMetadata()));
|
||||
// worldIn.setBlockState(pos, state.withProperty(HAS_RECORD, Boolean.valueOf(true)), 2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void dropRecord(World worldIn, BlockPos pos, IBlockState state)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
//
|
||||
// if (tileentity instanceof BlockJukebox.TileEntityJukebox)
|
||||
// {
|
||||
// BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox)tileentity;
|
||||
// ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord();
|
||||
//
|
||||
// if (itemstack != null)
|
||||
// {
|
||||
// worldIn.playAuxSFX(1005, pos, 0);
|
||||
// worldIn.playRecord(pos, (String)null);
|
||||
// blockjukebox$tileentityjukebox.setRecord((ItemStack)null);
|
||||
// float f = 0.7F;
|
||||
// double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
// double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.2D + 0.6D;
|
||||
// double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
// ItemStack itemstack1 = itemstack.copy();
|
||||
// EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, itemstack1);
|
||||
// entityitem.setDefaultPickupDelay();
|
||||
// worldIn.spawnEntityInWorld(entityitem);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
// {
|
||||
// this.dropRecord(worldIn, pos, state);
|
||||
// super.breakBlock(worldIn, pos, state);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) {
|
||||
if(!worldIn.client)
|
||||
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 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 BlockJukebox.TileEntityJukebox();
|
||||
// }
|
||||
|
||||
// public boolean hasComparatorInputOverride()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public int getComparatorInputOverride(World worldIn, BlockPos pos)
|
||||
// {
|
||||
// TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
//
|
||||
// if (tileentity instanceof BlockJukebox.TileEntityJukebox)
|
||||
// {
|
||||
// ItemStack itemstack = ((BlockJukebox.TileEntityJukebox)tileentity).getRecord();
|
||||
//
|
||||
// if (itemstack != null)
|
||||
// {
|
||||
// return ItemRegistry.getIdFromItem(itemstack.getItem()) + 1 - ItemRegistry.getIdFromItem(Items.record_13);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
|
||||
// */
|
||||
// public int getRenderType()
|
||||
// {
|
||||
// return 3;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Convert the given metadata into a BlockState for this Block
|
||||
// */
|
||||
// public IBlockState getStateFromMeta(int meta)
|
||||
// {
|
||||
// return this.getDefaultState().withProperty(HAS_RECORD, Boolean.valueOf(meta > 0));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Convert the BlockState into the correct metadata value
|
||||
// */
|
||||
// public int getMetaFromState(IBlockState state)
|
||||
// {
|
||||
// return ((Boolean)state.getValue(HAS_RECORD)).booleanValue() ? 1 : 0;
|
||||
// }
|
||||
//
|
||||
// protected BlockState createBlockState()
|
||||
// {
|
||||
// return new BlockState(this, HAS_RECORD);
|
||||
// }
|
||||
|
||||
public ModelBlock getModel(String name, State state) {
|
||||
return new ModelBlock("jukebox_side").add().dnswe().u("jukebox_top");
|
||||
}
|
||||
|
||||
// public static class TileEntityJukebox extends TileEntity
|
||||
// {
|
||||
//// private ItemStack record;
|
||||
//
|
||||
//// public void readFromNBT(NBTTagCompound compound)
|
||||
//// {
|
||||
//// super.readFromNBT(compound);
|
||||
////
|
||||
//// if (compound.hasKey("RecordItem", 10))
|
||||
//// {
|
||||
//// this.setRecord(ItemStack.loadItemStackFromNBT(compound.getCompoundTag("RecordItem")));
|
||||
//// }
|
||||
//// else if (compound.getInteger("Record") > 0)
|
||||
//// {
|
||||
//// this.setRecord(new ItemStack(ItemRegistry.getItemById(compound.getInteger("Record")), 1, 0));
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// public void writeToNBT(NBTTagCompound compound)
|
||||
//// {
|
||||
//// super.writeToNBT(compound);
|
||||
////
|
||||
//// if (this.getRecord() != null)
|
||||
//// {
|
||||
//// compound.setTag("RecordItem", this.getRecord().writeToNBT(new NBTTagCompound()));
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
//// public ItemStack getRecord()
|
||||
//// {
|
||||
//// return this.record;
|
||||
//// }
|
||||
////
|
||||
//// public void setRecord(ItemStack recordStack)
|
||||
//// {
|
||||
//// this.record = recordStack;
|
||||
//// this.markDirty();
|
||||
//// }
|
||||
//
|
||||
// public int getColor() {
|
||||
// return 0xff80ff;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue