Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void switchLamp(Block b, boolean lighting) throws Exception {
- World w = (World) ((CraftWorld) b.getWorld()).getHandle();
- if (lighting) {
- setWorldStatic(w, true);
- b.setType(Material.REDSTONE_LAMP_ON);
- setWorldStatic(w, false);
- } else {
- b.setType(Material.REDSTONE_LAMP_OFF);
- }
- }
- private static void setWorldStatic(World world, boolean static_boolean) throws Exception {
- Field static_field = World.class.getDeclaredField("isClientSide");
- static_field.setAccessible(true);
- static_field.set(world, Boolean.valueOf(static_boolean));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement