-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slowly working on supporting capabilities a little better
- Loading branch information
Showing
13 changed files
with
119 additions
and
109 deletions.
There are no files selected for viewing
14 changes: 10 additions & 4 deletions
14
patches/net/minecraftforge/items/ItemHandlerHelper.java.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
--- ItemHandlerHelper.java | ||
+++ ItemHandlerHelper.java | ||
@@ -42,5 +42,5 @@ | ||
@@ -13,4 +13,5 @@ | ||
import net.minecraft.util.Mth; | ||
import net.minecraft.world.level.Level; | ||
+import net.minecraftforge.common.capabilities.CapabilityProvider; | ||
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; | ||
import org.jetbrains.annotations.NotNull; | ||
@@ -42,5 +43,5 @@ | ||
return false; | ||
|
||
- return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b); | ||
+ return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b.getWorkaround()); | ||
+ return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible((CapabilityProvider<ItemStack>) (Object) b); | ||
} | ||
|
||
@@ -67,5 +67,5 @@ | ||
@@ -67,5 +68,5 @@ | ||
return false; | ||
|
||
- return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b); | ||
+ return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b.getWorkaround()); | ||
+ return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible((CapabilityProvider<ItemStack>) (Object) b); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/xyz/bluspring/kilt/helpers/mixin/AnnotationValueVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package xyz.bluspring.kilt.helpers.mixin; | ||
|
||
import org.objectweb.asm.AnnotationVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class AnnotationValueVisitor extends AnnotationVisitor { | ||
public AnnotationValueVisitor() { | ||
super(Opcodes.ASM9); | ||
} | ||
|
||
public final Map<String, Object> values = new HashMap<>(); | ||
|
||
@Override | ||
public void visit(String name, Object value) { | ||
super.visit(name, value); | ||
this.values.put(name, value); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/xyz/bluspring/kilt/helpers/mixin/Extends.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package xyz.bluspring.kilt.helpers.mixin; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Extends { | ||
Class<?> value(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
...in/java/xyz/bluspring/kilt/injections/capabilities/BlockEntityCapabilityProviderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
package xyz.bluspring.kilt.injections.capabilities; | ||
|
||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraftforge.common.capabilities.ICapabilityProviderImpl; | ||
import xyz.bluspring.kilt.workarounds.CapabilityProviderWorkaround; | ||
|
||
public interface BlockEntityCapabilityProviderImpl extends ICapabilityProviderImpl<BlockEntity> { | ||
default CapabilityProviderWorkaround<BlockEntity> getWorkaround() { | ||
throw new IllegalStateException("should be overridden by mixin"); | ||
} | ||
public interface BlockEntityCapabilityProviderImpl extends ICapabilityProviderImplWithWorkaround<BlockEntity> { | ||
} |
5 changes: 1 addition & 4 deletions
5
src/main/java/xyz/bluspring/kilt/injections/capabilities/EntityCapabilityProviderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
package xyz.bluspring.kilt.injections.capabilities; | ||
|
||
import net.minecraft.world.entity.Entity; | ||
import net.minecraftforge.common.capabilities.ICapabilityProviderImpl; | ||
import xyz.bluspring.kilt.workarounds.CapabilityProviderWorkaround; | ||
|
||
public interface EntityCapabilityProviderImpl extends ICapabilityProviderImpl<Entity> { | ||
CapabilityProviderWorkaround<Entity> getWorkaround(); | ||
public interface EntityCapabilityProviderImpl extends ICapabilityProviderImplWithWorkaround<Entity> { | ||
} |
10 changes: 10 additions & 0 deletions
10
...ava/xyz/bluspring/kilt/injections/capabilities/ICapabilityProviderImplWithWorkaround.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package xyz.bluspring.kilt.injections.capabilities; | ||
|
||
import net.minecraftforge.common.capabilities.ICapabilityProviderImpl; | ||
import xyz.bluspring.kilt.workarounds.CapabilityProviderWorkaround; | ||
|
||
public interface ICapabilityProviderImplWithWorkaround<B extends ICapabilityProviderImpl<B>> extends ICapabilityProviderImpl<B> { | ||
default CapabilityProviderWorkaround<B> getWorkaround() { | ||
throw new IllegalStateException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
src/main/java/xyz/bluspring/kilt/injections/capabilities/LevelCapabilityProviderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
package xyz.bluspring.kilt.injections.capabilities; | ||
|
||
import net.minecraft.world.level.Level; | ||
import net.minecraftforge.common.capabilities.ICapabilityProviderImpl; | ||
import xyz.bluspring.kilt.workarounds.CapabilityProviderWorkaround; | ||
|
||
public interface LevelCapabilityProviderImpl extends ICapabilityProviderImpl<Level> { | ||
CapabilityProviderWorkaround<Level> getWorkaround(); | ||
public interface LevelCapabilityProviderImpl extends ICapabilityProviderImplWithWorkaround<Level> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters