Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/**
* @author Pabilo8 (pabilo@iiteam.net)
* @updated 08.01.2024
* @updated 11.04.2026
* @ii-approved 0.3.1
* @since 28.06.2019
*/
Expand All @@ -45,8 +45,13 @@ public class TileEntityDataInputMachine extends TileEntityMultiblockProductionSi
/**
* Will send stored packet if true, then switch back to false
*/
@SyncNBT(events = {SyncEvents.TILE_CLIENT_MESSAGE})
@SyncNBT(name = "send_packet", events = {SyncEvents.TILE_CLIENT_MESSAGE})
public boolean sendPacket = false;

/**
* A temporary value for calculating the falling & rising edge.
*/
boolean prevSignal = false;
/**
* Stored data packet
*/
Expand Down Expand Up @@ -98,14 +103,16 @@ protected void onUpdate()
if(world.isRemote)
return;

//Send packet on redstone
if(sendPacket^getRedstoneAtPos(0))
//Send packet on rising edge redstone signal or ui button press
boolean currentSignal = getRedstoneAtPos(0);
if(sendPacket || ((prevSignal ^ currentSignal) & currentSignal))
{
sendPacket = !sendPacket;
//Finally!
if(sendPacket)
this.sendData(storedData, getDirection("data"), getPOI(MultiblockPOI.DATA_OUTPUT)[0]);
this.sendData(storedData, getDirection("data"), getPOI(MultiblockPOI.DATA_OUTPUT)[0]);
sendPacket = false;
}

prevSignal = currentSignal;

//Check for item being taken out
if(currentProcess!=null&&!currentProcess.recipe.input.matchesItemStack(inventory.get(MultiblockDataInputMachine.SLOT_INPUT)))
this.currentProcess.ticks = this.currentProcess.maxTicks;
Expand Down