mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +01:00
Differentiate scheduled and general updates
This commit is contained in:
parent
4ca4631f8a
commit
e57addcbf7
@ -410,7 +410,7 @@ public class InstanceContainer extends Instance {
|
|||||||
if(currentBlock.getCustomBlockId() != toUpdate.getCustomBlockId()) { // block changed
|
if(currentBlock.getCustomBlockId() != toUpdate.getCustomBlockId()) { // block changed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentBlock.update(instance, position, getBlockData(position));
|
currentBlock.scheduledUpdate(instance, position, getBlockData(position));
|
||||||
}
|
}
|
||||||
}, new UpdateOption(time, unit));
|
}, new UpdateOption(time, unit));
|
||||||
}
|
}
|
||||||
|
@ -104,4 +104,14 @@ public abstract class CustomBlock {
|
|||||||
update(instance, thisPosition, instance.getBlockData(thisPosition));
|
update(instance, thisPosition, instance.getBlockData(thisPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a scheduled update on this block happens. By default, calls 'update'
|
||||||
|
* @param instance
|
||||||
|
* @param position
|
||||||
|
* @param blockData
|
||||||
|
*/
|
||||||
|
public void scheduledUpdate(Instance instance, BlockPosition position, Data blockData) {
|
||||||
|
update(instance, position, blockData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user