Edit: I do believe that this is the first one out there. Tell me i'm pretty. I was looking around the forums and didn't see anything that did this so i decided to make one. Its in the early stages and only does one row of the pyramid. The main point of the code is to create the beacon beam. As i have been told that it is impossible to create the beacon beam without the pyramid. Code:java public static void createBeacon(Location location) { int x = location.getBlockX(); int y = location.getBlockY() - 30; int z = location.getBlockZ(); World world = location.getWorld(); world.getBlockAt(x, y, z).setType(Material.BEACON); for (int i = 0; i <= 29; ++i) world.getBlockAt(x, (y + 1) + i, z).setType(Material.GLASS); for (int xPoint = x-1; xPoint <= x+1 ; xPoint++) { for (int zPoint = z-1 ; zPoint <= z+1; zPoint++) { world.getBlockAt(xPoint, y-1, zPoint).setType(Material.IRON_BLOCK); } } } This code will create a beacon 30 blocks below the location. Create glass all the way up to the location and shoot a beam into the sky. Code:java /*** Creates beacon 30 blocks down from location*/int y = location.getBlockY() - 30; Code:java /*** Creates glass all the way up to location*/for (int i = 0; i <= 30; ++i) world.getBlockAt(x, (y + 1) + i, z).setType(Material.GLASS); Code:java /*** Creates the Pyramid Rows*/for (int xPoint = x-1; xPoint <= x+1 ; xPoint++) { for (int zPoint = z-1 ; zPoint <= z+1; zPoint++) { world.getBlockAt(xPoint, y-1, zPoint).setType(Material.IRON_BLOCK); }} Please note this is my first attempt at this and in later versions it will be more compact using for each and also allow for multiple rows and custom pyramid blocks. Updates October 2, 2013 Project Posted. Code was bloated and not appealing Later that day. Pyramid code updated to for each loops. Code now compressed. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
It's surely not impossible[to turn on the beacon without a pyramid], just probably requires some painful nms and/or server modification. I'm really bored, so I'm gonna go look through the nms for it now...
Hm, it might be but that seems like it'd be a waste to recalculate every time the client saw a beacon... Edit: So while looking through the source I was beginning to suspect the boolean 'd' in TileEntityBeacon was responsible for it being activated. And then I found this while searching for whether it was clientsided or not: https://github.com/SocialCraft/Pret...stirante/PrettyScaryLib/BeaconHelper.java#L59 So I think it is possible...but I'd have to do some testing and see what you can mess with Edit again: That is probably only responsible for potions, not the beam, but I'm still bored so I'll look for stuff anyway. Looking through it it definitely doesn't appear that the server is telling the client to turn it on and off. Oh well. Another edit: It does send nbt data with the following values in the update packet for the tile entity: -Primary -Secondary -Levels Levels is the integer e, which appears to in fact be the height of the pyramid calculated every time the server recalculates the pyramid. The question is: does the client calculate the beam based on the tile entity data or by checking the blocks under it? Edit again: I checked the protocol just to make sure it did what I thought it did, and it appears to. The packet is 132(0x84). Anybody want to mess with it and see if they can get the client to display a beam incorrectly? https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/Packet132TileEntityData.java https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/TileEntityBeacon.java
Garris0n The only other way i can think of to create a beacon beam without the actual pyramid is to send packets to the player and fake the pyramid.
Guys stop trying; de beam is completly client side, yes each time there is a pyramid the client calculates it. Thats how it is, nothing todo about it.
Ultimate_n00b The client would still see them; You have to send the block changes to the client so he knows there is a pyramid + beacon and therefor it will create the beam. Sorry there is no magic way around it, it's the way how _jeb wanted Minecraft to be :/
Huh? I never said the blocks wouldn't show up. I was just suggesting an idea involving only a beacon, and some packets.
Ultimate_n00b Oh so you mean the blocks get never placed server-side? Edit: I just read your comment again and realize how stupid I am... Sorry about that
Well yeah you could just .sendBlockChange, no nms/reflection needed, but the client still sees the blocks.
Are you sure the beam is completely clientside? I had blocklag once and the been kept shining its beam with a block above
They deprecated everything that uses item ids or damage values with no replacements...stuff from sendBlockChange to getLineOfSight. There's no way they'd remove it all without creating a replacement first.
Garris0n I think the id's are gone for the mod support, like modname:item, (like how the texture stuff for mods is currently used) and for minecraft items it would be something like: MC:itemname or minecraft:itemname... My guess is Item Id's are dead. But let's not get too far off-topic. Anyways, good job Goblom.
To point it out, I'm pretty sure he meant on twitter. Yes, that's exactly why. Magic numbers are bad.
timtower - have a read of ^^ Haven't gone through it in detail so not sure if they were able to get it working or not.