From 4d6b42b9c8790f0c8d68e3e6c01d765f25378dfe Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 19:33:03 +0800 Subject: [PATCH 1/9] add EntityInventoryType classes --- build.gradle | 3 +- build.properties | 2 +- .../integratedtunnels/IntegratedTunnels.java | 5 +++ .../api/world/EntityInventoryTypeBase.java | 26 +++++++++++++ .../world/IEntityInventoryTypeRegistry.java | 17 +++++++++ .../core/world/EntityInventoryType.java | 28 ++++++++++++++ .../world/EntityInventoryTypeRegistry.java | 38 +++++++++++++++++++ .../core/world/EntityInventoryTypes.java | 34 +++++++++++++++++ .../aspect/TunnelAspectWriteBuilders.java | 8 ++++ 9 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/cyclops/integratedtunnels/api/world/EntityInventoryTypeBase.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/api/world/IEntityInventoryTypeRegistry.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryType.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypeRegistry.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java diff --git a/build.gradle b/build.gradle index 3e2984012..f510eb615 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() maven { name = "forge" - url = "http://files.minecraftforge.net/maven" + url = "https://maven.minecraftforge.net/" } } dependencies { @@ -23,6 +23,7 @@ plugins { apply plugin: 'net.minecraftforge.gradle' apply plugin: 'idea' +apply plugin: 'eclipse' apply plugin: 'maven' apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'jacoco' diff --git a/build.properties b/build.properties index eba13ef02..09ccf4ba0 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ mod_version=1.8.9 minecraft_version=1.16.5 -forge_version=36.2.5 +forge_version=36.2.34 mcp_mappings_channel=snapshot mcp_mappings_version=20201028-1.16.3 cyclopscore_version=1.11.6-64 diff --git a/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java b/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java index 80389806e..0c07a3066 100644 --- a/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java +++ b/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java @@ -22,6 +22,7 @@ import org.cyclops.integrateddynamics.infobook.OnTheDynamicsOfIntegrationBook; import org.cyclops.integratedtunnels.api.world.IBlockBreakHandlerRegistry; import org.cyclops.integratedtunnels.api.world.IBlockPlaceHandlerRegistry; +import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; import org.cyclops.integratedtunnels.capability.ingredient.TunnelIngredientComponentCapabilities; import org.cyclops.integratedtunnels.capability.network.FluidNetworkConfig; import org.cyclops.integratedtunnels.capability.network.ItemNetworkConfig; @@ -31,6 +32,8 @@ import org.cyclops.integratedtunnels.core.world.BlockBreakHandlers; import org.cyclops.integratedtunnels.core.world.BlockBreakPlaceRegistry; import org.cyclops.integratedtunnels.core.world.BlockPlaceHandlers; +import org.cyclops.integratedtunnels.core.world.EntityInventoryTypeRegistry; +import org.cyclops.integratedtunnels.core.world.EntityInventoryTypes; import org.cyclops.integratedtunnels.item.ItemDummyPickAxeConfig; import org.cyclops.integratedtunnels.part.PartTypes; import org.cyclops.integratedtunnels.part.aspect.TunnelAspects; @@ -57,6 +60,7 @@ public IntegratedTunnels() { // Registries getRegistryManager().addRegistry(IBlockBreakHandlerRegistry.class, BlockBreakHandlerRegistry.getInstance()); getRegistryManager().addRegistry(IBlockPlaceHandlerRegistry.class, BlockBreakPlaceRegistry.getInstance()); + getRegistryManager().addRegistry(IEntityInventoryTypeRegistry.class, EntityInventoryTypeRegistry.getInstance()); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onRegistriesCreate); } @@ -67,6 +71,7 @@ public void onRegistriesCreate(RegistryEvent.NewRegistry event) { PartTypes.load(); BlockBreakHandlers.load(); BlockPlaceHandlers.load(); + EntityInventoryTypes.load(); } @Override diff --git a/src/main/java/org/cyclops/integratedtunnels/api/world/EntityInventoryTypeBase.java b/src/main/java/org/cyclops/integratedtunnels/api/world/EntityInventoryTypeBase.java new file mode 100644 index 000000000..473a8071b --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/api/world/EntityInventoryTypeBase.java @@ -0,0 +1,26 @@ +package org.cyclops.integratedtunnels.api.world; + +import javax.annotation.Nonnull; + +/** + * An entity inventory type. + * For example: armor slots, inventory slots, ender chest. + * Other mods may add extra inventory types. + * + * Effectively an enum key; used as entries in a registry. + * + * @author met4000 + */ +public abstract class EntityInventoryTypeBase { + + @Nonnull + public abstract String getName(); // TODO allow for localisation + + @Override + public final boolean equals(Object o) { + if (o == null) return false; + if (!(o instanceof EntityInventoryTypeBase)) return false; + return getName().equals(((EntityInventoryTypeBase)o).getName()); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityInventoryTypeRegistry.java b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityInventoryTypeRegistry.java new file mode 100644 index 000000000..86cc12b9b --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityInventoryTypeRegistry.java @@ -0,0 +1,17 @@ +package org.cyclops.integratedtunnels.api.world; + +import java.util.Collection; + +import org.cyclops.cyclopscore.init.IRegistry; + +/** + * Collection of IEntityInventoryTypes. + * @author met4000 + */ +public interface IEntityInventoryTypeRegistry extends IRegistry { + + public EntityInventoryTypeBase register(EntityInventoryTypeBase type); + + public Collection getTypes(); + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryType.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryType.java new file mode 100644 index 000000000..057f9faed --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryType.java @@ -0,0 +1,28 @@ +package org.cyclops.integratedtunnels.core.world; + +import javax.annotation.Nonnull; + +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; + +/** + * Implements {@link EntityInventoryTypeBase} + * @author met4000 + */ +public class EntityInventoryType extends EntityInventoryTypeBase { + + private final String name; + + public EntityInventoryType(String name) { + this.name = name; + }; + + public static EntityInventoryType fromString(String name) { + return new EntityInventoryType(name); + } + + @Override @Nonnull + public String getName() { + return name; + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypeRegistry.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypeRegistry.java new file mode 100644 index 000000000..6b6ee697e --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypeRegistry.java @@ -0,0 +1,38 @@ +package org.cyclops.integratedtunnels.core.world; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; + +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; +import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; + +/** + * Implements {@link IEntityInventoryTypeRegistry} + * @author met4000 + */ +public class EntityInventoryTypeRegistry implements IEntityInventoryTypeRegistry { + + private static EntityInventoryTypeRegistry INSTANCE = new EntityInventoryTypeRegistry(); + + // linked list used for constant append time + private final Collection types = new LinkedList(); + + private EntityInventoryTypeRegistry() {} + + public static EntityInventoryTypeRegistry getInstance() { + return INSTANCE; + } + + @Override + public EntityInventoryTypeBase register(EntityInventoryTypeBase type) { + types.add(type); + return type; + } + + @Override + public Collection getTypes() { + return Collections.unmodifiableCollection(types); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java new file mode 100644 index 000000000..eecdbcde6 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java @@ -0,0 +1,34 @@ +package org.cyclops.integratedtunnels.core.world; + +import org.cyclops.integratedtunnels.IntegratedTunnels; +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; +import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; + +import net.minecraft.util.Direction; + +/** + * Collection of {@link EntityInventoryTypeBase}s. + * @author met4000 + */ +public class EntityInventoryTypes { + + // TYPES NOT ADDED TO REGISTRY HERE: delegated to {@link EntityIItemTargetProxyBase} + public static final IEntityInventoryTypeRegistry REGISTRY = IntegratedTunnels._instance.getRegistryManager() + .getRegistry(IEntityInventoryTypeRegistry.class); + + // default inventory type (accesses either armor or inventory based on the side) + public static final EntityInventoryTypeBase SIDED = new EntityInventoryType("sided"); + + // the armor inventory of an entity + public static final EntityInventoryTypeBase ARMOR = new EntityInventoryType("armor"); + public static final Direction ARMOR_SIDE = Direction.UP; // TODO verify + + // the main inventory of an entity + public static final EntityInventoryTypeBase INVENTORY = new EntityInventoryType("inventory"); + public static final Direction INVENTORY_SIDE = Direction.NORTH; // TODO verify + + // TODO: ENDERINVENTORY, for players ? + + public static void load() {} + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java b/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java index 50f1cc1ef..c135e8723 100644 --- a/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java +++ b/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java @@ -67,6 +67,8 @@ import org.cyclops.integratedtunnels.core.part.PartStatePositionedAddon; import org.cyclops.integratedtunnels.core.part.PartTypeInterfacePositionedAddonFiltering; import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.core.world.EntityInventoryType; +import org.cyclops.integratedtunnels.core.world.EntityInventoryTypes; import org.cyclops.integratedtunnels.part.PartStatePlayerSimulator; import javax.annotation.Nullable; @@ -1246,6 +1248,8 @@ public static final class World { input -> input.getRawValue() >= -180D && input.getRawValue() <= 180F; public static final Predicate VALIDATOR_DOUBLE_OFFSET = input -> input.getRawValue() >= 0.01D && input.getRawValue() <= 1.01F; + public static final Predicate VALIDATOR_STRING_ENTITYINVENTORY = + input -> EntityInventoryTypes.REGISTRY.getTypes().contains(EntityInventoryType.fromString(input.getRawValue())); // is there a better way to do this? public static final IAspectPropertyTypeInstance PROP_BLOCK_UPDATE = new AspectPropertyTypeInstance<>(ValueTypes.BOOLEAN, "aspect.aspecttypes.integratedtunnels.boolean.world.blockupdate"); @@ -1280,6 +1284,8 @@ public static final class World { new AspectPropertyTypeInstance<>(ValueTypes.DOUBLE, "aspect.aspecttypes.integratedtunnels.double.world.pitch", VALIDATOR_DOUBLE_ANGLE); public static final IAspectPropertyTypeInstance PROPERTY_ENTITYINDEX = new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integratedtunnels.integer.entityindex"); + public static final IAspectPropertyTypeInstance PROPERTY_ENTITYINVENTORY = + new AspectPropertyTypeInstance<>(ValueTypes.STRING, "aspect.aspecttypes.integratedtunnels.string.entityinventory", VALIDATOR_STRING_ENTITYINVENTORY); public static final class Energy { @@ -1456,6 +1462,8 @@ public static final class Item { static { PROPERTIES_RATESLOT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); PROPERTIES_RATESLOT.removeValue(PROP_PASSIVE_IO); + PROPERTIES_RATESLOT.setValue(World.PROPERTY_ENTITYINVENTORY, + ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); PROPERTIES_SLOT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); PROPERTIES_SLOT.removeValue(PROP_PASSIVE_IO); From b213672e81e3ce57daa71db8d24145dd2c7be11d Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 19:33:26 +0800 Subject: [PATCH 2/9] add EntityIItemTarget proxy classes --- .../integratedtunnels/IntegratedTunnels.java | 6 +- .../api/world/IEntityIItemTargetProxy.java | 33 ++++++++++ .../IEntityIItemTargetProxyRegistry.java | 38 +++++++++++ .../core/world/EntityIItemTargetProxies.java | 42 +++++++++++++ .../world/EntityIItemTargetProxyBase.java | 23 +++++++ ...tityIItemTargetProxyInventoryTypeBase.java | 33 ++++++++++ .../world/EntityIItemTargetProxyRegistry.java | 63 +++++++++++++++++++ .../world/EntityIItemTargetProxySided.java | 42 +++++++++++++ .../part/aspect/IItemTarget.java | 13 +++- 9 files changed, 291 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxy.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyBase.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyInventoryTypeBase.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyRegistry.java create mode 100644 src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxySided.java diff --git a/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java b/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java index 0c07a3066..84cdddd5a 100644 --- a/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java +++ b/src/main/java/org/cyclops/integratedtunnels/IntegratedTunnels.java @@ -17,11 +17,11 @@ import org.cyclops.cyclopscore.proxy.IClientProxy; import org.cyclops.cyclopscore.proxy.ICommonProxy; import org.cyclops.integrateddynamics.IntegratedDynamics; -import org.cyclops.integrateddynamics.api.part.aspect.IAspect; import org.cyclops.integrateddynamics.core.part.aspect.AspectRegistry; import org.cyclops.integrateddynamics.infobook.OnTheDynamicsOfIntegrationBook; import org.cyclops.integratedtunnels.api.world.IBlockBreakHandlerRegistry; import org.cyclops.integratedtunnels.api.world.IBlockPlaceHandlerRegistry; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxyRegistry; import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; import org.cyclops.integratedtunnels.capability.ingredient.TunnelIngredientComponentCapabilities; import org.cyclops.integratedtunnels.capability.network.FluidNetworkConfig; @@ -32,6 +32,8 @@ import org.cyclops.integratedtunnels.core.world.BlockBreakHandlers; import org.cyclops.integratedtunnels.core.world.BlockBreakPlaceRegistry; import org.cyclops.integratedtunnels.core.world.BlockPlaceHandlers; +import org.cyclops.integratedtunnels.core.world.EntityIItemTargetProxies; +import org.cyclops.integratedtunnels.core.world.EntityIItemTargetProxyRegistry; import org.cyclops.integratedtunnels.core.world.EntityInventoryTypeRegistry; import org.cyclops.integratedtunnels.core.world.EntityInventoryTypes; import org.cyclops.integratedtunnels.item.ItemDummyPickAxeConfig; @@ -61,6 +63,7 @@ public IntegratedTunnels() { getRegistryManager().addRegistry(IBlockBreakHandlerRegistry.class, BlockBreakHandlerRegistry.getInstance()); getRegistryManager().addRegistry(IBlockPlaceHandlerRegistry.class, BlockBreakPlaceRegistry.getInstance()); getRegistryManager().addRegistry(IEntityInventoryTypeRegistry.class, EntityInventoryTypeRegistry.getInstance()); + getRegistryManager().addRegistry(IEntityIItemTargetProxyRegistry.class, EntityIItemTargetProxyRegistry.getInstance()); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onRegistriesCreate); } @@ -72,6 +75,7 @@ public void onRegistriesCreate(RegistryEvent.NewRegistry event) { BlockBreakHandlers.load(); BlockPlaceHandlers.load(); EntityInventoryTypes.load(); + EntityIItemTargetProxies.load(); } @Override diff --git a/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxy.java b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxy.java new file mode 100644 index 000000000..2bff736e3 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxy.java @@ -0,0 +1,33 @@ +package org.cyclops.integratedtunnels.api.world; + +import javax.annotation.Nullable; + +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.IItemTarget; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * Proxy that can produce an IItemTarget for an Entity. + * @author met4000 + */ +public interface IEntityIItemTargetProxy { + + public boolean shouldApply(ITunnelTransfer transfer, INetwork network, + @Nullable Entity entity, Direction side, int slot, + IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, @Nullable PartStateRoundRobin partState); + + public IItemTarget evaluate(ITunnelTransfer transfer, INetwork network, + @Nullable Entity entity, Direction side, int slot, + IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, @Nullable PartStateRoundRobin partState); + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java new file mode 100644 index 000000000..394d4fbf7 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java @@ -0,0 +1,38 @@ +package org.cyclops.integratedtunnels.api.world; + +import java.util.Collection; + +import javax.annotation.Nullable; + +import org.cyclops.cyclopscore.init.IRegistry; +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * A registry for entity IItemTarget proxies. + * @author met4000 + */ +public interface IEntityIItemTargetProxyRegistry extends IRegistry { + + /** + * Multiple handlers may exist that return `true` for #shouldApply; the first one found should be used. + */ + public IEntityIItemTargetProxy register(IEntityIItemTargetProxy proxy); + + public Collection getProxies(); + + @Nullable + public IEntityIItemTargetProxy getHandler(ITunnelTransfer transfer, INetwork network, @Nullable Entity entity, + Direction side, int slot, IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, @Nullable PartStateRoundRobin partState); + +} + diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java new file mode 100644 index 000000000..697ab2e68 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java @@ -0,0 +1,42 @@ +package org.cyclops.integratedtunnels.core.world; + +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.IntegratedTunnels; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxyRegistry; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.IItemTarget; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; +import org.cyclops.integratedtunnels.part.aspect.ItemTargetCapabilityProvider; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * Collection of Entity IItemTarget proxies. + * @author met4000 + */ +public class EntityIItemTargetProxies { + + public static final IEntityIItemTargetProxyRegistry REGISTRY = IntegratedTunnels._instance.getRegistryManager() + .getRegistry(IEntityIItemTargetProxyRegistry.class); + + public static void load() { + REGISTRY.register(new EntityIItemTargetProxyInventoryTypeBase(EntityInventoryTypes.SIDED) { + @Override + public IItemTarget evaluate(ITunnelTransfer transfer, INetwork network, Entity entity, Direction side, int slot, + IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, PartStateRoundRobin partState) { + return new ItemTargetCapabilityProvider(transfer, network, entity, side, + slot, itemStackMatcher, partTarget, properties, partState); + } + }); + + REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.ARMOR, EntityInventoryTypes.ARMOR_SIDE)); + REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.INVENTORY, EntityInventoryTypes.INVENTORY_SIDE)); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyBase.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyBase.java new file mode 100644 index 000000000..9cd07b819 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyBase.java @@ -0,0 +1,23 @@ +package org.cyclops.integratedtunnels.core.world; + +import org.cyclops.integratedtunnels.IntegratedTunnels; +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxy; +import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; + +/** + * Registers the IEntityInventoryType with the EntityInventoryTypeRegistry. + * @author met4000 + */ +public abstract class EntityIItemTargetProxyBase implements IEntityIItemTargetProxy { + + private static final IEntityInventoryTypeRegistry REGISTRY = IntegratedTunnels._instance.getRegistryManager() + .getRegistry(IEntityInventoryTypeRegistry.class); + + protected final EntityInventoryTypeBase inventoryType; + + public EntityIItemTargetProxyBase(EntityInventoryTypeBase inventoryType) { + this.inventoryType = REGISTRY.register(inventoryType); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyInventoryTypeBase.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyInventoryTypeBase.java new file mode 100644 index 000000000..50036ab58 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyInventoryTypeBase.java @@ -0,0 +1,33 @@ +package org.cyclops.integratedtunnels.core.world; + +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; +import org.cyclops.integratedtunnels.part.aspect.TunnelAspectWriteBuilders.World; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * An IItemTarget proxy to access a sided entity. + * @author met4000 + */ +public abstract class EntityIItemTargetProxyInventoryTypeBase extends EntityIItemTargetProxyBase { + + public EntityIItemTargetProxyInventoryTypeBase(EntityInventoryTypeBase inventoryType) { + super(inventoryType); + } + + @Override + public boolean shouldApply(ITunnelTransfer transfer, INetwork network, Entity entity, Direction side, int slot, + IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, PartStateRoundRobin partState) { + return inventoryType.getName().equals(properties.getValue(World.PROPERTY_ENTITYINVENTORY).getRawValue()); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyRegistry.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyRegistry.java new file mode 100644 index 000000000..17a72f120 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxyRegistry.java @@ -0,0 +1,63 @@ +package org.cyclops.integratedtunnels.core.world; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; + +import javax.annotation.Nullable; + +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxy; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxyRegistry; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * Implementation of {@link IEntityIItemTargetProxyRegistry} + * @author met4000 + */ +public class EntityIItemTargetProxyRegistry implements IEntityIItemTargetProxyRegistry { + + private static EntityIItemTargetProxyRegistry INSTANCE = new EntityIItemTargetProxyRegistry(); + + // linked list used for constant append time + private final Collection proxies = new LinkedList(); + + private EntityIItemTargetProxyRegistry() {} + + public static EntityIItemTargetProxyRegistry getInstance() { + return INSTANCE; + } + + @Override + public IEntityIItemTargetProxy register(IEntityIItemTargetProxy proxy) { + proxies.add(proxy); + return proxy; + } + + @Override + public Collection getProxies() { + return Collections.unmodifiableCollection(proxies); + } + + @Nullable + @Override + public IEntityIItemTargetProxy getHandler(ITunnelTransfer transfer, INetwork network, @Nullable Entity entity, + Direction side, int slot, IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, @Nullable PartStateRoundRobin partState) { + for (IEntityIItemTargetProxy proxy : getProxies()) { + if (proxy.shouldApply(transfer, network, entity, side, slot, itemStackMatcher, partTarget, properties, partState)) { + return proxy; + } + } + return null; + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxySided.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxySided.java new file mode 100644 index 000000000..f696a8dc5 --- /dev/null +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxySided.java @@ -0,0 +1,42 @@ +package org.cyclops.integratedtunnels.core.world; + +import org.cyclops.integrateddynamics.api.network.INetwork; +import org.cyclops.integrateddynamics.api.part.PartTarget; +import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; +import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; +import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; +import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.part.aspect.IItemTarget; +import org.cyclops.integratedtunnels.part.aspect.ITunnelTransfer; +import org.cyclops.integratedtunnels.part.aspect.ItemTargetCapabilityProvider; +import org.cyclops.integratedtunnels.part.aspect.TunnelAspectWriteBuilders.World; + +import lombok.NonNull; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; + +/** + * An IItemTarget proxy to access a sided entity. + * Uses the specified side when interacting with the capability provider. + * @author met4000 + */ +public class EntityIItemTargetProxySided extends EntityIItemTargetProxyInventoryTypeBase { + + @NonNull + protected final Direction side; + + public EntityIItemTargetProxySided(EntityInventoryTypeBase inventoryType, Direction side) { + super(inventoryType); + this.side = side; + } + + @Override + public IItemTarget evaluate(ITunnelTransfer transfer, INetwork network, Entity entity, Direction side, int slot, + IngredientPredicate itemStackMatcher, PartTarget partTarget, + IAspectProperties properties, PartStateRoundRobin partState) { + return new ItemTargetCapabilityProvider(transfer, network, entity, this.side, + slot, itemStackMatcher, partTarget, properties, partState); + } + +} diff --git a/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java b/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java index 10752f838..67f109f75 100644 --- a/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java +++ b/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java @@ -3,14 +3,18 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; + import org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage; import org.cyclops.integrateddynamics.api.network.INetwork; import org.cyclops.integrateddynamics.api.part.PartPos; import org.cyclops.integrateddynamics.api.part.PartTarget; import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; import org.cyclops.integratedtunnels.api.network.IItemNetwork; +import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxy; import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; +import org.cyclops.integratedtunnels.core.world.EntityIItemTargetProxies; import javax.annotation.Nullable; @@ -51,7 +55,14 @@ public static IItemTarget ofEntity(ITunnelTransfer transfer, PartTarget partTarg PartPos target = partTarget.getTarget(); INetwork network = IChanneledTarget.getNetworkChecked(center); PartStateRoundRobin partState = IChanneledTarget.getPartState(center); - return new ItemTargetCapabilityProvider(transfer, network, entity, target.getSide(), + + IEntityIItemTargetProxy proxy = EntityIItemTargetProxies.REGISTRY.getHandler(transfer, network, entity, + target.getSide(), slot, itemStackMatcher, partTarget, properties, partState); + if (proxy == null) { + return null; // is there a special null IItemTarget? + } + + return proxy.evaluate(transfer, network, entity, target.getSide(), slot, itemStackMatcher, partTarget, properties, partState); } From 15c854f996bd6a6b95bd7be4b62fd989684df8bb Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 19:45:11 +0800 Subject: [PATCH 3/9] Fix armor and inventory siding --- .../integratedtunnels/core/world/EntityInventoryTypes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java index eecdbcde6..916cae7b8 100644 --- a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java @@ -21,11 +21,11 @@ public class EntityInventoryTypes { // the armor inventory of an entity public static final EntityInventoryTypeBase ARMOR = new EntityInventoryType("armor"); - public static final Direction ARMOR_SIDE = Direction.UP; // TODO verify + public static final Direction ARMOR_SIDE = Direction.NORTH; // the main inventory of an entity public static final EntityInventoryTypeBase INVENTORY = new EntityInventoryType("inventory"); - public static final Direction INVENTORY_SIDE = Direction.NORTH; // TODO verify + public static final Direction INVENTORY_SIDE = Direction.UP; // TODO: ENDERINVENTORY, for players ? From b4449cc203654f6e8b5d14673c8deb24bbe09247 Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 20:01:32 +0800 Subject: [PATCH 4/9] Add eclipse launch files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 883065680..a8444aea7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ repo/* *.ipr *.iws out/* +run*.launch keystore.jks # Ignore mac-specific file(s) From cc076f4a0b50ae708ae1da04223f0ff584f8dc64 Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 20:10:23 +0800 Subject: [PATCH 5/9] fix duplicate property crash --- .../part/aspect/TunnelAspectWriteBuilders.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java b/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java index c135e8723..dcaad7388 100644 --- a/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java +++ b/src/main/java/org/cyclops/integratedtunnels/part/aspect/TunnelAspectWriteBuilders.java @@ -1285,7 +1285,7 @@ public static final class World { public static final IAspectPropertyTypeInstance PROPERTY_ENTITYINDEX = new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integratedtunnels.integer.entityindex"); public static final IAspectPropertyTypeInstance PROPERTY_ENTITYINVENTORY = - new AspectPropertyTypeInstance<>(ValueTypes.STRING, "aspect.aspecttypes.integratedtunnels.string.entityinventory", VALIDATOR_STRING_ENTITYINVENTORY); + new AspectPropertyTypeInstance<>(ValueTypes.STRING, "aspect.aspecttypes.integratedtunnels.string.world.entityinventory", VALIDATOR_STRING_ENTITYINVENTORY); public static final class Energy { @@ -1454,6 +1454,7 @@ public static final class Item { PROPERTIES_ENTITYITEM_PLACELIST.setValue(PROP_BLACKLIST, ValueTypeBoolean.ValueBoolean.of(false)); } + public static final IAspectProperties PROPERTIES_RATESLOT = TunnelAspectWriteBuilders.Item.PROPERTIES_RATESLOT.clone(); public static final IAspectProperties PROPERTIES_SLOT = TunnelAspectWriteBuilders.Item.PROPERTIES_SLOT.clone(); public static final IAspectProperties PROPERTIES_RATESLOTCHECKS = TunnelAspectWriteBuilders.Item.PROPERTIES_RATESLOTCHECKS.clone(); @@ -1461,23 +1462,31 @@ public static final class Item { public static final IAspectProperties PROPERTIES_NBT = TunnelAspectWriteBuilders.Item.PROPERTIES_NBT.clone(); static { PROPERTIES_RATESLOT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); - PROPERTIES_RATESLOT.removeValue(PROP_PASSIVE_IO); PROPERTIES_RATESLOT.setValue(World.PROPERTY_ENTITYINVENTORY, ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); + PROPERTIES_RATESLOT.removeValue(PROP_PASSIVE_IO); PROPERTIES_SLOT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); + PROPERTIES_SLOT.setValue(World.PROPERTY_ENTITYINVENTORY, + ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); PROPERTIES_SLOT.removeValue(PROP_PASSIVE_IO); PROPERTIES_RATESLOTCHECKS.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); + PROPERTIES_RATESLOTCHECKS.setValue(World.PROPERTY_ENTITYINVENTORY, + ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); PROPERTIES_RATESLOTCHECKS.setValue(PROP_BLACKLIST, ValueTypeBoolean.ValueBoolean.of(false)); PROPERTIES_RATESLOTCHECKS.setValue(PROP_EMPTYISANY, ValueTypeBoolean.ValueBoolean.of(false)); PROPERTIES_RATESLOTCHECKS.removeValue(PROP_PASSIVE_IO); PROPERTIES_RATESLOTCHECKSCRAFT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); + PROPERTIES_RATESLOTCHECKSCRAFT.setValue(World.PROPERTY_ENTITYINVENTORY, + ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); PROPERTIES_RATESLOTCHECKSCRAFT.setValue(PROP_BLACKLIST, ValueTypeBoolean.ValueBoolean.of(false)); PROPERTIES_RATESLOTCHECKSCRAFT.removeValue(PROP_PASSIVE_IO); PROPERTIES_NBT.setValue(World.PROPERTY_ENTITYINDEX, ValueTypeInteger.ValueInteger.of(0)); + PROPERTIES_NBT.setValue(World.PROPERTY_ENTITYINVENTORY, + ValueTypeString.ValueString.of(EntityInventoryTypes.SIDED.getName())); PROPERTIES_NBT.removeValue(PROP_PASSIVE_IO); } public static final IAspectProperties PROPERTIES_RATESLOTCHECKSLIST = PROPERTIES_RATESLOTCHECKS.clone(); From 27c71f04d1d04898c361f57908ccfad6760149ab Mon Sep 17 00:00:00 2001 From: met4000 Date: Fri, 29 Apr 2022 20:10:57 +0800 Subject: [PATCH 6/9] add English localisations --- src/main/resources/assets/integratedtunnels/lang/en_us.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/assets/integratedtunnels/lang/en_us.json b/src/main/resources/assets/integratedtunnels/lang/en_us.json index ccb133041..18be6ee15 100644 --- a/src/main/resources/assets/integratedtunnels/lang/en_us.json +++ b/src/main/resources/assets/integratedtunnels/lang/en_us.json @@ -148,6 +148,8 @@ "aspect.aspecttypes.integratedtunnels.boolean.player.rightclick": "Right Click", "aspect.aspecttypes.integratedtunnels.integer.entityindex": "Entity Index", "aspect.aspecttypes.integratedtunnels.integer.entityindex.info": "The n-th entity that will be picked. -1 will always pick a random entity.", + "aspect.aspecttypes.integratedtunnels.string.world.entityinventory": "Entity Inventory", + "aspect.aspecttypes.integratedtunnels.string.world.entityinventory.info": "The inventory to use of the entity.", "aspect.aspecttypes.integratedtunnels.boolean.player.continuousclick": "Continuous Click", "aspect.aspecttypes.integratedtunnels.boolean.player.continuousclick.info": "If a continuous click must be simulated, otherwise each click takes one tick.", "aspect.aspecttypes.integratedtunnels.boolean.blacklist": "Blacklist", From 01a330abedfa13b16e33757fc37992d29da0a349 Mon Sep 17 00:00:00 2001 From: met4000 Date: Sat, 30 Apr 2022 03:19:47 +0800 Subject: [PATCH 7/9] Entity Inventory value description (temp) workaround --- .../org/cyclops/integratedtunnels/part/aspect/IItemTarget.java | 1 - src/main/resources/assets/integratedtunnels/lang/en_us.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java b/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java index 67f109f75..936f91964 100644 --- a/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java +++ b/src/main/java/org/cyclops/integratedtunnels/part/aspect/IItemTarget.java @@ -3,7 +3,6 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; import org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage; import org.cyclops.integrateddynamics.api.network.INetwork; diff --git a/src/main/resources/assets/integratedtunnels/lang/en_us.json b/src/main/resources/assets/integratedtunnels/lang/en_us.json index 18be6ee15..6f1bc11d1 100644 --- a/src/main/resources/assets/integratedtunnels/lang/en_us.json +++ b/src/main/resources/assets/integratedtunnels/lang/en_us.json @@ -149,7 +149,7 @@ "aspect.aspecttypes.integratedtunnels.integer.entityindex": "Entity Index", "aspect.aspecttypes.integratedtunnels.integer.entityindex.info": "The n-th entity that will be picked. -1 will always pick a random entity.", "aspect.aspecttypes.integratedtunnels.string.world.entityinventory": "Entity Inventory", - "aspect.aspecttypes.integratedtunnels.string.world.entityinventory.info": "The inventory to use of the entity.", + "aspect.aspecttypes.integratedtunnels.string.world.entityinventory.info": "The inventory to use of the entity e.g. sided, inventory, or armor.", "aspect.aspecttypes.integratedtunnels.boolean.player.continuousclick": "Continuous Click", "aspect.aspecttypes.integratedtunnels.boolean.player.continuousclick.info": "If a continuous click must be simulated, otherwise each click takes one tick.", "aspect.aspecttypes.integratedtunnels.boolean.blacklist": "Blacklist", From b41d930c8cee31ca558f456a542d5b0f9b03da16 Mon Sep 17 00:00:00 2001 From: met4000 Date: Sat, 30 Apr 2022 03:55:34 +0800 Subject: [PATCH 8/9] move consts to reference class --- src/main/java/org/cyclops/integratedtunnels/Reference.java | 6 ++++++ .../core/world/EntityIItemTargetProxies.java | 5 +++-- .../integratedtunnels/core/world/EntityInventoryTypes.java | 4 ---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cyclops/integratedtunnels/Reference.java b/src/main/java/org/cyclops/integratedtunnels/Reference.java index 0a647333a..a48297b3a 100644 --- a/src/main/java/org/cyclops/integratedtunnels/Reference.java +++ b/src/main/java/org/cyclops/integratedtunnels/Reference.java @@ -2,6 +2,8 @@ import org.cyclops.cyclopscore.helper.MinecraftHelpers; +import net.minecraft.util.Direction; + /** * Class that can hold basic static things that are better not hard-coded * like mod details, texture paths, ID's... @@ -20,4 +22,8 @@ public class Reference { public static final String MOD_FORGE = "forge"; public static final String MOD_CYCLOPSCORE = "cyclopscore"; public static final String MOD_INTEGRATEDDYNAMICS = "integrateddynamics"; + + // Entity Inventory Sidings + public static final Direction ENTITY_ARMOR_SIDE = Direction.NORTH; + public static final Direction ENTITY_INVENTORY_SIDE = Direction.UP; } diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java index 697ab2e68..ba0534977 100644 --- a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityIItemTargetProxies.java @@ -4,6 +4,7 @@ import org.cyclops.integrateddynamics.api.part.PartTarget; import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties; import org.cyclops.integratedtunnels.IntegratedTunnels; +import org.cyclops.integratedtunnels.Reference; import org.cyclops.integratedtunnels.api.world.IEntityIItemTargetProxyRegistry; import org.cyclops.integratedtunnels.core.part.PartStateRoundRobin; import org.cyclops.integratedtunnels.core.predicate.IngredientPredicate; @@ -35,8 +36,8 @@ public IItemTarget evaluate(ITunnelTransfer transfer, INetwork network, Entity e } }); - REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.ARMOR, EntityInventoryTypes.ARMOR_SIDE)); - REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.INVENTORY, EntityInventoryTypes.INVENTORY_SIDE)); + REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.ARMOR, Reference.ENTITY_ARMOR_SIDE)); + REGISTRY.register(new EntityIItemTargetProxySided(EntityInventoryTypes.INVENTORY, Reference.ENTITY_INVENTORY_SIDE)); } } diff --git a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java index 916cae7b8..4cf729b20 100644 --- a/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java +++ b/src/main/java/org/cyclops/integratedtunnels/core/world/EntityInventoryTypes.java @@ -4,8 +4,6 @@ import org.cyclops.integratedtunnels.api.world.EntityInventoryTypeBase; import org.cyclops.integratedtunnels.api.world.IEntityInventoryTypeRegistry; -import net.minecraft.util.Direction; - /** * Collection of {@link EntityInventoryTypeBase}s. * @author met4000 @@ -21,11 +19,9 @@ public class EntityInventoryTypes { // the armor inventory of an entity public static final EntityInventoryTypeBase ARMOR = new EntityInventoryType("armor"); - public static final Direction ARMOR_SIDE = Direction.NORTH; // the main inventory of an entity public static final EntityInventoryTypeBase INVENTORY = new EntityInventoryType("inventory"); - public static final Direction INVENTORY_SIDE = Direction.UP; // TODO: ENDERINVENTORY, for players ? From b7e43cca1f9f42218e404b41ecbc4fa254068119 Mon Sep 17 00:00:00 2001 From: met4000 Date: Sat, 30 Apr 2022 03:56:25 +0800 Subject: [PATCH 9/9] fix jsdoc warnings --- .../api/world/IEntityIItemTargetProxyRegistry.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java index 394d4fbf7..3433f910c 100644 --- a/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java +++ b/src/main/java/org/cyclops/integratedtunnels/api/world/IEntityIItemTargetProxyRegistry.java @@ -22,9 +22,7 @@ */ public interface IEntityIItemTargetProxyRegistry extends IRegistry { - /** - * Multiple handlers may exist that return `true` for #shouldApply; the first one found should be used. - */ + // Multiple handlers may exist that return `true` for #shouldApply; the first one found should be used. public IEntityIItemTargetProxy register(IEntityIItemTargetProxy proxy); public Collection getProxies();