Skip to content

Commit

Permalink
Match some more invalid mixins with their still existing targets. (#2459
Browse files Browse the repository at this point in the history
)
  • Loading branch information
i509VCB authored and Zidane committed Jan 4, 2020
1 parent 09910cf commit 0824c1a
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import net.minecraft.entity.MultiPartEntityPart;
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.boss.dragon.EnderDragonPartEntity;
import net.minecraft.entity.boss.dragon.phase.PhaseManager;
import net.minecraft.entity.item.EnderCrystalEntity;
import net.minecraft.world.end.DragonFightManager;
Expand All @@ -48,16 +48,16 @@
@Mixin(EnderDragonEntity.class)
public abstract class EnderDragonEntityMixin_API extends MobEntityMixin_API implements EnderDragon {

@Shadow public MultiPartEntityPart[] dragonPartArray;
@Shadow public EnderCrystalEntity healingEnderCrystal;
@Final @Shadow private DragonFightManager fightManager;
@Shadow public EnderDragonPartEntity[] dragonParts;
@Shadow public EnderCrystalEntity closestEnderCrystal;
@Shadow @Final private DragonFightManager fightManager;
@Shadow @Final private PhaseManager phaseManager;

@Override
public Set<EnderDragonPart> getParts() {
Builder<EnderDragonPart> builder = ImmutableSet.builder();

for (MultiPartEntityPart part : this.dragonPartArray) {
for (EnderDragonPartEntity part : this.dragonParts) {
builder.add((EnderDragonPart) part);
}

Expand All @@ -66,7 +66,7 @@ public Set<EnderDragonPart> getParts() {

@Override
public Optional<EnderCrystal> getHealingCrystal() {
return Optional.ofNullable((EnderCrystal) this.healingEnderCrystal);
return Optional.ofNullable((EnderCrystal) this.closestEnderCrystal);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.entity;
package org.spongepowered.common.mixin.api.mcp.entity.boss.dragon;

import net.minecraft.entity.IEntityMultiPart;
import net.minecraft.entity.MultiPartEntityPart;
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.boss.dragon.EnderDragonPartEntity;
import org.spongepowered.api.entity.living.monster.boss.dragon.EnderDragon;
import org.spongepowered.api.entity.living.monster.boss.dragon.EnderDragonPart;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.mixin.api.mcp.entity.EntityMixin_API;

@Mixin(MultiPartEntityPart.class)
public abstract class MultiPartEntityPartMixin_API extends EntityMixin_API implements EnderDragonPart {
@Mixin(EnderDragonPartEntity.class)
public abstract class EnderDragonPartEntityMixin_API extends EntityMixin_API implements EnderDragonPart {

@Shadow @Final public IEntityMultiPart parent;
@Shadow @Final public EnderDragonEntity dragon;

@Override
public EnderDragon getParent() {
return (EnderDragon) this.parent;
return (EnderDragon) this.dragon;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.block.properties;
package org.spongepowered.common.mixin.api.mcp.state;

import net.minecraft.block.properties.PropertyBool;
import net.minecraft.state.BooleanProperty;
import org.spongepowered.api.state.BooleanStateProperty;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = PropertyBool.class)
public abstract class PropertyBooleanMixin_API extends PropertyHelperMixin_API<Boolean> implements BooleanStateProperty {
@Mixin(value = BooleanProperty.class)
public abstract class BooleanPropertyMixin_API extends PropertyMixin_API<Boolean> implements BooleanStateProperty {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.block.properties;
package org.spongepowered.common.mixin.api.mcp.state;

import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.state.EnumProperty;
import org.spongepowered.api.state.EnumStateProperty;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = PropertyEnum.class)
public abstract class PropertyEnumMixin_API<E extends Enum<E>> extends PropertyHelperMixin_API<E> implements EnumStateProperty<E> {
@Mixin(value = EnumProperty.class)
public abstract class EnumPropertyMixin_API<E extends Enum<E>> extends PropertyMixin_API<E> implements EnumStateProperty<E> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.block.properties;
package org.spongepowered.common.mixin.api.mcp.state;

import net.minecraft.block.properties.IProperty;
import net.minecraft.state.IProperty;
import org.spongepowered.api.CatalogKey;
import org.spongepowered.api.state.StateProperty;
import org.spongepowered.api.util.Functional;
import org.spongepowered.asm.mixin.Implements;
Expand All @@ -48,33 +49,33 @@
* @param <T> The type of comparable.
*/
@Mixin(value = IProperty.class)
@Implements(@Interface(iface = StateProperty.class, prefix = "trait$"))
@Implements(@Interface(iface = StateProperty.class, prefix = "state$"))
public interface IPropertyMixin_API<T extends Comparable<T>> extends IProperty<T> {

default String trait$getId() {
default CatalogKey state$getKey() {
return BlockTypeRegistryModule.getInstance().getIdFor(this);
}

@Intrinsic
default String trait$getName() {
default String state$getName() {
return getName();
}

default Collection<T> trait$getPossibleValues() {
default Collection<T> state$getPossibleValues() {
return getAllowedValues();
}

@Intrinsic
default Class<T> trait$getValueClass() {
default Class<T> state$getValueClass() {
return getValueClass();
}

default Predicate<T> trait$getPredicate() {
default Predicate<T> state$getPredicate() {
return Functional.predicateIn(getAllowedValues());
}

@Intrinsic
default Optional<T> trait$parseValue(final String value) {
return parseValue(value).toJavaUtil();
default Optional<T> state$parseValue(final String value) {
return parseValue(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.block.properties;
package org.spongepowered.common.mixin.api.mcp.state;

import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.state.IntegerProperty;
import org.spongepowered.api.state.IntegerStateProperty;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = PropertyInteger.class)
public abstract class PropertyIntegerMixin_API extends PropertyHelperMixin_API<Integer> implements IntegerStateProperty {
@Mixin(value = IntegerProperty.class)
public abstract class IntegerPropertyMixin_API extends PropertyMixin_API<Integer> implements IntegerStateProperty {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.api.mcp.block.properties;
package org.spongepowered.common.mixin.api.mcp.state;

import net.minecraft.block.properties.AbstractProperty;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import org.spongepowered.api.state.StateProperty;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.common.registry.provider.BlockPropertyIdProvider;
Expand All @@ -40,16 +40,16 @@
*
* @param <T> The type of comparable
*/
@Mixin(value = AbstractProperty.class)
public abstract class PropertyHelperMixin_API<T extends Comparable<T>> implements StateProperty<T> {
@Mixin(value = Property.class)
public abstract class PropertyMixin_API<T extends Comparable<T>> implements StateProperty<T> {

@Nullable private String api$IdString = null;

@SuppressWarnings("rawtypes")
@Override
public String getId() {
if (this.api$IdString == null) {
this.api$IdString = BlockPropertyIdProvider.getIdFor((IProperty) this);
this.api$IdString = BlockPropertyIdProvider.getIdFor((IProperty<T>) this);
}
return this.api$IdString;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.core.block.properties;
package org.spongepowered.common.mixin.core.state;

import com.google.common.collect.ImmutableSet;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.state.BooleanProperty;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

import javax.annotation.Nullable;

@Mixin(value = PropertyBool.class)
public abstract class PropertyBooleanMixin extends PropertyHelperMixin<Boolean> {
@Mixin(value = BooleanProperty.class)
public abstract class BooleanPropertyMixin extends PropertyMixin<Boolean> {

@Shadow @Final private ImmutableSet<Boolean> allowedValues;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.core.block.properties;
package org.spongepowered.common.mixin.core.state;

import com.google.common.collect.ImmutableSet;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.state.EnumProperty;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand All @@ -35,8 +35,8 @@

import javax.annotation.Nullable;

@Mixin(value = PropertyEnum.class)
public abstract class PropertyEnumMixin<E extends Enum<E>> extends PropertyHelperMixin<E> {
@Mixin(value = EnumProperty.class)
public abstract class EnumPropertyMixin<E extends Enum<E>> extends PropertyMixin<E> {

@Shadow @Final private ImmutableSet<E> allowedValues;
@Shadow @Final private Map<String, E> nameToValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.core.block.properties;
package org.spongepowered.common.mixin.core.state;

import com.google.common.collect.ImmutableSet;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.state.IntegerProperty;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

import javax.annotation.Nullable;

@Mixin(value = PropertyInteger.class)
public abstract class PropertyIntegerMixin extends PropertyHelperMixin<Integer> {
@Mixin(value = IntegerProperty.class)
public abstract class IntegerPropertyMixin extends PropertyMixin<Integer> {

@Shadow @Final private ImmutableSet<Integer> allowedValues;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.invalid.core.block.properties;
package org.spongepowered.common.mixin.core.state;

import net.minecraft.block.properties.AbstractProperty;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.Property;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand All @@ -39,8 +38,8 @@
*
* @param <T> The type of comparable
*/
@Mixin(value = AbstractProperty.class)
public abstract class PropertyHelperMixin<T extends Comparable<T>> {
@Mixin(value = Property.class)
public abstract class PropertyMixin<T extends Comparable<T>> {

@Shadow @Final private Class<T> valueClass;
@Shadow @Final private String name;
Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/resources/mixins.common.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"mcp.entity.ai.goal.RandomWalkingGoalMixin_API",
"mcp.entity.ai.goal.LookAtGoalMixin_API",
"mcp.entity.boss.dragon.EnderDragonEntityMixin_API",
"mcp.entity.boss.dragon.EnderDragonPartEntityMixin_API",
"mcp.entity.boss.WitherEntityMixin_API",
"mcp.entity.boss.dragon.phase.IPhaseMixin_API",
"mcp.entity.boss.dragon.phase.PhaseTypeMixin_API",
Expand Down Expand Up @@ -177,6 +178,11 @@
"mcp.server.management.BanEntryMixin_API",
"mcp.server.management.UserListEntryMixin_API",
"mcp.server.management.IPBanEntryMixin_API",
"mcp.state.BooleanPropertyMixin_API",
"mcp.state.EnumPropertyMixin_API",
"mcp.state.IntegerPropertyMixin_API",
"mcp.state.IPropertyMixin_API",
"mcp.state.PropertyMixin_API",
"mcp.state.properties.DoorHingeSideMixin_API",
"mcp.stats.StatMixin_API",
"mcp.tileentity.BannerPatternMixin_API",
Expand Down
Loading

0 comments on commit 0824c1a

Please sign in to comment.