Java Edition.png

Java Edition:Any Effect Beacons

From Minecraft Discontinued Features Wiki
Jump to navigation Jump to search
Java.png
Warning: Modified Client 
This article covers features exclusive to modified clients and covers discontinued features available through them on vanilla servers. Perform at your own risk.
FireResistanceTwoBeacon.png

From 14w02a (1.8 snapshot) to release 1.8.4, the beacon effect selection packet did not contain any checks on the effects selected. These can include any effect in the game, far beyond the 6 available by default (speed, haste, resistance, jump boost, strength, and regeneration). One can even send invalid effect IDs, but this will cause the server to crash every 80 ticks during the beacon tile entity's tick.

These will be removed in 1.8.5, with the introduction of proper packet checks, and the removal of any invalid effects set in an old beacon upon loading from NBT. The only invalid beacon that may still be created or updated beyond 1.8.5 is a beacon providing regeneration 2, as the game sees it as one of the valid beacon effects, regardless of the client not being able to select the second level by default.

Obtaining

This requires a modified client to create, but it will work on any vanilla server. The client must modify the beacon GUI class to send a custom beacon update packet containing the effect IDs one wishes to place into the beacon.

The below example was created with 1.8 Minecraft Coder Pack (MCP) mappings to modify the beacon update packet to create a regeneration two beacon:

import io.netty.buffer.Unpooled;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.inventory.IInventory;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.tileentity.TileEntityBeacon;

public class GuiBeacon extends GuiContainer
{
    private IInventory tileBeacon;

    //...

    protected void actionPerformed(GuiButton button) throws IOException
    {
        if (button.id == -2) // The cancel button has been pressed. ;(
        {
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == -1) // The checkmark button has been pressed. It's showtime >:)
        {
            String var2 = "MC|Beacon"; // this is needed to tell the server what packet we are sending
            PacketBuffer var3 = new PacketBuffer(Unpooled.buffer()); // Create the packet buffer to write to

            //var3.writeInt(this.tileBeacon.getField(1)); - The original packet creation: we don't care about this!
            //var3.writeInt(this.tileBeacon.getField(2));

            var3.writeInt(10); // - Set the "Primary" effect ID here.
            var3.writeInt(10); // - Set the "Secondary" effect ID here.

            // To create a level 2 effect, set the Primary and Secondary effect IDs to the same thing.
            
            this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(var2, var3)); // send the packet off to the server, and let the magic happen!
            
            this.mc.displayGuiScreen((GuiScreen)null); // close the GUI, we're done here.
        }
        else if (button instanceof GuiBeacon.PowerButton) // You selected a default effect like a n00b. Not that it matters with this hack, anyways.
        {
            if (((GuiBeacon.PowerButton)button).func_146141_c())
            {
                return;
            }

            int var5 = button.id;
            int var6 = var5 & 255;
            int var4 = var5 >> 8;

            if (var4 < 3)
            {
                this.tileBeacon.setField(1, var6);
            }
            else
            {
                this.tileBeacon.setField(2, var6);
            }

            this.buttonList.clear();
            this.initGui();
            this.updateScreen();
        }
    }

    //...

}

Uses

Access to any effect in the game at level 1 or 2 allows for a plethora of unique and discontinued effects to be obtained. These include:

  • Mining Fatigue I
  • Mining Fatigue II
  • Instant Health I (long duration)
  • Instant Health II (long duration)
  • Instant Damage I (long duration)
  • Instant Damage II (long duration)
  • Nausea II
  • Fire Resistance II
  • Water Breathing II
  • Invisibility II
  • Blindness II
  • Night Vision II
  • Hunger II
  • Health Boost I
  • Health Boost II
  • Absorption II (long duration)
  • Saturation I (long duration)
  • Saturation II

As previously stated, one can also create a Regeneration 2 beacon from 14w02a to 24w37a (present), which allows for a uniquely powerful beacon.

See also