Skip to content

Commit 315ca34

Browse files
committedJul 14, 2016
Breaking speaker stops sound at that point.
1 parent 3f0e28b commit 315ca34

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎src/main/java/pcl/OpenFM/TileEntity/TileEntityRadio.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public class TileEntityRadio extends TileEntity implements SimpleComponent, Mana
7878
public boolean isLocked;
7979
public String owner = "";
8080
public ItemStack[] RadioItemStack = new ItemStack[1];
81+
82+
int th = 0;
83+
int loops = 0;
84+
8185
public TileEntityRadio(World w) {
8286
world = w;
8387
if (isPlaying) {
@@ -185,14 +189,13 @@ public void invalidate() {
185189
public void update() {
186190
Side side = FMLCommonHandler.instance().getEffectiveSide();
187191
float vol;
188-
int th = 0;
189-
int loops = 0;
192+
190193
if (side == Side.CLIENT) {
191194
th += 1;
192195
if (th >= 10) {
193196
for (Speaker s : speakers) {
194197
IBlockState sb = getWorld().getBlockState(new BlockPos(s.x, s.y, s.z));
195-
if (!(sb instanceof BlockSpeaker)) {
198+
if (!(sb.getBlock() instanceof BlockSpeaker)) {
196199
if (!getWorld().getChunkFromBlockCoords(new BlockPos(s.x, s.y, s.z)).isLoaded()) {
197200
break;
198201
}
@@ -240,7 +243,7 @@ public void update() {
240243
th += 1;
241244
if (th >= 60) {
242245
for (Speaker s : speakers) {
243-
if (!(worldObj.getBlockState(new BlockPos(s.x, s.y, s.z)) instanceof BlockSpeaker)) {
246+
if (!(worldObj.getBlockState(new BlockPos(s.x, s.y, s.z)).getBlock() instanceof BlockSpeaker)) {
244247
if (!worldObj.getChunkFromBlockCoords(new BlockPos(s.x, s.y, s.z)).isLoaded()) {
245248
break;
246249
}

0 commit comments

Comments
 (0)
Please sign in to comment.