Filled GlassSnow

Discussion in 'Archived: Plugin Requests' started by Maddin, May 2, 2013.

  1. Offline

    Maddin

    Suggested name: GlassSnow

    What I want: I want a simple plugin, that allows snow to appear on glass when snowing. It should act a bit liek glass and let light through it.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: No permissions needed for this plugin.

    Would be nice :D
     
  2. Offline

    whatapigdoes

    i dont think this is possible
    anyway dosen't it already do that?
     
  3. Offline

    Maddin

    Nope. It did in Minercraft Alpha...
     
  4. Offline

    teti100teti

    I don't think WE could do that but.. jeb_ or someone could, ask him?
     
  5. Offline

    DarkRiddles

    Jeb never come on here, if you wanna get something done Twitter him a picture of a cat each day till he adds it xD
     
    Maddin likes this.
  6. Offline

    teti100teti

    Never said he would come here.
     
  7. Offline

    Maddin

    But you guys say it's not possible with a server mod?
     
  8. Offline

    DarkRiddles

    If you wait to modding api come out then it possible or unless jeb take your idea and does something with it then Yes it Not possible!
     
  9. I really don't know what people here are talking about... This is 100% possible with a bukkit server mod.
     
  10. Offline

    Maddin

    Would you try to do this? :D
     
  11. Offline

    CreeperShift

    I'm pretty sure if you simply replace the air over the glass with snow it will do exactly like the OP requested.
     
  12. Offline

    Maddin

    Basicly yes, but it should do it when it snows. Well... just like with all the other blocks.
     
  13. Thats not hard to do at all, you just replace the BlockSnow with a class that return true for placing on glass in this method:
    https://github.com/Bukkit/mc-dev/bl...53e6f/net/minecraft/server/BlockSnow.java#L45

    Main class
    Code:java
    1. package me.mncat77.glasssnow;
    2.  
    3. import net.minecraft.server.v1_5_R2.Block;
    4. import org.bukkit.plugin.java.JavaPlugin;
    5.  
    6. public class GlassSnow extends JavaPlugin {
    7.  
    8. @Override
    9. public void onDisable() {
    10. }
    11.  
    12. @Override
    13. public void onEnable() {
    14. Block.byId[Block.SNOW.id] = null;
    15. Block.byId[Block.SNOW.id] = ((BlockGlassSnow)(new BlockGlassSnow(78)).c(0.1F).a(Block.o).c("snow")).k(0);
    16. }
    17. }


    BlockGlassSnow class
    Code:java
    1. package me.mncat77.glasssnow;
    2.  
    3. import java.util.Random;
    4. import net.minecraft.server.v1_5_R2.AxisAlignedBB;
    5. import net.minecraft.server.v1_5_R2.Block;
    6. import net.minecraft.server.v1_5_R2.CreativeModeTab;
    7. import net.minecraft.server.v1_5_R2.EntityHuman;
    8. import net.minecraft.server.v1_5_R2.EnumSkyBlock;
    9. import net.minecraft.server.v1_5_R2.IBlockAccess;
    10. import net.minecraft.server.v1_5_R2.Item;
    11. import net.minecraft.server.v1_5_R2.ItemStack;
    12. import net.minecraft.server.v1_5_R2.Material;
    13. import net.minecraft.server.v1_5_R2.StatisticList;
    14. import net.minecraft.server.v1_5_R2.StepSound;
    15. import net.minecraft.server.v1_5_R2.World;
    16.  
    17. public class BlockGlassSnow extends Block {
    18.  
    19. protected BlockGlassSnow(int i) {
    20. super(i, Material.SNOW_LAYER);
    21. this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
    22. this.b(true);
    23. this.a(CreativeModeTab.c);
    24. this.d(0);
    25. }
    26.  
    27. @Override
    28. public AxisAlignedBB b(World world, int i, int j, int k) {
    29. int l = world.getData(i, j, k) & 7;
    30. float f = 0.125F;
    31.  
    32. return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + (float) l * f), (double) k + this.maxZ);
    33. }
    34.  
    35. @Override
    36. public boolean c() {
    37. return false;
    38. }
    39.  
    40. @Override
    41. public boolean b() {
    42. return false;
    43. }
    44.  
    45. @Override
    46. public void g() {
    47. this.d(0);
    48. }
    49.  
    50. @Override
    51. public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
    52. this.d(iblockaccess.getData(i, j, k));
    53. }
    54.  
    55. protected void d(int i) {
    56. int j = i & 7;
    57. float f = (float) (2 * (1 + j)) / 16.0F;
    58.  
    59. this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
    60. }
    61.  
    62. @Override
    63. public boolean canPlace(World world, int i, int j, int k) {
    64. int l = world.getTypeId(i, j - 1, k);
    65.  
    66. return world.getMaterial(i, j - 1, k) == Material.BUILDABLE_GLASS ? true : l == 0 ? false : (l == this.id && (world.getData(i, j - 1, k) & 7) == 7 ? true : (l != Block.LEAVES.id && !Block.byId[l].c() ? false : world.getMaterial(i, j - 1, k).isSolid()));
    67. }
    68.  
    69. @Override
    70. public void doPhysics(World world, int i, int j, int k, int l) {
    71. this.m(world, i, j, k);
    72. }
    73.  
    74. private boolean m(World world, int i, int j, int k) {
    75. if (!this.canPlace(world, i, j, k)) {
    76. this.c(world, i, j, k, world.getData(i, j, k), 0);
    77. world.setAir(i, j, k);
    78. return false;
    79. } else {
    80. return true;
    81. }
    82. }
    83.  
    84. @Override
    85. public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
    86. int i1 = Item.SNOW_BALL.id;
    87. int j1 = l & 7;
    88.  
    89. this.b(world, i, j, k, new ItemStack(i1, j1 + 1, 0));
    90. world.setAir(i, j, k);
    91. entityhuman.a(StatisticList.C[this.id], 1);
    92. }
    93.  
    94. @Override
    95. public int getDropType(int i, Random random, int j) {
    96. return Item.SNOW_BALL.id;
    97. }
    98.  
    99. @Override
    100. public int a(Random random) {
    101. return 0;
    102. }
    103.  
    104. @Override
    105. public void a(World world, int i, int j, int k, Random random) {
    106. if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
    107. this.c(world, i, j, k, world.getData(i, j, k), 0);
    108. world.setAir(i, j, k);
    109. }
    110. }
    111.  
    112. @Override
    113. public BlockGlassSnow c(float f) {
    114. this.strength = f;
    115. if (this.durability < f * 5.0F) {
    116. this.durability = f * 5.0F;
    117. }
    118.  
    119. return this;
    120. }
    121.  
    122. @Override
    123. public BlockGlassSnow a(StepSound stepsound) {
    124. this.stepSound = stepsound;
    125. return this;
    126. }
    127.  
    128. @Override
    129. public BlockGlassSnow k(int i) {
    130. lightBlock[this.id] = i;
    131. return this;
    132. }
    133. }


    Can't test this anymore, should work though.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  14. Offline

    Maddin

    Uhm... i'm not really into java so i cant tell what to do with this code :D

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  15. I provided a finished solution to your request, why are you bumping?
     
  16. Offline

    Maddin

    Because i don't know what to do with the code. I'm sure it's right but i would need it as a jar i think.
    I'm not a programmer :)
     

Share This Page