Port capability patches to 1.13 and refactor to new system (#5134)

* resource package and misc leftover rendering stuff

* Port Item and ItemStack patches

* Extract most item patches to interface

* Refactor Item#setNoRepair to be part of Item.Builder

* Adapt AnimationItemOverrideList to new cap system

* Improve null contract of OptionalCapabilityInstance

* Remove Capability.cast

* Update CapabilityAnimation to new cap system

* Remove OptionalCapabilityInstance#flatMap and add NonNullConsumer

* Add capability patch to Entity, not everything yet

* Fix Entity patch and add missing methods to IForgeEntity

* Fix null contract of CapabilityDispatcher

* Add TileEntity caps

* Adapt FluidUtil to new cap system

* Add world caps

* Add chunk caps

* Clean up cap patches

* Replace all tabs with spaces

* Move builder methods on Item to Item.Builder

Whitepsace fix

* Sided stuff take 2

* Prevent OptionalCapabilityInstance creating additional empty instances

* Cache getCapability result in AnimationTESR

* Fix imports in TileEntity patch

* Pull out cap code to base class, add village caps
This commit is contained in:
tterrag authored and GitHub committed 2018-09-09 17:27:15 -04:00
1 parent f851b37aa0
commit 334d925972
45 files changed
+1967 -266

No files matched your search

@@ -0,0 +1,28 @@
--- a/net/minecraft/entity/Entity.java
+++ b/net/minecraft/entity/Entity.java
@@ -12,6 +12,7 @@
import java.util.Random;
import java.util.Set;
import java.util.UUID;
+
import javax.annotation.Nullable;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.block.Block;
@@ -97,7 +98,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class Entity implements INameable, ICommandSource {
+public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity {
protected static final Logger LOGGER = LogManager.getLogger();
private static final List<ItemStack> EMPTY_EQUIPMENT = Collections.<ItemStack>emptyList();
private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -221,6 +222,8 @@
this.dataManager.register(SILENT, false);
this.dataManager.register(NO_GRAVITY, false);
this.entityInit();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
+ this.gatherCapabilities();
}
public EntityType<?> func_200600_R() {