Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ a [RedstoneChips](http://eisental.github.com/RedstoneChips) circuit library cont
- rangefinder - An ultrasonic transceiver for detecting the exact distance between the chip and anything.
- beacon - Can force map chunks to stay loaded and monitors whether chunks in a region are loaded or not.
- slotinput - Input decimal numbers by choosing an inventory slot and clicking an interface block.
- vehicleid - Track a vehicle entity id number as it passes over the chip interface blocks.
- vehicleid - Track a vehicle entity id number as it passes by the chip interface blocks.
- playerid - Track a player entity id.
- spark - Strike thunders on command.

Expand All @@ -19,10 +19,14 @@ __For much more information, see the [circuitdocs](http://eisental.github.com/Re
Installation
-------------
* Download the latest RedstoneChips bundle [RedstoneChips](http://eisental.github.com/RedstoneChips).
* Copy all jar files into the plugins folder of your craftbukkit installation.
* Copy all jar files into the plugins folder of your spigot installation.

Changelog
---------
#### SensorLibrary 0.4
- Updated for RC1.0
__playerid__: Added sign arguments for sphere and axis type detection and distance of detection
__vehicleid__: Added sign arguments for sphere and axis type detection and distance of detection
#### SensorLibrary 0.34
- __daytime__: Fixed daytime offset bug.

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml → plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: SensorLibrary
main: org.redstonechips.sensorlibrary.SensorLibrary
version: 0.34
version: 0.40
api-version: 1.15
author: eisental
description: Sensor library for RedstoneChips integrated circuits plugin.
website: eisental.github.com/RedstoneChips
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.redstonechips</groupId>
<artifactId>RedstoneChips</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SensorLibrary extends CircuitLibrary {
@Override
public Class[] getCircuitClasses() {
return new Class[] {photocell.class, pirsensor.class, rangefinder.class, daytime.class, slotinput.class,
beacon.class, spark.class, liquidlevel.class};
beacon.class, spark.class, liquidlevel.class, playerid.class, vehicleid.class};
}

@Override
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/org/redstonechips/sensorlibrary/beacon.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public void shutdown() {
SensorLibrary.eventDispatcher.unregisterListener(chunkLoadListener);
SensorLibrary.eventDispatcher.unregisterListener(chunkUnloadListener);
}
@Override
public void destroyed() {
SensorLibrary.eventDispatcher.unregisterListener(chunkLoadListener);
SensorLibrary.eventDispatcher.unregisterListener(chunkUnloadListener);
}
@Override
public void disable() {
SensorLibrary.eventDispatcher.unregisterListener(chunkLoadListener);
SensorLibrary.eventDispatcher.unregisterListener(chunkUnloadListener);
}

private final EventListener chunkLoadListener = new EventListener() {
@Override
Expand All @@ -91,7 +101,7 @@ public void onEvent(Event e) {
Chunk chunk = event.getChunk();
if (keepalive) {
if (chip.hasListeners()) debug("Chunk (" + chunk.getX() + ", " + chunk.getZ() + ") in " + chip.world.getName()+ " is kept alive.");
event.setCancelled(true);
chunk.setForceLoaded(true);
} else {
loadCount--;
sendBit();
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/org/redstonechips/sensorlibrary/liquidlevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Levelled;
import org.bukkit.block.data.BlockData;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
Expand All @@ -32,9 +33,9 @@ public class liquidlevel extends Circuit {
private static final Set<Material> liquids = new HashSet<>();
static {
liquids.add(Material.WATER);
liquids.add(Material.STATIONARY_WATER);
//liquids.add(Material.FLOWING_WATER);
liquids.add(Material.LAVA);
liquids.add(Material.STATIONARY_LAVA);
//liquids.add(Material.STATIONARY_LAVA);
}

Map<Location,Byte> sides = new HashMap<>();
Expand Down Expand Up @@ -152,13 +153,17 @@ private void updateSide(Location side) {
}

private byte findWaterLevel(Location l) {
BlockState b = l.getBlock().getState();
Block b = l.getBlock();
BlockData bd = b.getBlockData();

if (liquids.contains(b.getType())) {
byte data = b.getData().getData();
if (data>7) // falling liquid. full water block.
Levelled data = (Levelled)bd;
System.out.println("old = " + b);
//System.out.println("new = " + b.getBlockData().getLevel());
if (data.getLevel()>7) // falling liquid. full water block.
return 8;
else
return (byte)(8-b.getData().getData());
return (byte)(8-data.getLevel());
} else {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void input(boolean state, int inIdx) {
// clock pin triggered
boolean alarm = false;

for (Object o : chip.world.getEntitiesByClass(checkedEntities)) {
for (Object o : chip.world.getEntitiesByClasses(checkedEntities)) {
Entity e = (Entity)o;

Location l = e.getLocation();
Expand Down
Loading