Weird physics problem with redstone lamps

Discussion in 'Plugin Development' started by Regenwurm97, Mar 30, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Regenwurm97

    One of the users of my plugin just sent me a screenshot and I can't figure out what the problem is:

    Screenshot_1.png

    The plugin is WurmStreetlights, it basically enables redstone lamps during nighttime and turns them off at daytime. It works perfectly fine for myself and hundreds of other users, this is the first time I see something like that.

    This is the mechanism that turns on / off the lamps (in a synchronized bukkittask):

    Code:
    net.minecraft.server.v1_9_R1.World lampCraftWorld = ((org.bukkit.craftbukkit.v1_9_R1.CraftWorld) lamp.getBlock().getWorld()).getHandle(); //CraftWorld von Lampe
                       
    java.lang.reflect.Field static_field = net.minecraft.server.v1_9_R1.World.class.getDeclaredField("isClientSide"); //Dieses Field muss auf true gesetzt werden, während man die Lampe anschaltet!
    static_field.setAccessible(true);
                       
    static_field.set(lampCraftWorld, true); //Disables the physics for this block temporarily
    this.lamp.getBlock().setTypeIdAndData(Material.REDSTONE_LAMP_ON.getId(), (byte) 0, false);
    static_field.set(lampCraftWorld, false); //Enables the physics of this block again

    Anyone got an idea what could be the problem? I thought it might be a client problem...

    Thanks in advance! :)

    - Wurm
     
  2. Offline

    mcdorli

    @Regenwurm97 Please, don't just post images, post what the problem is

    You need to update the chunk the lamp is in, so you don't get glitches
     
  3. Offline

    Regenwurm97

    I thought the problem is obvious enough in the screenshot
    Alright I will try that, thanks for your help :)
     
  4. Offline

    mcdorli

    It is, but it took like 2 minutes with my really bad data to download it.
     
Thread Status:
Not open for further replies.

Share This Page