GlowstoneMC / 1.13-board

Issue board for 1.13 tasks for Glowstone.
MIT License
2 stars 0 forks source link

Change all block ID setters [$30] #30

Open mastercoms opened 5 years ago

mastercoms commented 5 years ago

This issue is part of the 1.13.x compatibility Epic.

All contributions are subject to the Glowstone CLA. In short, contributions must not contain any content (code or otherwise) copied from, inspired by or based upon content from Mojang or third-party projects that are based on such content (CraftBukkit, Spigot, Forge, ...).


Description:

Glowstone uses a lot of calls for setting blocks to a certain type or data. These all need to be updated to use the new BlockData system. These include setType, setData, setRawData and setTypeAndData.

Relevant Code:

https://github.com/GlowstoneMC/Glowstone/search?q=setTypeAndData&unscoped_q=setTypeAndData https://github.com/GlowstoneMC/Glowstone/search?q=setData&unscoped_q=setData https://github.com/GlowstoneMC/Glowstone/search?q=setType&unscoped_q=setType https://github.com/GlowstoneMC/Glowstone/search?q=setRawData&unscoped_q=setRawData

Note: GitHub Search indexes the main branch, so this may not reflect the current state of the 1.13 branch. Please do your own searches in your IDE.

Related to:

3

--- There is a **[$30 open bounty](https://www.bountysource.com/issues/80734570-change-all-block-id-setters?utm_campaign=plugin&utm_content=tracker%2F144870401&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F144870401&utm_medium=issues&utm_source=github).
tmtvl commented 5 years ago

Should we get the BlockData from a singleton retrieved from the store (e.g. BlockDataStore.getBlockDataById(0).mutate()) or create new SimpleBlockData (e.g. new SimpleBlockData(Material.DIRT)?

aramperes commented 5 years ago

You would be using the Bukkit implementation, Material.DIRT.createBlockData(). Glowstone will implement this in GlowServer#createBlockData(Material), which is going to be done similarly to this:

@Override
public BlockData createBlockData(Material material) {
    return BlockDataStore.findSingleton(material).mutate();
}