Skip to content

Commit

Permalink
feat(minecraft): update to 25w08a
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed Feb 23, 2025
1 parent 3b096d5 commit 569507e
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 37 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json
superClassChanges=common.superclasschange

minecraftVersion=25w07a
minecraftVersion=25w08a
recommendedVersion=0-SNAPSHOT

org.gradle.dependency.verification.console=verbose
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.accessor.world.entity.animal;
package org.spongepowered.common.accessor.world.entity.animal.wolf;

import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.world.entity.animal.Wolf;
import net.minecraft.world.entity.animal.wolf.Wolf;
import net.minecraft.world.item.DyeColor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
Expand Down
2 changes: 1 addition & 1 deletion src/accessors/resources/mixins.sponge.accessors.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"world.entity.animal.RabbitAccessor",
"world.entity.animal.TropicalFishAccessor",
"world.entity.animal.TurtleAccessor",
"world.entity.animal.WolfAccessor",
"world.entity.animal.wolf.WolfAccessor",
"world.entity.animal.horse.AbstractHorseAccessor",
"world.entity.animal.horse.HorseAccessor",
"world.entity.animal.horse.LlamaAccessor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
*/
package org.spongepowered.common.data.provider.entity;

import net.minecraft.world.entity.animal.Wolf;
import net.minecraft.world.entity.animal.wolf.Wolf;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.DyeColor;
import org.spongepowered.common.accessor.world.entity.animal.WolfAccessor;
import org.spongepowered.common.accessor.world.entity.animal.wolf.WolfAccessor;
import org.spongepowered.common.data.provider.DataProviderRegistrator;

