Minecraft 1.21.9 update.

There a lot of performance improvements related to events.
  No more InheritableEvent for abstract events that you shouldn't add listeners to anyway, like EntityEvent. Use their sub-events.
  Made a lot more events records and interfaces. Mostly just a binary break, but has better performance.
  Mod bus posting methods are now static, no more ModLoader.get() for those.

ObjectHolder was removed, use RegistryObject.
Changed RuntimeEnumExtender to only target Minecraft classes. If you want other modders to interact with your API, use an Interface instead of Enum.
Moved some abstract event methods to only the relevant sub-events now, e.g. can no longer check the side of a ClientTickEvent, because it'll always be client

Rendering has changed a lot, they now batch most things together so that the game will render faster.
RenderHighlightEvent changed a lot

See https://github.com/MinecraftForge/MinecraftForge-Experimental/tree/1.21.9-dev for unsquashed commits.

Co-authored-by: Paint_Ninja <[email protected]>
This commit is contained in:
LexManosandPaint_Ninja committed 2025-10-01 13:05:12 -07:00
1 parent c1d703e395
commit b0ccf1a480
490 files changed
+4601 -6528

No files matched your search

@@ -31,7 +31,7 @@ public class PlayerMainInvWrapper extends RangedWrapper {
ItemStack inSlot = getStackInSlot(slot);
if(!inSlot.isEmpty()) {
var world = getInventoryPlayer().player.level();
if (world.isClientSide) {
if (world.isClientSide()) {
inSlot.setPopTime(5);
} else if (getInventoryPlayer().player instanceof ServerPlayer) {
getInventoryPlayer().player.containerMenu.broadcastChanges();
@@ -11,11 +11,9 @@ import net.minecraft.world.item.ItemStack;
import net.minecraftforge.items.IItemHandlerModifiable;
public class RecipeWrapper implements Container {
protected final IItemHandlerModifiable inv;
public RecipeWrapper(IItemHandlerModifiable inv)
{
public RecipeWrapper(IItemHandlerModifiable inv) {
this.inv = inv;
}
@@ -23,8 +21,7 @@ public class RecipeWrapper implements Container {
* Returns the size of this inventory.
*/
@Override
public int getContainerSize()
{
public int getContainerSize() {
return inv.getSlots();
}
@@ -32,8 +29,7 @@ public class RecipeWrapper implements Container {
* Returns the stack in this slot. This stack should be a modifiable reference, not a copy of a stack in your inventory.
*/
@Override
public ItemStack getItem(int slot)
{
public ItemStack getItem(int slot) {
return inv.getStackInSlot(slot);
}
@@ -41,8 +37,7 @@ public class RecipeWrapper implements Container {
* Attempts to remove n items from the specified slot. Returns the split stack that was removed. Modifies the inventory.
*/
@Override
public ItemStack removeItem(int slot, int count)
{
public ItemStack removeItem(int slot, int count) {
ItemStack stack = inv.getStackInSlot(slot);
return stack.isEmpty() ? ItemStack.EMPTY : stack.split(count);
}
@@ -51,8 +46,7 @@ public class RecipeWrapper implements Container {
* Sets the contents of this slot to the provided stack.
*/
@Override
public void setItem(int slot, ItemStack stack)
{
public void setItem(int slot, ItemStack stack) {
inv.setStackInSlot(slot, stack);
}
@@ -60,37 +54,32 @@ public class RecipeWrapper implements Container {
* Removes the stack contained in this slot from the underlying handler, and returns it.
*/
@Override
public ItemStack removeItemNoUpdate(int index)
{
public ItemStack removeItemNoUpdate(int index) {
ItemStack s = getItem(index);
if(s.isEmpty()) return ItemStack.EMPTY;
if (s.isEmpty())
return ItemStack.EMPTY;
setItem(index, ItemStack.EMPTY);
return s;
}
@Override
public boolean isEmpty()
{
for(int i = 0; i < inv.getSlots(); i++)
{
if(!inv.getStackInSlot(i).isEmpty()) return false;
public boolean isEmpty() {
for (int i = 0; i < inv.getSlots(); i++) {
if (!inv.getStackInSlot(i).isEmpty())
return false;
}
return true;
}
@Override
public boolean canPlaceItem(int slot, ItemStack stack)
{
public boolean canPlaceItem(int slot, ItemStack stack) {
return inv.isItemValid(slot, stack);
}
@Override
public void clearContent()
{
public void clearContent() {
for(int i = 0; i < inv.getSlots(); i++)
{
inv.setStackInSlot(i, ItemStack.EMPTY);
}
}
//The following methods are never used by vanilla in crafting. They are defunct as mods need not override them.
@@ -100,9 +89,4 @@ public class RecipeWrapper implements Container {
public void setChanged() {}
@Override
public boolean stillValid(Player player) { return false; }
@Override
public void startOpen(Player player) {}
@Override
public void stopOpen(Player player) {}
}