Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add PushReactions #4024

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 39 files
+13 −0 src/main/java/org/spongepowered/api/data/Keys.java
+1 −1 src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java
+1 −1 src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java
+1 −1 src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java
+1 −1 src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java
+1 −1 src/main/java/org/spongepowered/api/data/type/ComparatorMode.java
+1 −1 src/main/java/org/spongepowered/api/data/type/DoorHinge.java
+1 −1 src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java
+1 −1 src/main/java/org/spongepowered/api/data/type/InstrumentType.java
+1 −1 src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java
+1 −1 src/main/java/org/spongepowered/api/data/type/PistonType.java
+1 −1 src/main/java/org/spongepowered/api/data/type/PortionType.java
+32 −0 src/main/java/org/spongepowered/api/data/type/PushReaction.java
+52 −0 src/main/java/org/spongepowered/api/data/type/PushReactions.java
+1 −1 src/main/java/org/spongepowered/api/data/type/RailDirection.java
+1 −1 src/main/java/org/spongepowered/api/data/type/SculkSensorState.java
+1 −1 src/main/java/org/spongepowered/api/data/type/SlabPortion.java
+1 −1 src/main/java/org/spongepowered/api/data/type/StairShape.java
+37 −0 src/main/java/org/spongepowered/api/data/type/StringRepresentable.java
+1 −1 src/main/java/org/spongepowered/api/data/type/StructureMode.java
+1 −1 src/main/java/org/spongepowered/api/data/type/Tilt.java
+32 −0 src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java
+56 −0 src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java
+32 −0 src/main/java/org/spongepowered/api/data/type/VaultState.java
+49 −0 src/main/java/org/spongepowered/api/data/type/VaultStates.java
+1 −1 src/main/java/org/spongepowered/api/data/type/WallConnectionState.java
+1 −1 src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java
+12 −1 src/main/java/org/spongepowered/api/entity/EntityTypes.java
+28 −0 src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java
+28 −0 src/main/java/org/spongepowered/api/entity/living/animal/Armadillo.java
+28 −0 src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Bogged.java
+28 −0 src/main/java/org/spongepowered/api/entity/projectile/windcharge/BreezeWindCharge.java
+2 −2 src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindCharge.java
+30 −0 src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java
+9 −0 src/main/java/org/spongepowered/api/registry/RegistryTypes.java
+4 −2 src/main/java/org/spongepowered/api/state/EnumStateProperties.java
+4 −3 src/main/java/org/spongepowered/api/state/EnumStateProperty.java
+8 −1 src/main/java/org/spongepowered/api/util/Axis.java
+7 −1 src/main/java/org/spongepowered/api/util/Direction.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public static void register(final DataProviderRegistrator registrator) {
return MatterTypes.SOLID.get();
}
})
.create(Keys.BURNABLE)
.get(BlockBehaviour.BlockStateBase::ignitedByLava)
// TODO state above
.create(Keys.REPRESENTED_INSTRUMENT)
.get(h -> (InstrumentType) (Object) h.instrument());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import net.minecraft.world.level.block.state.properties.Property;
import org.spongepowered.api.data.BlockStateKeys;
import org.spongepowered.api.data.Key;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.PushReaction;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.state.StateProperty;
import org.spongepowered.common.data.provider.DataProviderRegistrator;
Expand Down Expand Up @@ -149,6 +151,9 @@ public static void register(final DataProviderRegistrator registrator) {
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST, BlockStateProperties.WEST);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST_REDSTONE, BlockStateProperties.WEST_REDSTONE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST_WALL, BlockStateProperties.WEST_WALL);
registrator.asImmutable(BlockState.class)
.create(Keys.PUSH_REACTION)
.get(h -> (PushReaction) (Object) h.getPistonPushReaction());
}

// @formatter:off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.data.DataTransactionResult;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.PushReaction;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.util.Ticks;
import org.spongepowered.common.accessor.world.entity.EntityAccessor;
Expand Down Expand Up @@ -189,6 +190,8 @@ public static void register(final DataProviderRegistrator registrator) {
h.ejectPassengers();
v.forEach(v1 -> ((Entity) v1).startRiding(h, true));
})
.create(Keys.PUSH_REACTION)
.get(h -> (PushReaction) (Object) h.getPistonPushReaction())
.create(Keys.REMAINING_AIR)
.get(h -> Math.max(0, h.getAirSupply()))
.setAnd((h, v) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import net.minecraft.world.level.biome.BiomeSpecialEffects;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.entity.vault.VaultState;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BambooLeaves;
import net.minecraft.world.level.block.state.properties.BellAttachType;
Expand All @@ -86,6 +88,7 @@
import net.minecraft.world.level.block.state.properties.WallSide;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.scores.DisplaySlot;
import net.minecraft.world.scores.Team;
import net.minecraft.world.scores.criteria.ObjectiveCriteria;
Expand Down Expand Up @@ -237,6 +240,9 @@ private void loadEnumRegistries() {
this.automaticSerializedName(RegistryTypes.TEXT_ALIGNMENT, Display.TextDisplay.Align.values());
this.automaticName(RegistryTypes.LIGHT_TYPE, LightLayer.values());
this.naming(RegistryTypes.DISPLAY_SLOT, DisplaySlot.values(), d -> d.getSerializedName().replace(".", "_"));
this.automaticName(RegistryTypes.PUSH_REACTION, PushReaction.values());
this.automaticSerializedName(RegistryTypes.TRIAL_SPAWNER_STATE, TrialSpawnerState.values());
this.automaticSerializedName(RegistryTypes.VAULT_STATE, VaultState.values());
}

private static RegistryLoader<Criterion> criterion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
package org.spongepowered.common.mixin.api.minecraft.state;

import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.spongepowered.api.data.type.StringRepresentable;
import org.spongepowered.api.state.EnumStateProperty;
import org.spongepowered.asm.mixin.Mixin;

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.api.minecraft.util;

import net.minecraft.util.StringRepresentable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(StringRepresentable.class)
public interface StringRepresentableMixin_API extends org.spongepowered.api.data.type.StringRepresentable {

@Shadow String shadow$getSerializedName();

@Override
default String serializationString() {
return this.shadow$getSerializedName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
package org.spongepowered.common.mixin.api.minecraft.world.entity.projectile;

import org.spongepowered.api.entity.projectile.WindCharge;
import org.spongepowered.api.entity.projectile.windcharge.WindCharge;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(net.minecraft.world.entity.projectile.windcharge.WindCharge.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.api.minecraft.world.level.block.entity.trialspawner;

import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(TrialSpawnerState.class)
public abstract class TrialSpawnerStateMixin_API implements org.spongepowered.api.data.type.TrialSpawnerState {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.api.minecraft.world.level.block.entity.vault;

import net.minecraft.world.level.block.entity.vault.VaultState;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(VaultState.class)
public abstract class VaultStateMixin_API implements org.spongepowered.api.data.type.VaultState {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.api.minecraft.world.level.material;

import org.spongepowered.api.data.type.PushReaction;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(net.minecraft.world.level.material.PushReaction.class)
public class PushReactionMixin_API implements PushReaction {

}
Loading
Loading