You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
925 B
Java

package net.brokenmoon.redcontrol.api;
import com.simon816.j65el02.device.RedBus;
import net.brokenmoon.redcontrol.util.FloodFill;
import net.minecraft.block.Block;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface NetworkHolder {
RCWorldBus getBus(World world, BlockPos pos);
void setBus(World world, BlockPos pos, RCWorldBus bus);
default void generateBus(ServerWorld world, BlockPos pos){
Block worldBlock = world.getBlockState(pos).getBlock();
if(world.getBlockEntity(pos) instanceof Peripheral entityBlock){
RCWorldBus bus = new RCWorldBus(new RedBus(), world, pos);
entityBlock.setBus(bus);
entityBlock.getBus().setValid(true);
this.setBus(world,pos,entityBlock.getBus());
FloodFill.INSTANCE.blockFloodFiller(world, pos);
}
}
}