-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom variable facades to be defined in advancement codecs
- Loading branch information
1 parent
c643aa2
commit 6b91b36
Showing
9 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
26 changes: 26 additions & 0 deletions
26
...a/org/cyclops/integrateddynamics/core/evaluate/variable/VariableFacadePredicateTyped.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,26 @@ | ||
package org.cyclops.integrateddynamics.core.evaluate.variable; | ||
|
||
import org.cyclops.integrateddynamics.api.advancement.criterion.VariableFacadePredicate; | ||
import org.cyclops.integrateddynamics.api.item.IVariableFacade; | ||
import org.cyclops.integrateddynamics.api.item.IVariableFacadeHandler; | ||
|
||
/** | ||
* @author rubensworks | ||
*/ | ||
public class VariableFacadePredicateTyped extends VariableFacadePredicate<IVariableFacade> { | ||
private final IVariableFacadeHandler<?> handler; | ||
|
||
public VariableFacadePredicateTyped(IVariableFacadeHandler<?> handler) { | ||
super(IVariableFacade.class); | ||
this.handler = handler; | ||
} | ||
|
||
public IVariableFacadeHandler<?> getHandler() { | ||
return handler; | ||
} | ||
|
||
@Override | ||
protected boolean testTyped(IVariableFacade variableFacade) { | ||
return this.handler.isInstance(variableFacade); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...in/java/org/cyclops/integrateddynamics/core/evaluate/variable/VariablePredicateTyped.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,30 @@ | ||
package org.cyclops.integrateddynamics.core.evaluate.variable; | ||
|
||
import org.cyclops.integrateddynamics.api.advancement.criterion.ValuePredicate; | ||
import org.cyclops.integrateddynamics.api.advancement.criterion.VariablePredicate; | ||
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType; | ||
import org.cyclops.integrateddynamics.api.evaluate.variable.IVariable; | ||
import org.cyclops.integrateddynamics.api.item.IVariableFacadeHandler; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author rubensworks | ||
*/ | ||
public class VariablePredicateTyped extends VariablePredicate<IVariable<?>> { | ||
private final IVariableFacadeHandler<?> handler; | ||
|
||
public VariablePredicateTyped(IVariableFacadeHandler<?> handler, Optional<IValueType> valueType, Optional<ValuePredicate> valuePredicate) { | ||
super((Class) IVariable.class, valueType, valuePredicate); | ||
this.handler = handler; | ||
} | ||
|
||
public IVariableFacadeHandler<?> getHandler() { | ||
return handler; | ||
} | ||
|
||
@Override | ||
protected boolean testTyped(IVariable<?> variable) { | ||
return this.handler.isInstance(variable); | ||
} | ||
} |
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