mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-22 10:43:13 +00:00
Merge pull request #289 from Wojbie/ComputerCraft/Speaker-pocket-computer-light
Add pocket computer light support to Speaker.
This commit is contained in:
commit
bc2b481918
@ -59,6 +59,11 @@ public class SpeakerPeripheral implements IPeripheral {
|
||||
return m_speaker.getPos();
|
||||
}
|
||||
|
||||
public synchronized boolean madeSound(long ticks)
|
||||
{
|
||||
return (m_clock - m_lastPlayTime <= ticks) ;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
@ -73,6 +74,7 @@ public class PocketSpeaker implements IPocketUpgrade
|
||||
speaker.setLocation( entity.getEntityWorld(), entity.posX, entity.posY, entity.posZ );
|
||||
}
|
||||
speaker.update();
|
||||
access.setLight( speaker.madeSound(20) ? 0x3320fc : -1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user