Need help with NMS code (block modification)

Discussion in 'Plugin Development' started by xGhOsTkiLLeRx, Aug 21, 2012.

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

    xGhOsTkiLLeRx

    Hey guys!

    The way I used the code worked until 1.2.5.
    With 1.3 it works only with some blocks (like doors. but no levers for example)

    nisovin - maybe you know something? I know you are very good in NMS code!

    Code:
    			// Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
    			Block.byId[Block.GLASS.id] = null;
    			Block.byId[Block.GLASS.id] = new CustomGlass(Block.GLASS.id, 49, Material.SHATTERABLE, false).setHardness(0.3F).setSound(Block.j).b("glass");
    			try {
    				Field field = Material.SHATTERABLE.getClass().getDeclaredField("I");
    				field.setAccessible(true);
    				field.setBoolean(Material.SHATTERABLE, false);
    			}
    			catch (Exception e) {
    				e.printStackTrace();
    				log.warning("BlocksOnGlass couldn't modify the glass block!");
    			}
    (Side note, in the CustomGlass class I only changed the method c() to true - means render as a full block)

    Any help is appreciated! :)
     
Thread Status:
Not open for further replies.

Share This Page