From 821a46b720657f70c31dc99e1765adb6f367f1f9 Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 31 May 2025 19:57:32 +0200 Subject: [PATCH] remove note block tes --- .../java/common/block/tech/BlockNote.java | 136 ++++-------------- .../main/java/common/init/TileRegistry.java | 2 - .../common/tileentity/TileEntityNote.java | 73 ---------- .../src/main/java/server/world/Converter.java | 5 - 4 files changed, 28 insertions(+), 188 deletions(-) delete mode 100755 common/src/main/java/common/tileentity/TileEntityNote.java diff --git a/common/src/main/java/common/block/tech/BlockNote.java b/common/src/main/java/common/block/tech/BlockNote.java index f89f2b1..f9ce07c 100755 --- a/common/src/main/java/common/block/tech/BlockNote.java +++ b/common/src/main/java/common/block/tech/BlockNote.java @@ -1,127 +1,47 @@ package common.block.tech; import common.block.Block; -import common.block.BlockContainer; import common.block.Material; import common.entity.npc.EntityNPC; +import common.init.Blocks; import common.init.SoundEvent; import common.item.CheatTab; import common.model.ParticleType; -import common.tileentity.TileEntity; -import common.tileentity.TileEntityNote; import common.util.BlockPos; import common.util.Facing; import common.world.State; import common.world.World; -public class BlockNote extends BlockContainer -{ -// private static final List INSTRUMENTS = Lists.newArrayList("harp", "bd", "snare", "hat", "bassattack"); +public class BlockNote extends Block { + public BlockNote() { + super(Material.WOOD); + this.setTab(CheatTab.TECHNOLOGY); + } - public BlockNote() - { - super(Material.WOOD); - this.setTab(CheatTab.TECHNOLOGY); - } + public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) { + if(worldIn.isBlockPowered(pos)) + worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); + } - /** - * Called when a neighboring block changes. - */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) - { - boolean flag = worldIn.isBlockPowered(pos); - TileEntity tileentity = worldIn.getTileEntity(pos); + public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + if(!worldIn.client) + worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); + return true; + } - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; + public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) { + if(!worldIn.client) + worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); + } - if (tileentitynote.previousRedstoneState != flag) - { - if (flag) - { - tileentitynote.triggerNote(worldIn, pos); - } + public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam) { + worldIn.playSound(SoundEvent.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0F); + worldIn.spawnParticle(ParticleType.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, + (double)eventParam / 24.0D, 0.0D, 0.0D); + return true; + } - tileentitynote.previousRedstoneState = flag; - } - } - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) - { - if (worldIn.client) - { - return true; - } - else - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; - tileentitynote.changePitch(); - tileentitynote.triggerNote(worldIn, pos); -// playerIn.triggerAchievement(StatRegistry.noteblockTuneStat); - } - - return true; - } - } - - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) - { - if (!worldIn.client) - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (tileentity instanceof TileEntityNote) - { - ((TileEntityNote)tileentity).triggerNote(worldIn, pos); -// playerIn.triggerAchievement(StatRegistry.noteblockPlayStat); - } - } - } - - /** - * Returns a new instance of a block's tile entity class. Called on placing the block. - */ - public TileEntity createNewTileEntity(World worldIn) - { - return new TileEntityNote(); - } - -// private String getInstrument(int id) -// { -// if (id < 0 || id >= INSTRUMENTS.size()) -// { -// id = 0; -// } -// -// return (String)INSTRUMENTS.get(id); -// } - - /** - * Called on both Client and Server when World#addBlockEvent is called - */ - public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam) - { - float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.playSound(SoundEvent.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0F); - worldIn.spawnParticle(ParticleType.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D); - return true; - } - - /** - * 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; - } - - public boolean isMagnetic() { - return true; - } + public boolean isMagnetic() { + return true; + } } diff --git a/common/src/main/java/common/init/TileRegistry.java b/common/src/main/java/common/init/TileRegistry.java index ab2b3ea..410be25 100755 --- a/common/src/main/java/common/init/TileRegistry.java +++ b/common/src/main/java/common/init/TileRegistry.java @@ -16,7 +16,6 @@ import common.tileentity.TileEntityEnchantmentTable; import common.tileentity.TileEntityFurnace; import common.tileentity.TileEntityHopper; import common.tileentity.TileEntityMobSpawner; -import common.tileentity.TileEntityNote; import common.tileentity.TileEntityPiston; import common.tileentity.TileEntitySign; import common.tileentity.TileEntitySkull; @@ -44,7 +43,6 @@ public abstract class TileRegistry { addMapping(TileEntityDropper.class, "Dropper"); addMapping(TileEntitySign.class, "Sign"); addMapping(TileEntityMobSpawner.class, "MobSpawner"); - addMapping(TileEntityNote.class, "Music"); addMapping(TileEntityPiston.class, "Piston"); addMapping(TileEntityBrewingStand.class, "Cauldron"); addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); diff --git a/common/src/main/java/common/tileentity/TileEntityNote.java b/common/src/main/java/common/tileentity/TileEntityNote.java deleted file mode 100755 index 18a8e1e..0000000 --- a/common/src/main/java/common/tileentity/TileEntityNote.java +++ /dev/null @@ -1,73 +0,0 @@ -package common.tileentity; - -import common.init.Blocks; -import common.tags.TagObject; -import common.util.BlockPos; -import common.util.ExtMath; -import common.world.World; - -public class TileEntityNote extends TileEntity -{ - /** Note to play */ - public byte note; - - /** stores the latest redstone state */ - public boolean previousRedstoneState; - - public void writeTags(TagObject compound) - { - super.writeTags(compound); - compound.setByte("note", this.note); - } - - public void readTags(TagObject compound) - { - super.readTags(compound); - this.note = compound.getByte("note"); - this.note = (byte)ExtMath.clampi(this.note, 0, 24); - } - - /** - * change pitch by -> (currentPitch + 1) % 25 - */ - public void changePitch() - { - this.note = (byte)((this.note + 1) % 25); - this.markDirty(); - } - - public void triggerNote(World worldIn, BlockPos p_175108_2_) - { - if (worldIn.getState(p_175108_2_.up()).getBlock() == Blocks.air) - { -// Material material = worldIn.getBlockState(p_175108_2_.down()).getBlock().getMaterial(); -// int i = 0; -// -// if (material == Material.rock) -// { -// i = 1; -// } -// -// if (material == Material.sand) -// { -// i = 2; -// } -// -// if (material == Material.glass) -// { -// i = 3; -// } -// -// if (material == Material.wood) -// { -// i = 4; -// } - - worldIn.addBlockEvent(p_175108_2_, Blocks.noteblock, 0, this.note); - } - } - - public int getColor() { - return 0x80ff00; - } -} diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 6f1a89d..a2eb75d 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -81,7 +81,6 @@ import common.tileentity.TileEntityEnchantmentTable; import common.tileentity.TileEntityFurnace; import common.tileentity.TileEntityHopper; import common.tileentity.TileEntityMobSpawner; -import common.tileentity.TileEntityNote; import common.tileentity.TileEntitySign; import common.tileentity.TileEntitySkull; import common.util.Facing; @@ -349,7 +348,6 @@ public abstract class Converter { mapTile(TileEntityDropper.class, "Dropper", "dropper"); mapTile(TileEntitySign.class, "Sign", "sign"); mapTile(TileEntityMobSpawner.class, "MobSpawner", "mob_spawner"); - mapTile(TileEntityNote.class, "Music", "noteblock"); // mapTile(TileEntityPiston.class, "Piston", "piston"); mapTile(TileEntityEnchantmentTable.class, "EnchantTable", "enchanting_table"); mapTile(TileEntityBeacon.class, "Beacon", "beacon"); @@ -974,9 +972,6 @@ public abstract class Converter { else if("Comparator".equals(id)) { nent.setInt("OutputSignal", ent.getInt("OutputSignal")); } - else if("Music".equals(id)) { - nent.setByte("note", ent.getByte("note")); - } else if("Skull".equals(id)) { nent.setByte("Rot", ent.getByte("Rot")); }