public final class WolfData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.Wolf;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
import net.minecraft.world.entity.animal.sheep.Sheep;
import net.minecraft.world.entity.animal.wolf.Wolf;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
Expand All @@ -64,8 +64,8 @@
import org.spongepowered.common.accessor.entity.passive.AbstractChestedHorseEntityAccessor;
import org.spongepowered.common.accessor.network.protocol.game.ServerboundMovePlayerPacketAccessor;
import org.spongepowered.common.accessor.world.entity.EntityAccessor;
import org.spongepowered.common.accessor.world.entity.animal.WolfAccessor;
import org.spongepowered.common.accessor.world.entity.animal.sheep.SheepAccessor;
import org.spongepowered.common.accessor.world.entity.animal.wolf.WolfAccessor;
import org.spongepowered.common.accessor.world.inventory.SlotAccessor;
import org.spongepowered.common.bridge.network.protocol.PacketBridge;
import org.spongepowered.common.bridge.world.level.block.TrackableBlockBridge;
Expand Down Expand Up @@ -99,11 +99,11 @@ public static void handleSlotRestore(@Nullable final Player player, final @Nulla
if (containerMenu == null || slot.viewedSlot() instanceof Slot) {
slot.set(snapshot);
} else if (player instanceof ServerPlayer serverPlayer
&& containerMenu != player.inventoryMenu && serverPlayer.inventory().containsInventory(slot)) {
&& containerMenu != player.inventoryMenu && serverPlayer.inventory().containsInventory(slot)) {
final org.spongepowered.api.item.inventory.ItemStack stack = snapshot.asMutable();
slot.set(stack);
((net.minecraft.server.level.ServerPlayer) player).connection.send(
new ClientboundSetPlayerInventoryPacket(((SlotAdapter) slot).getOrdinal(), ItemStackUtil.toNative(stack)));
new ClientboundSetPlayerInventoryPacket(((SlotAdapter) slot).getOrdinal(), ItemStackUtil.toNative(stack)));
} else {
final int slotNumber = ((SlotAdapter) slot).getOrdinal();
final Slot nmsSlot = containerMenu.getSlot(slotNumber);
Expand Down Expand Up @@ -156,7 +156,7 @@ public static void validateCapturedTransactions(final int slotId, final Abstract
if (slot != null) {
final ItemStackSnapshot snapshot = ItemStackUtil.snapshotOf(slot.getItem());
final SlotTransaction slotTransaction = new SlotTransaction(
((InventoryAdapter) containerMenu).inventoryAdapter$getSlot(slotId).get(), snapshot, snapshot);
((InventoryAdapter) containerMenu).inventoryAdapter$getSlot(slotId).get(), snapshot, snapshot);
capturedTransactions.add(slotTransaction);
}
}
Expand Down Expand Up @@ -236,9 +236,9 @@ public static void onProcessPacket(final Packet packetIn, final PacketListener n
final BlockPos max = new BlockPos((int) (boundingBox.maxX - 0.001D), (int) (boundingBox.maxY - 0.001D), (int) (boundingBox.maxZ - 0.001D));
final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
if (packetPlayer.level().hasChunksAt(min, max)) {
for(int x = min.getX(); x <= max.getX(); ++x) {
for(int y = min.getY(); y <= max.getY(); ++y) {
for(int z = min.getZ(); z <= max.getZ(); ++z) {
for (int x = min.getX(); x <= max.getX(); ++x) {
for (int y = min.getY(); y <= max.getY(); ++y) {
for (int z = min.getZ(); z <= max.getZ(); ++z) {
pos.set(x, y, z);
final Block block = packetPlayer.level().getBlockState(pos).getBlock();
if (((TrackableBlockBridge) block).bridge$hasEntityInsideLogic()) {
Expand All @@ -259,8 +259,8 @@ public static void onProcessPacket(final Packet packetIn, final PacketListener n
// At the very least make an unknown packet state case.
final PacketContext<?> context = packetState.createPhaseContext(PhaseTracker.getWorldInstance(packetPlayer.serverLevel()));
context.source(packetPlayer)
.packetPlayer(packetPlayer)
.packet(packetIn);
.packetPlayer(packetPlayer)
.packet(packetIn);
if (!PacketPhase.getInstance().isPacketInvalid(packetIn, packetPlayer, packetState)) {

PacketPhase.getInstance().populateContext(packetIn, packetPlayer, packetState, context);
Expand All @@ -282,7 +282,7 @@ public static void onProcessPacket(final Packet packetIn, final PacketListener n
* Attempts to find the {@link EntityDataAccessor} that was potentially modified
* when a player interacts with an entity.
*
* @param stack The item the player is holding
* @param stack The item the player is holding
* @param entity The entity
* @return A possible data parameter or null if unknown
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public EntityArchetype createArchetype() {
public HoverEvent<HoverEvent.ShowEntity> asHoverEvent(final UnaryOperator<HoverEvent.ShowEntity> op) {
final Registry<net.minecraft.world.entity.EntityType<?>> entityTypeRegistry = SpongeCommon.vanillaRegistry(Registries.ENTITY_TYPE);
final ResourceLocation entityTypeKey = entityTypeRegistry.getKey((net.minecraft.world.entity.EntityType<?>) this.type());
return HoverEvent.showEntity(op.apply(HoverEvent.ShowEntity.of((Key) (Object) entityTypeKey, this.uniqueId(), this.displayName().get())));
return HoverEvent.showEntity(op.apply(HoverEvent.ShowEntity.showEntity((Key) (Object) entityTypeKey, this.uniqueId(), this.displayName().get())));
}

protected Set<Value.Immutable<?>> api$getVanillaValues() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* 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.entity.animal;
package org.spongepowered.common.mixin.api.minecraft.world.entity.animal.wolf;

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
Expand All @@ -32,7 +32,7 @@

import java.util.Set;

@Mixin(net.minecraft.world.entity.animal.Wolf.class)
@Mixin(net.minecraft.world.entity.animal.wolf.Wolf.class)
public abstract class WolfMixin_API extends TamableAnimalMixin_API implements Wolf {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* 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.entity.animal;
package org.spongepowered.common.mixin.api.minecraft.world.entity.animal.wolf;

import net.minecraft.world.entity.animal.WolfVariant;
import net.minecraft.world.entity.animal.wolf.WolfVariant;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(WolfVariant.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.core.world.entity.animal;
package org.spongepowered.common.mixin.core.world.entity.animal.wolf;

import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.NeutralMob;
Expand All @@ -44,7 +44,7 @@
import org.spongepowered.common.mixin.core.world.entity.AgableMobMixin;


@Mixin(net.minecraft.world.entity.animal.Wolf.class)
@Mixin(net.minecraft.world.entity.animal.wolf.Wolf.class)
public abstract class WolfMixin extends AgableMobMixin implements AggressiveEntityBridge {

// @formatter:off
Expand All @@ -65,8 +65,8 @@ public abstract class WolfMixin extends AgableMobMixin implements AggressiveEnti


@Redirect(method = "mobInteract",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/Wolf;tryToTame(Lnet/minecraft/world/entity/player/Player;)V"))
private void impl$onTame(final net.minecraft.world.entity.animal.Wolf instance, final Player player, final Player $$0, final InteractionHand $$1) {
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/wolf/Wolf;tryToTame(Lnet/minecraft/world/entity/player/Player;)V"))
private void impl$onTame(final net.minecraft.world.entity.animal.wolf.Wolf instance, final Player player, final Player $$0, final InteractionHand $$1) {
try {
final ItemStack handStack = player.getItemInHand($$1);
handStack.grow(1);
Expand All @@ -80,14 +80,14 @@ public abstract class WolfMixin extends AgableMobMixin implements AggressiveEnti
}

@Inject(method = "tryToTame",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/Wolf;tame(Lnet/minecraft/world/entity/player/Player;)V"),
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/wolf/Wolf;tame(Lnet/minecraft/world/entity/player/Player;)V"),
cancellable = true)
private void impl$onTame(final Player player, final CallbackInfo ci) {
try {

PhaseTracker.getInstance().pushCause(player);
if (SpongeCommon.post(SpongeEventFactory.createTameEntityEvent(PhaseTracker.getInstance().currentCause(), (Wolf) this))) {
this.shadow$level().broadcastEntityEvent((net.minecraft.world.entity.animal.Wolf) (Object) this, (byte)6);
this.shadow$level().broadcastEntityEvent((net.minecraft.world.entity.animal.wolf.Wolf) (Object) this, (byte)6);
ci.cancel();
}
} finally {
Expand Down
8 changes: 4 additions & 4 deletions src/mixins/resources/mixins.sponge.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"minecraft.world.entity.ai.goal.target.TargetGoalMixin_API",
"minecraft.world.entity.ambient.AmbientCreatureMixin_API",
"minecraft.world.entity.ambient.BatMixin_API",
"minecraft.world.entity.animal.AbstractCowMixin_API",
"minecraft.world.entity.animal.AbstractFishMixin_API",
"minecraft.world.entity.animal.AbstractGolemMixin_API",
"minecraft.world.entity.animal.AbstractSchoolingFishMixin_API",
Expand All @@ -148,7 +149,6 @@
"minecraft.world.entity.animal.CatVariantMixin_API",
"minecraft.world.entity.animal.ChickenMixin_API",
"minecraft.world.entity.animal.CodMixin_API",
"minecraft.world.entity.animal.AbstractCowMixin_API",
"minecraft.world.entity.animal.DolphinMixin_API",
"minecraft.world.entity.animal.FlyingAnimalMixin_API",
"minecraft.world.entity.animal.Fox_VariantMixin_API",
Expand All @@ -169,16 +169,13 @@
"minecraft.world.entity.animal.Rabbit_VariantMixin_API",
"minecraft.world.entity.animal.RabbitMixin_API",
"minecraft.world.entity.animal.SalmonMixin_API",
"minecraft.world.entity.animal.sheep.SheepMixin_API",
"minecraft.world.entity.animal.ShoulderRidingEntityMixin_API",
"minecraft.world.entity.animal.SnowGolemMixin_API",
"minecraft.world.entity.animal.SquidMixin_API",
"minecraft.world.entity.animal.TropicalFish_PatternMixin_API",
"minecraft.world.entity.animal.TropicalFishMixin_API",
"minecraft.world.entity.animal.TurtleMixin_API",
"minecraft.world.entity.animal.WaterAnimalMixin_API",
"minecraft.world.entity.animal.WolfMixin_API",
"minecraft.world.entity.animal.WollfVariantMixin_API",
"minecraft.world.entity.animal.allay.AllayMixin_API",
"minecraft.world.entity.animal.armadillo.ArmadilloMixin_API",
"minecraft.world.entity.animal.axolotl.AxolotlMixin_API",
Expand All @@ -198,7 +195,10 @@
"minecraft.world.entity.animal.horse.TraderLlamaMixin_API",
"minecraft.world.entity.animal.horse.VariantMixin_API",
"minecraft.world.entity.animal.horse.ZombieHorseMixin_API",
"minecraft.world.entity.animal.sheep.SheepMixin_API",
"minecraft.world.entity.animal.sniffer.SnifferMixin_API",
"minecraft.world.entity.animal.wolf.WolfMixin_API",
"minecraft.world.entity.animal.wolf.WollfVariantMixin_API",
"minecraft.world.entity.boss.EnderDragonPartMixin_API",
"minecraft.world.entity.boss.enderdragon.EndCrystalMixin_API",
"minecraft.world.entity.boss.enderdragon.EnderDragonMixin_API",
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/resources/mixins.sponge.core.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
"world.entity.animal.OcelotMixin",
"world.entity.animal.ParrotMixin",
"world.entity.animal.Rabbit_RaidGardenGoalMixin",
"world.entity.animal.WolfMixin",
"world.entity.animal.horse.AbstractHorseMixin",
"world.entity.animal.wolf.WolfMixin",
"world.entity.boss.enderdragon.EndCrystalMixin",
"world.entity.decoration.ArmorStandMixin",
"world.entity.decoration.BlockAttachedEntityMixin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@
import org.spongepowered.plugin.builtin.jvm.Plugin;
import org.spongepowered.test.LoadableModule;

import java.lang.invoke.MethodHandles;
import java.util.Optional;

@Plugin("portaltest")
public final class PortalTest implements LoadableModule {

public final static class Holder {
private static final MethodHandles.Lookup HOLDER_LOOKUP = MethodHandles.publicLookup();
private static final MethodHandles.Lookup PORTAL_TEST_LOOKUP;

static {
try {
PORTAL_TEST_LOOKUP = MethodHandles.privateLookupIn(PortalTest.class, HOLDER_LOOKUP);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}

public final static PortalTestListener INSTANCE = new PortalTestListener();
}

Expand All @@ -66,7 +78,7 @@ public PortalTest(final PluginContainer pluginContainer) {

@Override
public void enable(final CommandContext ctx) {
Sponge.eventManager().registerListeners(this.pluginContainer, PortalTest.Holder.INSTANCE);
Sponge.eventManager().registerListeners(this.pluginContainer, PortalTest.Holder.INSTANCE, PortalTest.Holder.PORTAL_TEST_LOOKUP);
ctx.cause().first(ServerPlayer.class).ifPresent(player -> {
final var portalONE = PortalLogic.builder().addSimplePortal((from, fromPos, entity) -> Optional.of(entity.serverLocation().add(Vector3i.ONE))).build();
player.offer(Keys.PORTAL_LOGIC, portalONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import net.minecraft.world.entity.EntityReference;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.animal.Wolf;
import net.minecraft.world.entity.animal.wolf.Wolf;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
Expand All @@ -48,13 +48,13 @@ public abstract class LivingEntityMixin_Attack_Impl {
}

@Redirect(method = "resolvePlayerResponsibleForDamage",
at = @At(value = "INVOKE" , target = "Lnet/minecraft/world/entity/animal/Wolf;isTame()Z"))
at = @At(value = "INVOKE" , target = "Lnet/minecraft/world/entity/animal/wolf/Wolf;isTame()Z"))
private boolean attackImpl$onWolfIsTame(@Coerce final Object instance) {
return ((TamableAnimal)instance).isTame();
}

@Redirect(method = "resolvePlayerResponsibleForDamage",
at = @At(value = "INVOKE" , target = "Lnet/minecraft/world/entity/animal/Wolf;getOwnerReference()Lnet/minecraft/world/entity/EntityReference;"))
at = @At(value = "INVOKE" , target = "Lnet/minecraft/world/entity/animal/wolf/Wolf;getOwnerReference()Lnet/minecraft/world/entity/EntityReference;"))
private EntityReference<LivingEntity> attackImpl$onWolfGetOwner(@Coerce final Object instance) {
return ((TamableAnimal)instance).getOwnerReference();
}
Expand Down

0 comments on commit 569507e

Please sign in to comment.