我嘞个 MinecraftServer server =player.getServer();BlockPos boxPos =buf.readBlockPos(); int[] timeData= buf.readIntArray();Boolean enabled = buf.readBoolean();if (server != null) {server.execute(()-> {if (player.getEntityWorld().getBlockEntity(boxPos) != null && player.getEntityWorld().getBlockEntity(boxPos).getType() == AFRoadsBlockRegistry.TRAFFIC_LIGHTS_CONTROL_ENTITY) {TrafficLightsControlEntity blockEntity = (TrafficLightsControlEntity) player.getEntityWorld().getBlockEntity(boxPos);World world =player.getEntityWorld();world.setBlockState(boxPos,world.getBlockState(boxPos).with(BooleanProperty.of("is_enable"),enabled));blockEntity.setCachedState(blockEntity.getCachedState().with(BooleanProperty.of("is_enable"),enabled));ArrayList<Integer> timeForward = new ArrayList<>();ArrayList<Integer> timeTurn = new ArrayList<>(); timeForward.add(timeData);timeForward.add(timeData);timeTurn.add(timeData); timeTurn.add(timeData);blockEntity.setTimeData(timeForward,timeTurn); AFRoads.LOGGER.info("Set Traffic lights Control Box {"+ Arrays.toString(timeData) + "} ,"+enabled );} else if (player.getEntityWorld().getBlockEntity(boxPos) == null) {AFRoads.LOGGER.info("Invalid Block Entity.");}});} 我嘞个镭 我嘞个轨道
页:
1
[2]