net.minecraftforge.fml.common.IWorldGenerator
->net.minecraft.world.gen.feature.Feature
- No longer needed. I think it should be removed by forge, as it has been superseded by vanilla functionality. See below.
net.minecraft.world.gen.feature.WorldGenerator
->net.minecraft.world.gen.feature.Feature
- This would also be the most common replacement of Forge's
IWorldGenerator
. This should be the solution for anything smaller than a chunk. - Except the 8 blocks offset. This is not a thing anymore. Population now works just like any normal person would expect.
- Position of features is controlled by instances of
net.minecraft.world.gen.placement.BasePlacement
instead of by the feature itself.
- This would also be the most common replacement of Forge's
net.minecraft.world.gen.MapGenBase
->net.minecraft.world.gen.carver.IWorldCarver
- This is now finally exposed to mods in a useful way. As it was mostly hidden from modders before, not eveyone may know what it is, so it will be explained later. Generates caves a
local function insertNonNil(t, v) | |
if v then | |
v = tostring(v) | |
if #v > 0 then | |
table.insert(t, v) | |
end | |
end | |
end | |
local function backtrace(levelStart, shift) |
/** TLDR | |
* Update Tag -> sent when client loads the chunk the TE is in | |
* Update Packet -> sent when you call world.notifyBlockUpdate | |
**/ | |
public class YourTileEntity extends TileEntity | |
{ | |
public YourTileEntity() |
With the release of Forge 14.23.2.2638, a proper way to render items with GL was implemented. Using this system is much simpler than the old system, which required a TileEntity, and does not allow access to the ItemStack.
TileEntityItemStackRenderer allows you to render your item using public void renderByItem(ItemStack itemStackIn)
.
There is an overload that takes partialTicks as a parameter, but it is never called in vanilla.
In order to use a TEISR, the Item must first satisfy the condition that its model returns true for IBakedModel#isBuiltInRenderer
.
Once that returns true, the Item's TEISR will be accessed for rendering. If it does not have one, it will use the default TileEntityItemStackRenderer.instance
. For an example IBakedModel to use, see below.
In this document, I use strings in the format "foo:bar"
to represent ResourceLocation
s with domain foo
and path bar
. I also use [square brackets]
for placeholders.
On startup and whenever the resources are reloaded (in ModelLoader#setupModelRegistry
), Minecraft iterates through every registered Block
(in ModelLoader#loadBlocks
) and asks its custom IStateMapper
(or DefaultStateMapper
if none has been registered) to create a mapping between every valid IBlockState
of the Block
and the ModelResourceLocation
for that state (with the domain and path pointing to a blockstates file and the variant to a variant within that file). It then attempts to load these models.
DefaultStateMapper
looks for the blockstates file with the Block
's registry name (i.e. assets/[modid]/blockstates/[name].json) and serialises each property and value of the IBlockState
to create the variant name that the model is loaded from (e.g. "enabled=true,type=foobar"
Another award-winning primer by williewillus
Capabilities...a wondrous new system. That you've probably been forced into using. But let's not talk about that and get straight into the learning!
- Capability System - This entire system; what this primer is about. This system is named very literally for what it does.
- Capability - the quality of being capable; capacity; ability
- Capable - having power and ability
package speedytools.clientside.selections; | |
import net.minecraft.block.Block; | |
import net.minecraft.block.state.IBlockState; | |
import net.minecraft.client.Minecraft; | |
import net.minecraft.client.renderer.*; | |
import net.minecraft.client.renderer.block.model.BakedQuad; | |
import net.minecraft.client.renderer.texture.DynamicTexture; | |
import net.minecraft.client.renderer.texture.TextureManager; | |
import net.minecraft.client.renderer.texture.TextureMap; |