Stained Glass Block Reflection

Discussion in 'Plugin Development' started by Hanz, Apr 24, 2014.

Thread Status:
Not open for further replies.
  1. Hey,
    I have a problem with the reflection of Stained Glass Block. When I am placeing the Stained Glass Block it always changes to the Material White Stained Glass Block. Whats wrong with the code?

    Code:java
    1. import net.minecraft.server.v1_7_R2.Block;
    2. import net.minecraft.server.v1_7_R2.BlockStainedGlass;
    3.  
    4. public class StainedGlBlock extends BlockStainedGlass{
    5. int id = 95;
    6. String name = "stained_glass";
    7. private Object backupOriginal;
    8. public StainedGlBlock(){
    9. super(net.minecraft.server.v1_7_R2.Material.BUILDABLE_GLASS);
    10. this.backupOriginal = Block.e(this.id);
    11. Block.REGISTRY.a(this.id, this.name, d(this.name));
    12. }
    13.  
    14. public void unhook(){
    15. Block.REGISTRY.a(this.id, this.name, this.backupOriginal);
    16. this.backupOriginal = null;
    17. }
    18. }
     
  2. Offline

    ZodiacTheories

    Hanz

    Wrong imports?
     
  3. Offline

    Epicballzy

    Hanz Always import from org.bukkit.. Not net.minecraft... Try and switch them around and see what happens..?
     
  4. @Epicballzy
    Normaly yes but not in a Reflection.Theres no other import for the BlockStainedGlass.
     
  5. Offline

    oscarshi1995

    Hanz thats not reflection.... thats just extending the class of a cb/minecraft server file
    reflection is also version independant and your code is version dependant

    Edit: called NMS, mindblanked earlier

    Also, What are you trying to do?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. @oscarshi1995

    I want to check if a player contact stained glass block and it works but when i am placing this block it's change the data always to white stained glass. But when i am placing the block into flowing water in changes to orange white stained glass or purple stained glass.
    Code:java
    1.  
    2. import java.util.List;
    3. import org.bukkit.entity.Player;
    4. import net.minecraft.server.v1_7_R2.AxisAlignedBB;
    5. import net.minecraft.server.v1_7_R2.Block;
    6. import net.minecraft.server.v1_7_R2.BlockStainedGlass;
    7. import net.minecraft.server.v1_7_R2.Entity;
    8. import net.minecraft.server.v1_7_R2.World;
    9.  
    10. public class SmasherBlock extends BlockStainedGlass{
    11. int id = 95;
    12. String name = "stained_glass";
    13. private Object backupOriginal;
    14. public SmasherBlock(){
    15. super(net.minecraft.server.v1_7_R2.Material.BUILDABLE_GLASS);
    16. this.backupOriginal = Block.e(this.id);
    17. Block.REGISTRY.a(this.id, this.name, d(this.name).c("stainedGlass"));
    18. }
    19.  
    20. public void unhook(){
    21. Block.REGISTRY.a(this.id, this.name, this.backupOriginal);
    22. this.backupOriginal = null;
    23. }
    24.  
    25. @SuppressWarnings("rawtypes")
    26. @Override
    27. public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity){
    28. if(entity==null)return;
    29. if(entity.getBukkitEntity() instanceof Player){
    30. System.out.println("smash");
    31. }
    32. }
    33.  
    34. }
     
Thread Status:
Not open for further replies.

Share This Page