This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
EnergonRelics/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java

37 lines
1.0 KiB
Java
Raw Normal View History

2020-07-13 20:37:21 +00:00
package com.thebrokenrail.energonrelics.block.entity;
2020-08-04 17:06:11 +00:00
import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity;
import com.thebrokenrail.energonrelics.api.energy.Action;
2020-07-13 20:37:21 +00:00
import com.thebrokenrail.energonrelics.block.SwitchBlock;
import net.minecraft.block.entity.BlockEntityType;
public class SwitchBlockEntity extends EnergyReceiverBlockEntity {
public SwitchBlockEntity(BlockEntityType<?> type) {
super(type);
}
@Override
2020-07-27 18:06:46 +00:00
protected void energyTick() {
2020-07-13 20:37:21 +00:00
}
@Override
public boolean isEnergyProvider() {
return true;
}
@Override
2020-08-03 20:36:20 +00:00
protected void handlePropagatedAction(Action.PropagatedAction action) {
super.handlePropagatedAction(action);
// Propagate Action To Energy Providers
if (isActive() && !hasSent(action)) {
propagateAction(action);
} else {
action.pay(0);
}
}
private boolean isActive() {
2020-07-13 20:37:21 +00:00
return getCachedState().get(SwitchBlock.POWERED);
}
}