mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-12 00:50:05 +00:00
Adds pocket computer light support to Speaker
This makes use of new pocket computer light access peripherals have and adds said functionality to speaker. If noisy pocket has made sound the pocket computer light will turn dark blue for a second.
This commit is contained in:
parent
54d202cf6b
commit
225ec594e7
@ -55,6 +55,11 @@ public class SpeakerPeripheral implements IPeripheral {
|
||||
return m_speaker.getPos();
|
||||
}
|
||||
|
||||
public synchronized boolean madeSound()
|
||||
{
|
||||
return (m_clock - m_lastPlayTime <= 20) ;
|
||||
}
|
||||
|
||||
/* IPeripheral implementation */
|
||||
|
||||
@Override
|
||||
|
@ -11,6 +11,7 @@ import dan200.computercraft.api.pocket.IPocketAccess;
|
||||
import dan200.computercraft.api.pocket.IPocketUpgrade;
|
||||
import dan200.computercraft.shared.peripheral.PeripheralType;
|
||||
import dan200.computercraft.shared.peripheral.common.PeripheralItemFactory;
|
||||
import dan200.computercraft.shared.util.Colour;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -74,6 +75,7 @@ public class PocketSpeaker implements IPocketUpgrade
|
||||
speaker.setLocation( entity.getEntityWorld(), entity.posX, entity.posY, entity.posZ );
|
||||
}
|
||||
speaker.update();
|
||||
access.setLight( speaker.madeSound() ? 0x3320fc : -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user