actions) {
final ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(actions, List.of());
-
+ int listOrder = 0; // TODO expose to API
final RemoteChatSession.Data chatSessionData = ((SpongeTabListEntry) entry).profilePublicKey() == null ? null : new RemoteChatSession.Data(entry.profile().uuid(), ((SpongeTabListEntry) entry).profilePublicKey());
final net.minecraft.network.chat.Component displayName = entry.displayName().isPresent() ? SpongeAdventure.asVanilla(entry.displayName().get()) : null;
final ClientboundPlayerInfoUpdatePacket.Entry data = new ClientboundPlayerInfoUpdatePacket.Entry(entry.profile().uniqueId(), SpongeGameProfile.toMcProfile(entry.profile()),
- entry.listed(), entry.latency(), (GameType) (Object) entry.gameMode(), displayName, chatSessionData);
+ entry.listed(), entry.latency(), (GameType) (Object) entry.gameMode(), displayName, listOrder, chatSessionData);
((ClientboundPlayerInfoUpdatePacketAccessor) packet).accessor$entries(List.of(data));
this.player.connection.send(packet);
}
diff --git a/src/main/java/org/spongepowered/common/entity/projectile/DispenserSourceLogic.java b/src/main/java/org/spongepowered/common/entity/projectile/DispenserSourceLogic.java
index 7aa7c741042..58e29308780 100644
--- a/src/main/java/org/spongepowered/common/entity/projectile/DispenserSourceLogic.java
+++ b/src/main/java/org/spongepowered/common/entity/projectile/DispenserSourceLogic.java
@@ -57,7 +57,7 @@ public Optional
launch(final ProjectileLogic
logic,
if (projectile.isPresent()) {
final Direction enumfacing = DispenserSourceLogic.getFacing((DispenserBlockEntity) source);
final net.minecraft.world.entity.Entity projectileEntity = (net.minecraft.world.entity.Entity) projectile.get();
- final BlockPos adjustedPosition = projectileEntity.blockPosition().offset(enumfacing.getNormal());
+ final BlockPos adjustedPosition = projectileEntity.blockPosition().offset(enumfacing.getUnitVec3i());
projectileEntity.setPos(adjustedPosition.getX(), adjustedPosition.getY(), adjustedPosition.getZ());
}
return projectile;
diff --git a/src/main/java/org/spongepowered/common/entity/projectile/ProjectileUtil.java b/src/main/java/org/spongepowered/common/entity/projectile/ProjectileUtil.java
index 8d73b2dde50..c7963bdab4d 100644
--- a/src/main/java/org/spongepowered/common/entity/projectile/ProjectileUtil.java
+++ b/src/main/java/org/spongepowered/common/entity/projectile/ProjectileUtil.java
@@ -197,7 +197,7 @@ protected Optional createProjectile(final LivingEntity source, fi
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
- final ThrownEgg egg = new ThrownEgg(source.level(), source);
+ final ThrownEgg egg = new ThrownEgg(source.level(), source, new ItemStack(Items.EGG));
egg.shoot(source.getXRot(), source.getYRot(), 0.0F, 1.5F, 0);
return ProjectileUtil.doLaunch(loc.world(), (Egg) egg);
}
@@ -226,7 +226,8 @@ protected Optional createProjectile(final LivingEntity source, f
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
- final net.minecraft.world.entity.projectile.Snowball snowball = new net.minecraft.world.entity.projectile.Snowball(source.level(), source);
+ final net.minecraft.world.entity.projectile.Snowball snowball = new net.minecraft.world.entity.projectile.Snowball(
+ source.level(), source, new ItemStack(Items.SNOWBALL));
snowball.shoot(source.getXRot(), source.getYRot(), 0.0F, 1.5F, 0);
return ProjectileUtil.doLaunch(loc.world(), (Snowball) snowball);
}
@@ -236,7 +237,7 @@ protected Optional createProjectile(final LivingEntity source, final S
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
- final ThrownExperienceBottle expBottle = new ThrownExperienceBottle(source.level(), source);
+ final ThrownExperienceBottle expBottle = new ThrownExperienceBottle(source.level(), source, new ItemStack(Items.EXPERIENCE_BOTTLE));
expBottle.shoot(source.getXRot(), source.getYRot(), -20.0F, 0.7F, 0);
return ProjectileUtil.doLaunch(loc.world(), (ExperienceBottle) expBottle);
}
@@ -247,7 +248,7 @@ protected Optional createProjectile(final LivingEntity source,
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
- final ThrownEnderpearl pearl = new ThrownEnderpearl(source.level(), source);
+ final ThrownEnderpearl pearl = new ThrownEnderpearl(source.level(), source, new ItemStack(Items.ENDER_PEARL));
pearl.shoot(source.getXRot(), source.getYRot(), 0.0F, 1.5F, 0);
return ProjectileUtil.doLaunch(loc.world(), (EnderPearl) pearl);
}
@@ -295,7 +296,7 @@ protected Optional createProjectile(final LivingEntity source, fina
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
if (source instanceof Player) {
- final FishingHook hook = new FishingHook((Player) source, source.level(), 0, 0);
+ final FishingHook hook = new FishingHook((Player) source, source.level(), 0, 0, new ItemStack(Items.FISHING_ROD));
hook.setPos(loc.x(), loc.y(), loc.z());
return ProjectileUtil.doLaunch(loc.world(), (FishingBobber) hook);
}
@@ -306,7 +307,7 @@ protected Optional createProjectile(final LivingEntity source, fi
@Override
protected Optional createProjectile(final LivingEntity source, final ServerLocation loc) {
- final ThrownPotion potion = new ThrownPotion(source.level(), source);
+ final ThrownPotion potion = new ThrownPotion(source.level(), source, new ItemStack(this.item));
potion.setItem(new ItemStack(Items.SPLASH_POTION, 1));
potion.shoot(source.getXRot(), source.getYRot(), -20.0F, 0.5F, 0);
return ProjectileUtil.doLaunch(loc.world(), (Potion) potion);
diff --git a/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java b/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java
index acb07d0647e..6ec6a447ce9 100644
--- a/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java
+++ b/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java
@@ -63,7 +63,6 @@
import org.spongepowered.api.effect.sound.music.MusicDisc;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.EntityTypes;
-import org.spongepowered.api.entity.explosive.Explosive;
import org.spongepowered.api.entity.living.Agent;
import org.spongepowered.api.entity.living.Living;
import org.spongepowered.api.entity.living.player.Player;
@@ -85,7 +84,6 @@
import org.spongepowered.api.event.entity.MoveEntityEvent;
import org.spongepowered.api.event.entity.RotateEntityEvent;
import org.spongepowered.api.event.entity.ai.SetAITargetEvent;
-import org.spongepowered.api.event.entity.explosive.DetonateExplosiveEvent;
import org.spongepowered.api.event.item.inventory.DropItemEvent;
import org.spongepowered.api.event.item.inventory.InteractItemEvent;
import org.spongepowered.api.event.sound.PlaySoundEvent;
@@ -97,13 +95,11 @@
import org.spongepowered.api.world.DefaultWorldKeys;
import org.spongepowered.api.world.LocatableBlock;
import org.spongepowered.api.world.World;
-import org.spongepowered.api.world.explosion.Explosion;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.SpongeCommon;
import org.spongepowered.common.adventure.SpongeAdventure;
import org.spongepowered.common.bridge.CreatorTrackedBridge;
-import org.spongepowered.common.bridge.explosives.ExplosiveBridge;
import org.spongepowered.common.bridge.map.MapIdTrackerBridge;
import org.spongepowered.common.bridge.server.level.ServerLevelBridge;
import org.spongepowered.common.bridge.world.TrackedWorldBridge;
@@ -116,7 +112,6 @@
import org.spongepowered.common.entity.projectile.UnknownProjectileSource;
import org.spongepowered.common.event.tracking.PhaseContext;
import org.spongepowered.common.event.tracking.PhaseTracker;
-import org.spongepowered.common.event.tracking.phase.general.GeneralPhase;
import org.spongepowered.common.item.util.ItemStackUtil;
import org.spongepowered.common.map.SpongeMapStorage;
import org.spongepowered.common.registry.provider.DirectionFacingProvider;
@@ -508,7 +503,7 @@ public static DestructEntityEvent.Death callDestructEntityEventDeath(final Livin
final DestructEntityEvent.Death event = SpongeEventFactory.createDestructEntityEventDeath(frame.currentCause(),
originalChannel, Optional.of(originalChannel), originalMessage, originalMessage, (Living) entity,
- entity.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY), messageCancelled);
+ ((ServerLevel) entity.level()).getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY), messageCancelled);
SpongeCommon.post(event);
return event;
@@ -527,7 +522,7 @@ public static boolean handleCollideBlockEvent(final Block block, final Level wor
return false;
}
- if (world.isClientSide() || pos.getY() < world.getMinBuildHeight()) {
+ if (world.isClientSide() || pos.getY() < world.getMinY()) {
return false;
}
@@ -591,7 +586,7 @@ public static boolean handleCollideImpactEvent(final net.minecraft.world.entity.
if (movingObjectType == HitResult.Type.BLOCK) {
final BlockHitResult blockMovingObjectPosition = (BlockHitResult) movingObjectPosition;
final BlockPos blockPos = blockMovingObjectPosition.getBlockPos();
- if (blockPos.getY() < projectile.level().getMinBuildHeight()) {
+ if (blockPos.getY() < projectile.level().getMinY()) {
return false;
}
@@ -626,24 +621,6 @@ public static SetAITargetEvent callSetAttackTargetEvent(final @Nullable Entity t
return event;
}
- public static Optional detonateExplosive(final ExplosiveBridge explosiveBridge, final Explosion.Builder builder) {
- final DetonateExplosiveEvent event = SpongeEventFactory.createDetonateExplosiveEvent(
- PhaseTracker.getCauseStackManager().currentCause(), builder, (Explosive) explosiveBridge, builder.build()
- );
- if (!Sponge.eventManager().post(event)) {
- final Explosion explosion = event.explosionBuilder().build();
- if (explosion.radius() > 0) {
- ((TrackedWorldBridge) ((Explosive) explosiveBridge).world())
- .tracker$triggerInternalExplosion(
- explosion,
- e -> GeneralPhase.State.EXPLOSION.createPhaseContext(PhaseTracker.SERVER).explosion(e)
- );
- }
- return Optional.of((net.minecraft.world.level.Explosion) explosion);
- }
- return Optional.empty();
- }
-
/**
* @author gabizou - April 19th, 2018
* Creates two events here:
@@ -740,14 +717,14 @@ public static PlaySoundEvent.AtEntity callPlaySoundAtEntityEvent(final Cause cau
final SoundEvent name, final float pitch, final float volume) {
final ServerLocation location = ServerLocation.of((ServerWorld) worldMixin, x, y, z);
final PlaySoundEvent.AtEntity event = SpongeEventFactory.createPlaySoundEventAtEntity(cause, location,
- Optional.ofNullable((ServerPlayer) entity), SpongeAdventure.asAdventure(category), (SoundType) name, pitch, volume);
+ Optional.ofNullable((ServerPlayer) entity), SpongeAdventure.asAdventure(category), (SoundType) (Object) name, pitch, volume);
SpongeCommon.post(event);
return event;
}
public static PlaySoundEvent.NoteBlock callPlaySoundNoteBlockEvent(final Cause cause, final World world, final BlockPos pos, final SoundEvent soundEvent, final InstrumentType instrument, final NotePitch notePitch, final Float pitch) {
final ServerLocation location = ServerLocation.of((ServerWorld) world, pos.getX(), pos.getY(), pos.getZ());
- final PlaySoundEvent.NoteBlock event = SpongeEventFactory.createPlaySoundEventNoteBlock(cause, instrument, location, notePitch, Sound.Source.RECORD, (SoundType)soundEvent, pitch, 3.0F);
+ final PlaySoundEvent.NoteBlock event = SpongeEventFactory.createPlaySoundEventNoteBlock(cause, instrument, location, notePitch, Sound.Source.RECORD, (SoundType) (Object) soundEvent, pitch, 3.0F);
SpongeCommon.post(event);
return event;
}
diff --git a/src/main/java/org/spongepowered/common/event/cause/entity/damage/SpongeDamageSourceBuilder.java b/src/main/java/org/spongepowered/common/event/cause/entity/damage/SpongeDamageSourceBuilder.java
index 6e3b1bb45ce..c2141f4b563 100644
--- a/src/main/java/org/spongepowered/common/event/cause/entity/damage/SpongeDamageSourceBuilder.java
+++ b/src/main/java/org/spongepowered/common/event/cause/entity/damage/SpongeDamageSourceBuilder.java
@@ -63,7 +63,7 @@ public DamageSource build() throws IllegalStateException {
@Override
public DamageSource.Builder type(final DamageType damageType) {
- final var registry = SpongeCommon.server().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE);
+ final var registry = SpongeCommon.server().registryAccess().lookupOrThrow(Registries.DAMAGE_TYPE);
this.damageType = registry.wrapAsHolder((net.minecraft.world.damagesource.DamageType) (Object) damageType);
return this;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/IPhaseState.java b/src/main/java/org/spongepowered/common/event/tracking/IPhaseState.java
index 54ea2b458ae..b5d7f058589 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/IPhaseState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/IPhaseState.java
@@ -60,6 +60,7 @@
import org.spongepowered.api.util.Tuple;
import org.spongepowered.api.world.BlockChangeFlag;
import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.block.SpongeBlockSnapshot;
import org.spongepowered.common.bridge.server.TickTaskBridge;
import org.spongepowered.common.bridge.server.level.ServerLevelBridge;
@@ -159,12 +160,14 @@ default boolean isInteraction() {
/**
* Performs any necessary custom logic after the provided {@link BlockSnapshot}
* {@link Transaction} has taken place.
- * @param context The context for information
+ *
+ * @param context The context for information
+ * @param serverWorld
* @param blockChange The block change performed
- * @param receipt The transaction of the old and new snapshots
+ * @param receipt The transaction of the old and new snapshots
*/
default void postBlockTransactionApplication(
- final C context, final BlockChange blockChange,
+ final C context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt receipt
) { }
diff --git a/src/main/java/org/spongepowered/common/event/tracking/PhaseStateProxy.java b/src/main/java/org/spongepowered/common/event/tracking/PhaseStateProxy.java
index 9f2aa7307b0..78bc12d574b 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/PhaseStateProxy.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/PhaseStateProxy.java
@@ -53,6 +53,7 @@
import org.spongepowered.api.item.inventory.transaction.SlotTransaction;
import org.spongepowered.api.util.Tuple;
import org.spongepowered.api.world.BlockChangeFlag;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.block.SpongeBlockSnapshot;
import org.spongepowered.common.bridge.server.TickTaskBridge;
import org.spongepowered.common.bridge.world.TrackedWorldBridge;
@@ -102,11 +103,13 @@ default boolean isInteraction() {
/**
* Performs any necessary custom logic after the provided {@link BlockSnapshot}
* {@link Transaction} has taken place.
- * @param blockChange The block change performed
- * @param receipt The transaction of the old and new snapshots
+ *
+ * @param serverWorld
+ * @param blockChange The block change performed
+ * @param receipt The transaction of the old and new snapshots
*/
- default void postBlockTransactionApplication(final BlockChange blockChange, final BlockTransactionReceipt receipt) {
- this.getState().postBlockTransactionApplication(this.asContext(), blockChange, receipt);
+ default void postBlockTransactionApplication(ServerWorld serverWorld, final BlockChange blockChange, final BlockTransactionReceipt receipt) {
+ this.getState().postBlockTransactionApplication(this.asContext(), serverWorld, blockChange, receipt);
}
/**
diff --git a/src/main/java/org/spongepowered/common/event/tracking/TrackingUtil.java b/src/main/java/org/spongepowered/common/event/tracking/TrackingUtil.java
index e969fb1baee..67a35d5fa35 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/TrackingUtil.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/TrackingUtil.java
@@ -233,12 +233,10 @@ public static void updateTickBlock(
}
public static void updateTickFluid(
- final TrackedWorldBridge mixinWorld, final FluidState fluidState, final BlockPos pos
- ) {
+ final TrackedWorldBridge mixinWorld, final FluidState fluidState, final BlockPos pos, final net.minecraft.world.level.block.state.BlockState blockState) {
final ServerLevel world = (ServerLevel) mixinWorld;
final org.spongepowered.api.world.server.ServerWorld apiWorld = (org.spongepowered.api.world.server.ServerWorld) world;
- final net.minecraft.world.level.block.state.BlockState blockState = fluidState.createLegacyBlock();
if (ShouldFire.TICK_BLOCK_EVENT) {
final BlockSnapshot snapshot = mixinWorld.bridge$createSnapshot(blockState, pos, BlockChangeFlags.NONE);
final TickBlockEvent event = SpongeEventFactory.createTickBlockEventScheduled(PhaseTracker.getCauseStackManager().currentCause(), snapshot);
@@ -261,7 +259,7 @@ public static void updateTickFluid(
try (final PhaseContext> context = phaseContext) {
context.buildAndSwitch();
PhaseTracker.LOGGER.trace(TrackingUtil.FLUID_TICK, () -> "Wrapping Fluid Tick: " + fluidState.toString());
- fluidState.tick(world, pos);
+ fluidState.tick(world, pos, blockState);
} catch (final Exception | NoClassDefFoundError e) {
PhasePrinter.printExceptionFromPhase(PhaseTracker.getInstance().stack, e, phaseContext);
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/block/ChangeBlock.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/block/ChangeBlock.java
index 527a30c23a0..7efa1a2dfa7 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/block/ChangeBlock.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/block/ChangeBlock.java
@@ -71,7 +71,7 @@ public ChangeBlock(
this.original = attachedSnapshot;
this.newState = newState;
this.blockChangeFlag = blockChange;
- this.originalOpacity = this.originalState.getLightBlock(this.original.getServerWorld().get(), this.affectedPosition);
+ this.originalOpacity = this.originalState.getLightBlock();
}
public BlockState getNewState() {
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/AddBlockLootDropsEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/AddBlockLootDropsEffect.java
index 51e1a40d109..05d963c3f60 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/AddBlockLootDropsEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/AddBlockLootDropsEffect.java
@@ -60,8 +60,8 @@ public EffectResult processSideEffect(
final PhaseContext<@NonNull ?> phaseContext = PhaseTracker.getInstance().getPhaseContext();
final ServerLevel world = pipeline.getServerWorld();
- final @Nullable BlockEntity existingTile = oldState.tileEntity;
- final BlockPos pos = oldState.pos;
+ final @Nullable BlockEntity existingTile = oldState.tileEntity();
+ final BlockPos pos = oldState.pos();
final LootParams.Builder lootBuilder = new LootParams.Builder(world)
.withParameter(LootContextParams.ORIGIN, VecHelper.toVanillaVector3d(pos))
@@ -70,6 +70,6 @@ public EffectResult processSideEffect(
phaseContext.populateLootContext(lootBuilder);
- return new EffectResult(newState, oldState.state.getDrops(lootBuilder), false);
+ return new EffectResult(newState, oldState.state().getDrops(lootBuilder), false);
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/BlockAddedEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/BlockAddedEffect.java
index bb2a8c66667..50b2977f8b2 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/BlockAddedEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/BlockAddedEffect.java
@@ -53,7 +53,7 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
// so we wrap the onPlace with the flag check (also, we're always on the
// server in this context).
if (flag.performBlockPhysics()) {
- newState.onPlace(pipeline.getServerWorld(), oldState.pos, oldState.state, flag.movingBlocks());
+ newState.onPlace(pipeline.getServerWorld(), oldState.pos(), oldState.state(), flag.movingBlocks());
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/CheckBlockPostPlacementIsSameEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/CheckBlockPostPlacementIsSameEffect.java
index f3693379738..951ba947beb 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/CheckBlockPostPlacementIsSameEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/CheckBlockPostPlacementIsSameEffect.java
@@ -44,9 +44,9 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final SpongeBlockChangeFlag flag, final int limit
) {
final LevelChunkSection chunkSection = pipeline.getAffectedSection();
- final int x = oldState.pos.getX() & 15;
- final int y = oldState.pos.getY() & 15;
- final int z = oldState.pos.getZ() & 15;
+ final int x = oldState.pos().getX() & 15;
+ final int y = oldState.pos().getY() & 15;
+ final int z = oldState.pos().getZ() & 15;
final BlockState currentState = chunkSection.getBlockState(x, y, z);
if (!currentState.is(newState.getBlock())) {
return new EffectResult(newState, true);
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ChunkChangeCompleteEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ChunkChangeCompleteEffect.java
index eecb265b5b7..426a2637da3 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ChunkChangeCompleteEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ChunkChangeCompleteEffect.java
@@ -49,7 +49,7 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final LevelChunk chunk = pipeline.getAffectedChunk();
// this.unsaved = true; // Vanilla, we'll just call the accessor available
- chunk.setUnsaved(true);
- return new EffectResult(oldState.state, true);
+ chunk.markUnsaved();
+ return new EffectResult(oldState.state(), true);
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ExplodeBlockEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ExplodeBlockEffect.java
index baaf064fadd..f47669e56ea 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ExplodeBlockEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ExplodeBlockEffect.java
@@ -56,9 +56,9 @@ public EffectResult processSideEffect(
final PhaseContext<@NonNull ?> phaseContext = PhaseTracker.getInstance().getPhaseContext();
final ServerLevel world = pipeline.getServerWorld();
- final BlockPos pos = oldState.pos;
+ final BlockPos pos = oldState.pos();
if (phaseContext instanceof ExplosionContext) {
- oldState.state.getBlock().wasExploded(world, pos, ((ExplosionContext) phaseContext).getExplosion());
+ oldState.state().getBlock().wasExploded(world, pos, ((ExplosionContext) phaseContext).getExplosion());
}
return EffectResult.NULL_PASS;
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyClientEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyClientEffect.java
index 63f49fc4df6..db70695e346 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyClientEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyClientEffect.java
@@ -56,7 +56,7 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
// if ((flags & 2) != 0 && (!this.isClientSide || (flags & 4) == 0) && (this.isClientSide || chunk.getLocationType() != null && chunk.getLocationType().isAtLeast(ChunkHolder.LocationType.TICKING))) {
if (flag.notifyClients() && (chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING))) {
// this.notifyBlockUpdate(pos, blockstate, newWorldState, flags);
- world.sendBlockUpdated(oldState.pos, oldState.state, newState, flag.getRawFlag());
+ world.sendBlockUpdated(oldState.pos(), oldState.state(), newState, flag.getRawFlag());
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyNeighborSideEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyNeighborSideEffect.java
index 8702afdf483..f69722fdf70 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyNeighborSideEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/NotifyNeighborSideEffect.java
@@ -53,10 +53,10 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
// if (!this.isClientSide && (flags & 1) != 0) {
if (flag.updateNeighbors()) {
// this.notifyNeighbors(pos, originalState.getBlock());
- world.blockUpdated(oldState.pos, oldState.state.getBlock());
+ world.blockUpdated(oldState.pos(), oldState.state().getBlock());
if (newState.hasAnalogOutputSignal()) {
// this.updateComparatorOutputLevel(pos, block);
- world.updateNeighbourForOutputSignal(oldState.pos, newState.getBlock());
+ world.updateNeighbourForOutputSignal(oldState.pos(), newState.getBlock());
}
}
return EffectResult.NULL_PASS;
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/OldBlockOnReplaceEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/OldBlockOnReplaceEffect.java
index ffaaf61c60b..e635d85aa93 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/OldBlockOnReplaceEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/OldBlockOnReplaceEffect.java
@@ -56,7 +56,7 @@ public EffectResult processSideEffect(
// However, since we know we're not on the client (ChunkPipeline is not
// used outside of server world context)
// we can safely just do oldState.onRemove(this.level, var1, var2, var3).
- oldState.state.onRemove(pipeline.getServerWorld(), oldState.pos, newState, flag.movingBlocks());
+ oldState.state().onRemove(pipeline.getServerWorld(), oldState.pos(), newState, flag.movingBlocks());
return EffectResult.NULL_PASS;
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PerformBlockDropsFromDestruction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PerformBlockDropsFromDestruction.java
index 0e6a2b9d443..c2f898c2c4a 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PerformBlockDropsFromDestruction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PerformBlockDropsFromDestruction.java
@@ -46,7 +46,7 @@ public static PerformBlockDropsFromDestruction getInstance() {
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState,
final BlockState newState, final SpongeBlockChangeFlag flag, final int limit
) {
- Block.dropResources(oldState.state, pipeline.getServerWorld(), oldState.pos, oldState.tileEntity, oldState.destroyer, ItemStack.EMPTY);
+ Block.dropResources(oldState.state(), pipeline.getServerWorld(), oldState.pos(), oldState.tileEntity(), oldState.destroyer(), ItemStack.EMPTY);
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java
index cc118789df8..ff4588db8da 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java
@@ -46,11 +46,11 @@ public static RemoveTileEntityFromChunkEffect getInstance() {
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState,
final SpongeBlockChangeFlag flag, final int limit
) {
- final BlockEntity tileEntity = oldState.tileEntity;
+ final BlockEntity tileEntity = oldState.tileEntity();
if (tileEntity == null) {
return EffectResult.NULL_RETURN;
}
- pipeline.getAffectedChunk().removeBlockEntity(oldState.pos);
+ pipeline.getAffectedChunk().removeBlockEntity(oldState.pos());
return EffectResult.NULL_RETURN;
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetAndRegisterBlockEntityToLevelChunk.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetAndRegisterBlockEntityToLevelChunk.java
index 7733123bc27..196a7c20bf2 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetAndRegisterBlockEntityToLevelChunk.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetAndRegisterBlockEntityToLevelChunk.java
@@ -51,8 +51,8 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final int limit
) {
final ServerLevel serverWorld = pipeline.getServerWorld();
- final @Nullable BlockEntity blockEntity = oldState.tileEntity;
- final BlockPos pos = oldState.pos;
+ final @Nullable BlockEntity blockEntity = oldState.tileEntity();
+ final BlockPos pos = oldState.pos();
if (serverWorld.isOutsideBuildHeight(pos)) {
return EffectResult.NULL_RETURN;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetBlockToChunkSectionEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetBlockToChunkSectionEffect.java
index 6db0b84c8fa..678aa48cff2 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetBlockToChunkSectionEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SetBlockToChunkSectionEffect.java
@@ -46,9 +46,9 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final SpongeBlockChangeFlag flag, final int limit
) {
final LevelChunkSection chunkSection = pipeline.getAffectedSection();
- final int x = oldState.pos.getX() & 15;
- final int y = oldState.pos.getY() & 15;
- final int z = oldState.pos.getZ() & 15;
+ final int x = oldState.pos().getX() & 15;
+ final int y = oldState.pos().getY() & 15;
+ final int z = oldState.pos().getZ() & 15;
final BlockState oldStateReturned = chunkSection.setBlockState(x, y, z, newState);
if (oldStateReturned == newState) {
return EffectResult.NULL_RETURN;
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SpawnDestructBlocksEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SpawnDestructBlocksEffect.java
index b167636ec06..3e144a2249d 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SpawnDestructBlocksEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/SpawnDestructBlocksEffect.java
@@ -54,9 +54,9 @@ public EffectResult processSideEffect(
final int limit
) {
final ServerLevel world = pipeline.getServerWorld();
- final BlockPos pos = oldState.pos;
+ final BlockPos pos = oldState.pos();
- final List drops = oldState.drops;
+ final List drops = oldState.drops();
drops.forEach(drop -> Block.popResource(world, pos, drop));
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateChunkLightManagerEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateChunkLightManagerEffect.java
index b27cfad1ec7..4cedc0c5810 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateChunkLightManagerEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateChunkLightManagerEffect.java
@@ -51,7 +51,7 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final boolean wasEmpty = pipeline.wasEmpty();
final boolean isStillEmpty = chunkSection.hasOnlyAir();
if (wasEmpty != isStillEmpty) {
- pipeline.getServerWorld().getChunkSource().getLightEngine().updateSectionStatus(oldState.pos, isStillEmpty);
+ pipeline.getServerWorld().getChunkSource().getLightEngine().updateSectionStatus(oldState.pos(), isStillEmpty);
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateConnectingBlocksEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateConnectingBlocksEffect.java
index ca520619017..28049195867 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateConnectingBlocksEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateConnectingBlocksEffect.java
@@ -48,12 +48,12 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final BlockState newState, final SpongeBlockChangeFlag flag, final int limit
) {
final ServerLevel world = pipeline.getServerWorld();
- final BlockPos pos = oldState.pos;
+ final BlockPos pos = oldState.pos();
if (flag.updateNeighboringShapes() && limit > 0) {
// int i = p_241211_3_ & -34; // Vanilla negates 34 to flip neighbor notification and and "state drops"
final int withoutNeighborDropsAndNestedNeighborUpdates = flag.asNestedNeighborUpdates().getRawFlag();
// blockstate.updateIndirectNeighbourShapes(this, p_241211_1_, i, p_241211_4_ - 1);
- oldState.state.updateIndirectNeighbourShapes(world, pos, withoutNeighborDropsAndNestedNeighborUpdates, limit - 1);
+ oldState.state().updateIndirectNeighbourShapes(world, pos, withoutNeighborDropsAndNestedNeighborUpdates, limit - 1);
// p_241211_2_.updateNeighbourShapes(this, p_241211_1_, i, p_241211_4_ - 1);
newState.updateNeighbourShapes(world, pos, withoutNeighborDropsAndNestedNeighborUpdates, limit - 1);
// p_241211_2_.updateIndirectNeighbourShapes(this, p_241211_1_, i, p_241211_4_ - 1);
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateHeightMapEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateHeightMapEffect.java
index 00693ff8e4a..de2b04b4949 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateHeightMapEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateHeightMapEffect.java
@@ -53,9 +53,9 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
if (heightMap == null) {
throw new IllegalStateException("Heightmap dereferenced!");
}
- final int x = oldState.pos.getX() & 15;
- final int y = oldState.pos.getY();
- final int z = oldState.pos.getZ() & 15;
+ final int x = oldState.pos().getX() & 15;
+ final int y = oldState.pos().getY();
+ final int z = oldState.pos().getZ() & 15;
heightMap.get(Heightmap.Types.MOTION_BLOCKING).update(x, y, z, newState);
heightMap.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES).update(x, y, z, newState);
heightMap.get(Heightmap.Types.OCEAN_FLOOR).update(x, y, z, newState);
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateLightSideEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateLightSideEffect.java
index c3f799992bb..b8962419f59 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateLightSideEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateLightSideEffect.java
@@ -25,9 +25,10 @@
package org.spongepowered.common.event.tracking.context.transaction.effect;
import net.minecraft.server.level.ServerLevel;
+import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.chunk.LevelChunk;
+import net.minecraft.world.level.lighting.LightEngine;
import org.spongepowered.common.event.tracking.context.transaction.pipeline.BlockPipeline;
import org.spongepowered.common.event.tracking.context.transaction.pipeline.PipelineCursor;
import org.spongepowered.common.world.SpongeBlockChangeFlag;
@@ -53,10 +54,8 @@ public EffectResult processSideEffect(
if (!flag.updateLighting()) {
return EffectResult.NULL_PASS;
}
- final int originalOpactiy = oldState.opacity;
final ServerLevel serverWorld = pipeline.getServerWorld();
- final LevelChunk chunk = pipeline.getAffectedChunk();
- final BlockState currentState = chunk.getBlockState(oldState.pos);
+ final BlockState currentState = pipeline.getAffectedChunk().getBlockState(oldState.pos());
// local variable notes:
// var2 = oldState.state
// var3 = currentState
@@ -70,24 +69,26 @@ public EffectResult processSideEffect(
// || var2.useShapeForLightOcclusion()
// )
// ) {
- if (oldState.state != currentState
- && (currentState.getLightBlock(serverWorld, oldState.pos) != originalOpactiy
- || currentState.getLightEmission() != oldState.state.getLightEmission()
- || currentState.useShapeForLightOcclusion()
- || oldState.state.useShapeForLightOcclusion()
- )) {
- final int x = oldState.pos.getX() & 15;
- final int y = oldState.pos.getY();
- final int z = oldState.pos.getZ() & 15;
+ if (LightEngine.hasDifferentLightProperties(oldState.state(), currentState)) {
// ProfilerFiller $$12 = this.level.getProfiler();
- final ProfilerFiller profiler = serverWorld.getProfiler();
- profiler.push("updateSkyLightSources");
- // this.skyLightSources.update(this, x, y, z);
- chunk.getSkyLightSources().update(chunk, x, y, z);
- profiler.popPush("queueCheckLight");
- // this.level.getChunkProvider().getLightManager().checkBlock(pos);
- serverWorld.getChunkSource().getLightEngine().checkBlock(oldState.pos);
- profiler.pop();
+ final ProfilerFiller filler = Profiler.get();
+
+ filler.push("updateSkyLightSources");
+// this.skyLightSources.update(this, $$6, $$3, $$8);
+ final var pos = oldState.pos();
+ final var x = pos.getX() & 15;
+ final var y = pos.getY() & 15;
+ final var z = pos.getZ() & 15;
+
+ final var levelChunk = serverWorld.getChunk(pos);
+ levelChunk.getSkyLightSources().update(levelChunk, x, y, z);
+// serverWorld.getChunkSource().update(this, $$6, $$3, $$8);
+ // this.profiler.startSection("queueCheckLight");
+ filler.push("queueCheckLight");
+ // this.getChunkProvider().getLightManager().checkBlock(pos);
+ serverWorld.getChunkSource().getLightEngine().checkBlock(pos);
+ // this.profiler.endSection();
+ filler.pop();
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateOrCreateNewTileEntityPostPlacementEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateOrCreateNewTileEntityPostPlacementEffect.java
index 0ecc8ef372d..aec887a346a 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateOrCreateNewTileEntityPostPlacementEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateOrCreateNewTileEntityPostPlacementEffect.java
@@ -55,12 +55,12 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final ServerLevel serverWorld = pipeline.getServerWorld();
final LevelChunk chunk = pipeline.getAffectedChunk();
if (((BlockStateBridge) newState).bridge$hasTileEntity()) {
- final @Nullable BlockEntity maybeNewTileEntity = chunk.getBlockEntity(oldState.pos, LevelChunk.EntityCreationType.CHECK);
+ final @Nullable BlockEntity maybeNewTileEntity = chunk.getBlockEntity(oldState.pos(), LevelChunk.EntityCreationType.CHECK);
if (maybeNewTileEntity == null) {
// var15 = ((EntityBlock)var12).newBlockEntity(var1, var2); // Vanilla
// tileentity1 = state.createTileEntity(this.world); // Forge
// We cast to our bridge for easy access
- @Nullable final BlockEntity newBlockEntity = ((BlockStateBridge) newState).bridge$createNewTileEntity(serverWorld, oldState.pos);
+ @Nullable final BlockEntity newBlockEntity = ((BlockStateBridge) newState).bridge$createNewTileEntity(serverWorld, oldState.pos());
if (newBlockEntity != null) {
chunk.addAndRegisterBlockEntity(newBlockEntity);
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateWorldRendererEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateWorldRendererEffect.java
index 67608577360..41a44be0d32 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateWorldRendererEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UpdateWorldRendererEffect.java
@@ -45,8 +45,8 @@ public static UpdateWorldRendererEffect getInstance() {
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState,
final BlockState newState, final SpongeBlockChangeFlag flag, final int limit
) {
- if (oldState.state != newState) {
- pipeline.getServerWorld().setBlocksDirty(oldState.pos, oldState.state, newState);
+ if (oldState.state() != newState) {
+ pipeline.getServerWorld().setBlocksDirty(oldState.pos(), oldState.state(), newState);
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldBlockChangeCompleteEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldBlockChangeCompleteEffect.java
index 3afdc4e476f..58491086353 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldBlockChangeCompleteEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldBlockChangeCompleteEffect.java
@@ -46,8 +46,8 @@ public EffectResult processSideEffect(final BlockPipeline pipeline, final Pipeli
final SpongeBlockChangeFlag flag, final int limit
) {
if (flag.notifyPathfinding()) {
- pipeline.getServerWorld().onBlockStateChange(oldState.pos, oldState.state, newState);
+ pipeline.getServerWorld().onBlockStateChange(oldState.pos(), oldState.state(), newState);
}
- return new EffectResult(oldState.state, true);
+ return new EffectResult(oldState.state(), true);
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldDestroyBlockLevelEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldDestroyBlockLevelEffect.java
index d1dafaa2841..86e5e16119c 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldDestroyBlockLevelEffect.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/WorldDestroyBlockLevelEffect.java
@@ -47,8 +47,8 @@ public static WorldDestroyBlockLevelEffect getInstance() {
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState,
final SpongeBlockChangeFlag flag, final int limit
) {
- if (!(oldState.state.getBlock() instanceof BaseFireBlock)) {
- pipeline.getServerWorld().levelEvent(2001, oldState.pos, Block.getId(oldState.state));
+ if (!(oldState.state().getBlock() instanceof BaseFireBlock)) {
+ pipeline.getServerWorld().levelEvent(2001, oldState.pos(), Block.getId(oldState.state()));
}
return EffectResult.NULL_PASS;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/ContainerBasedTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/ContainerBasedTransaction.java
index 52811cbb503..3bd55e1b709 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/ContainerBasedTransaction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/ContainerBasedTransaction.java
@@ -284,11 +284,11 @@ private void handleCrafting(final Player player, final ClickContainerEvent event
}
private void handleCraftingPreview(final Player player, final ClickContainerEvent event) {
- if (this.craftingInventory != null) {
+ if (this.craftingInventory != null && player instanceof ServerPlayer sp) {
// TODO push event to cause?
// TODO prevent event when there is no preview?
final SlotTransaction previewTransaction = this.getPreviewTransaction(this.craftingInventory.result(), event.transactions());
- final var recipe = player.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, this.craftingContainer.asCraftInput(), player.level());
+ final var recipe = sp.serverLevel().recipeAccess().getRecipeFor(RecipeType.CRAFTING, this.craftingContainer.asCraftInput(), player.level());
final CraftItemEvent.Preview previewEvent = SpongeEventFactory.createCraftItemEventPreview(event.cause(), (Container) this.menu, this.craftingInventory, event.cursorTransaction(), previewTransaction,
recipe.map(RecipeHolder::value).map(CraftingRecipe.class::cast), recipe.map(h -> h.id()).map(ResourceKey.class::cast), Optional.empty(), event.transactions());
SpongeCommon.post(previewEvent);
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CraftingPreviewTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CraftingPreviewTransaction.java
index 2fb3bf724e7..80a4fc5c600 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CraftingPreviewTransaction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CraftingPreviewTransaction.java
@@ -71,12 +71,12 @@ public Optional parentAbsorber() {
@Override
Optional createInventoryEvent(final List slotTransactions, final List entities,
final PhaseContext<@NonNull ?> context, final Cause currentCause) {
- if (slotTransactions.isEmpty()) {
+ if (slotTransactions.isEmpty() || !(this.player instanceof ServerPlayer sp)) {
return Optional.empty();
}
final ItemStackSnapshot cursor = ItemStackUtil.snapshotOf(this.player.containerMenu.getCarried());
final SlotTransaction previewTransaction = this.getPreviewTransaction(this.craftingInventory.result(), slotTransactions);
- final var recipe = this.player.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, this.craftSlots.asCraftInput(), this.player.level());
+ final var recipe = sp.serverLevel().recipeAccess().getRecipeFor(RecipeType.CRAFTING, this.craftSlots.asCraftInput(), this.player.level());
final CraftItemEvent.Preview event = SpongeEventFactory.createCraftItemEventPreview(currentCause,
ContainerUtil.fromNative(this.menu), this.craftingInventory, new Transaction<>(cursor, cursor), previewTransaction,
recipe.map(RecipeHolder::value).map(CraftingRecipe.class::cast),
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/PlaceRecipeTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/PlaceRecipeTransaction.java
index b64b10b0236..ab486784a6c 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/PlaceRecipeTransaction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/PlaceRecipeTransaction.java
@@ -105,7 +105,7 @@ boolean isContainerEventAllowed(final PhaseContext<@Nullable ?> context) {
if (!(context instanceof InventoryPacketContext)) {
return false;
}
- final int containerId = ((InventoryPacketContext) context).getPacket().getContainerId();
+ final int containerId = ((InventoryPacketContext) context).getPacket().containerId();
return containerId != this.player.containerMenu.containerId;
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SelectTradeTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SelectTradeTransaction.java
index 8d5f9eaf98e..c5f6a2ad3c1 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SelectTradeTransaction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SelectTradeTransaction.java
@@ -91,7 +91,7 @@ boolean isContainerEventAllowed(final PhaseContext<@NonNull ?> context) {
if (!(context instanceof InventoryPacketContext)) {
return false;
}
- final int containerId = ((InventoryPacketContext) context).getPacket().getContainerId();
+ final int containerId = ((InventoryPacketContext) context).getPacket().containerId();
return containerId != this.player.containerMenu.containerId;
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SetCarriedItemTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SetCarriedItemTransaction.java
index 84a00d5bc79..00657ace3cc 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SetCarriedItemTransaction.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/SetCarriedItemTransaction.java
@@ -24,7 +24,7 @@
*/
package org.spongepowered.common.event.tracking.context.transaction.inventory;
-import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket;
+import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -76,7 +76,7 @@ Optional createInventoryEvent(final List
@Override
public void restore(final PhaseContext<@NonNull ?> context, final ChangeInventoryEvent event) {
- this.player.connection.send(new ClientboundSetCarriedItemPacket(this.prevSlotId));
+ this.player.connection.send(new ClientboundSetHeldSlotPacket(this.prevSlotId));
this.player.getInventory().selected = this.prevSlotId;
this.handleEventResults(this.player, event);
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/ChunkPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/ChunkPipeline.java
index a6b34239bc1..accd704f681 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/ChunkPipeline.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/ChunkPipeline.java
@@ -111,10 +111,10 @@ public LevelChunkSection getAffectedSection() {
return null;
}
final ServerLevel serverWorld = this.serverWorld.get();
- final int oldOpacity = currentState.getLightBlock(serverWorld, pos);
+ final int oldOpacity = currentState.getLightBlock();
final SpongeBlockChangeFlag flag = this.transaction.getBlockChangeFlag();
final @Nullable BlockEntity existing = this.chunkSupplier.get().getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK);
- PipelineCursor formerState = new PipelineCursor(currentState, oldOpacity, pos, existing, (Entity) null, limit);
+ PipelineCursor formerState = new PipelineCursor(currentState, pos, existing, (Entity) null, limit);
for (final ResultingTransactionBySideEffect effect : this.chunkEffects) {
try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) {
@@ -128,8 +128,8 @@ public LevelChunkSection getAffectedSection() {
if (result.hasResult) {
return result.resultingState;
}
- if (formerState.drops.isEmpty() && !result.drops.isEmpty()) {
- formerState = new PipelineCursor(currentState, oldOpacity, pos, existing, null, result.drops, limit);
+ if (formerState.drops().isEmpty() && !result.drops.isEmpty()) {
+ formerState = new PipelineCursor(currentState, pos, existing, null, result.drops, limit);
}
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/PipelineCursor.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/PipelineCursor.java
index 6681d1e055c..4b3da670861 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/PipelineCursor.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/PipelineCursor.java
@@ -33,57 +33,20 @@
import java.util.Collections;
import java.util.List;
-import java.util.StringJoiner;
-public final class PipelineCursor {
- public final BlockState state;
- public final int opacity;
- public final BlockPos pos;
- public final @Nullable BlockEntity tileEntity;
- public final @Nullable Entity destroyer;
- public final List drops;
- public final int limit;
-
- public PipelineCursor(final BlockState state, final int opacity, final BlockPos pos,
- final @Nullable BlockEntity tileEntity,
- final @Nullable Entity destroyer, final int limit
+public record PipelineCursor(
+ BlockState state,
+ BlockPos pos,
+ @Nullable BlockEntity tileEntity,
+ @Nullable Entity destroyer,
+ List drops,
+ int limit
+) {
+ public PipelineCursor(final BlockState state, final BlockPos pos,
+ final @Nullable BlockEntity tileEntity,
+ final @Nullable Entity destroyer, final int limit
) {
- this.state = state;
- this.opacity = opacity;
- this.pos = pos;
- this.tileEntity = tileEntity;
- this.destroyer = destroyer;
- this.drops = Collections.emptyList();
- this.limit = limit;
+ this(state, pos, tileEntity, destroyer, Collections.emptyList(), limit);
}
- public PipelineCursor(final BlockState state, final int opacity, final BlockPos pos,
- final @Nullable BlockEntity tileEntity,
- final @Nullable Entity destroyer,
- final List drops,
- final int limit
- ) {
- this.state = state;
- this.opacity = opacity;
- this.pos = pos;
- this.tileEntity = tileEntity;
- this.drops = drops;
- this.limit = limit;
- this.destroyer = destroyer;
- }
-
- @Override
- public String toString() {
- return new StringJoiner(
- ", ",
- PipelineCursor.class.getSimpleName() + "[",
- "]"
- )
- .add("state=" + this.state)
- .add("opacity=" + this.opacity)
- .add("pos=" + this.pos)
- .add("tileEntity=" + this.tileEntity)
- .add("drops=" + this.drops)
- .toString();
- }
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/TileEntityPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/TileEntityPipeline.java
index ac6fdd6ac4b..2a5dc819629 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/TileEntityPipeline.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/TileEntityPipeline.java
@@ -103,18 +103,17 @@ public boolean processEffects(final PhaseContext> context, final PipelineCurso
final EffectResult result = effect.effect.processSideEffect(
this,
currentCursor,
- currentCursor.state,
+ currentCursor.state(),
(SpongeBlockChangeFlag) BlockChangeFlags.NONE,
- currentCursor.limit
+ currentCursor.limit()
);
- if (result.resultingState != currentCursor.state) {
+ if (result.resultingState != currentCursor.state()) {
currentCursor = new PipelineCursor(
result.resultingState,
- currentCursor.opacity,
- currentCursor.pos,
- currentCursor.tileEntity,
- currentCursor.destroyer,
- currentCursor.limit
+ currentCursor.pos(),
+ currentCursor.tileEntity(),
+ currentCursor.destroyer(),
+ currentCursor.limit()
);
}
if (result.hasResult) {
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/WorldPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/WorldPipeline.java
index 81165311770..fe5a8e9b355 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/WorldPipeline.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/WorldPipeline.java
@@ -98,8 +98,8 @@ public boolean processEffects(final PhaseContext> context, final BlockState cu
if (oldState == null) {
return false;
}
- final int oldOpacity = oldState.getLightBlock(serverWorld, pos);
- PipelineCursor formerState = new PipelineCursor(oldState, oldOpacity, pos, existing, destroyer, limit);
+ final int oldOpacity = oldState.getLightBlock();
+ PipelineCursor formerState = new PipelineCursor(oldState, pos, existing, destroyer, limit);
for (final ResultingTransactionBySideEffect effect : this.worldEffects) {
try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) {
@@ -113,8 +113,8 @@ public boolean processEffects(final PhaseContext> context, final BlockState cu
if (result.hasResult) {
return result.resultingState != null;
}
- if (formerState.drops.isEmpty() && !result.drops.isEmpty()) {
- formerState = new PipelineCursor(oldState, oldOpacity, pos, existing, formerState.destroyer, result.drops, limit);
+ if (formerState.drops().isEmpty() && !result.drops.isEmpty()) {
+ formerState = new PipelineCursor(oldState, pos, existing, formerState.destroyer(), result.drops, limit);
}
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/BlockTransactionType.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/BlockTransactionType.java
index b8605f062fe..965ea025c85 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/BlockTransactionType.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/BlockTransactionType.java
@@ -63,7 +63,7 @@ protected void consumeEventsAndMarker(
eventsByWorld.asMap().forEach((key, events) -> {
final Optional serverWorld = ((SpongeServer) SpongeCommon.server()).worldManager().world(key);
- if (!serverWorld.isPresent()) {
+ if (serverWorld.isEmpty()) {
return;
}
@@ -85,7 +85,7 @@ protected void consumeEventsAndMarker(
final Operation operation = context.getBlockOperation(original, result);
final BlockTransactionReceipt eventTransaction = new BlockTransactionReceipt(original, result, operation);
transactions.add(eventTransaction);
- context.postBlockTransactionApplication(original.blockChange, eventTransaction);
+ context.postBlockTransactionApplication(serverWorld.get(), original.blockChange, eventTransaction);
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/general/CommandState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/general/CommandState.java
index 43a9b373744..d365efa21f5 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/general/CommandState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/general/CommandState.java
@@ -35,6 +35,7 @@
import org.spongepowered.api.event.CauseStackManager;
import org.spongepowered.api.event.cause.entity.SpawnType;
import org.spongepowered.api.event.cause.entity.SpawnTypes;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.bridge.world.level.chunk.LevelChunkBridge;
import org.spongepowered.common.entity.PlayerTracker;
import org.spongepowered.common.event.tracking.PhaseTracker;
@@ -66,7 +67,7 @@ public BiConsumer getFrameMod
@Override
public void postBlockTransactionApplication(
- final CommandPhaseContext context, final BlockChange blockChange,
+ final CommandPhaseContext context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt transaction
) {
// We want to investigate if there is a user on the cause stack
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionContext.java b/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionContext.java
index 0c901223d8c..eb40f98eba9 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionContext.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionContext.java
@@ -26,17 +26,17 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
-import net.minecraft.world.level.Explosion;
+import net.minecraft.world.level.ServerExplosion;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
-import org.spongepowered.common.accessor.world.level.ExplosionAccessor;
+import org.spongepowered.common.accessor.world.level.ServerExplosionAccessor;
import org.spongepowered.common.event.tracking.PhaseContext;
import org.spongepowered.common.event.tracking.PhaseTracker;
import org.spongepowered.common.util.PrettyPrinter;
public final class ExplosionContext extends GeneralPhaseContext {
- private Explosion explosion;
+ private ServerExplosion explosion;
public ExplosionContext(PhaseTracker tracker) {
super(GeneralPhase.State.EXPLOSION, tracker);
@@ -57,12 +57,12 @@ public ExplosionContext potentialExplosionSource(final ServerLevel worldServer,
return this;
}
- public ExplosionContext explosion(final Explosion explosion) {
+ public ExplosionContext explosion(final ServerExplosion explosion) {
this.explosion = explosion;
return this;
}
- public Explosion getExplosion() {
+ public ServerExplosion getExplosion() {
return this.explosion;
}
@@ -88,12 +88,10 @@ protected boolean isRunaway(final PhaseContext> phaseContext) {
if (phaseContext.getClass() != ExplosionContext.class) {
return false;
}
- final ExplosionAccessor otherExplosion = (ExplosionAccessor) ((ExplosionContext) phaseContext).explosion;
- final ExplosionAccessor thisExplosion = (ExplosionAccessor) this.explosion;
+ final ServerExplosionAccessor otherExplosion = (ServerExplosionAccessor) ((ExplosionContext) phaseContext).explosion;
+ final ServerExplosionAccessor thisExplosion = (ServerExplosionAccessor) this.explosion;
return otherExplosion.accessor$level() == thisExplosion.accessor$level()
- && otherExplosion.accessor$x() == thisExplosion.accessor$x()
- && otherExplosion.accessor$y() == thisExplosion.accessor$y()
- && otherExplosion.accessor$z() == thisExplosion.accessor$z();
+ && ((ExplosionContext) phaseContext).explosion.center().equals(this.explosion.center());
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionState.java
index 141853b01aa..26e10b29deb 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/general/ExplosionState.java
@@ -39,7 +39,7 @@
import org.spongepowered.api.event.SpongeEventFactory;
import org.spongepowered.api.event.entity.SpawnEntityEvent;
import org.spongepowered.api.util.Tuple;
-import org.spongepowered.common.accessor.world.level.ExplosionAccessor;
+import org.spongepowered.common.accessor.world.level.ServerExplosionAccessor;
import org.spongepowered.common.bridge.CreatorTrackedBridge;
import org.spongepowered.common.event.tracking.PhaseTracker;
import org.spongepowered.common.event.tracking.TrackingUtil;
@@ -88,8 +88,8 @@ public void populateLootContext(final ExplosionContext phaseContext, final LootP
final Explosion explosion = phaseContext.getExplosion();
lootBuilder.withOptionalParameter(LootContextParams.THIS_ENTITY, explosion.getDirectSourceEntity());
- if (((ExplosionAccessor) explosion).accessor$blockInteraction() == net.minecraft.world.level.Explosion.BlockInteraction.DESTROY) {
- lootBuilder.withParameter(LootContextParams.EXPLOSION_RADIUS, ((ExplosionAccessor) explosion).accessor$radius());
+ if (((ServerExplosionAccessor) explosion).accessor$blockInteraction() == net.minecraft.world.level.Explosion.BlockInteraction.DESTROY) {
+ lootBuilder.withParameter(LootContextParams.EXPLOSION_RADIUS, ((ServerExplosionAccessor) explosion).accessor$radius());
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PacketCommandState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PacketCommandState.java
index 30041525395..57d93ca2df8 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PacketCommandState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PacketCommandState.java
@@ -37,6 +37,7 @@
import org.spongepowered.api.event.cause.entity.SpawnTypes;
import org.spongepowered.api.event.entity.SpawnEntityEvent;
import org.spongepowered.api.util.Tuple;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.event.tracking.PhaseTracker;
import org.spongepowered.common.event.tracking.TrackingUtil;
import org.spongepowered.common.event.tracking.context.transaction.GameTransaction;
@@ -69,7 +70,7 @@ public BiConsumer getFr
@Override
public void postBlockTransactionApplication(
- final PlayerCommandPhaseContext context, final BlockChange blockChange,
+ final PlayerCommandPhaseContext context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt transaction
) {
// We want to investigate if there is a user on the cause stack
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PlaceBlockPacketState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PlaceBlockPacketState.java
index 5ba2f9e9330..660f5ec66da 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PlaceBlockPacketState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/PlaceBlockPacketState.java
@@ -87,7 +87,7 @@ public void populateContext(final net.minecraft.server.level.ServerPlayer player
@Override
public void postBlockTransactionApplication(
- final BasicPacketContext context, final BlockChange blockChange,
+ final BasicPacketContext context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt transaction
) {
TrackingUtil.associateTrackerToTarget(blockChange, transaction, ((ServerPlayer) context.getPacketPlayer()).uniqueId());
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/UseItemPacketState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/UseItemPacketState.java
index a07ab05571f..887044374d0 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/UseItemPacketState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/packet/player/UseItemPacketState.java
@@ -41,6 +41,7 @@
import org.spongepowered.api.event.cause.entity.SpawnTypes;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.bridge.world.level.chunk.LevelChunkBridge;
import org.spongepowered.common.entity.PlayerTracker;
import org.spongepowered.common.event.tracking.PhaseTracker;
@@ -91,7 +92,7 @@ public void populateContext(
@Override
public void postBlockTransactionApplication(
- final BasicPacketContext context, final BlockChange blockChange,
+ final BasicPacketContext context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt transaction
) {
final ServerPlayer player = context.getSpongePlayer();
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockEventTickPhaseState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockEventTickPhaseState.java
index ab67914b419..c0bd38061b6 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockEventTickPhaseState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockEventTickPhaseState.java
@@ -34,6 +34,7 @@
import org.spongepowered.api.event.EventContextKeys;
import org.spongepowered.api.event.cause.entity.SpawnType;
import org.spongepowered.api.event.cause.entity.SpawnTypes;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.block.SpongeBlockSnapshot;
import org.spongepowered.common.bridge.world.level.TrackableBlockEventDataBridge;
import org.spongepowered.common.bridge.world.level.chunk.LevelChunkBridge;
@@ -84,7 +85,7 @@ public void associateNeighborStateNotifier(
@Override
public void postBlockTransactionApplication(
- final BlockEventTickContext context, final BlockChange blockChange,
+ final BlockEventTickContext context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt receipt
) {
final Block block = (Block) receipt.originalBlock().state().type();
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockTickPhaseState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockTickPhaseState.java
index 26c145f1376..8eee3c662b6 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockTickPhaseState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/BlockTickPhaseState.java
@@ -26,7 +26,7 @@
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
-import net.minecraft.world.level.Level;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock;
@@ -73,9 +73,9 @@ public BlockChange associateBlockChangeWithSnapshot(
if (newBlock instanceof BonemealableBlock) {
return BlockChange.GROW;
} else if (phaseContext.tickingBlock instanceof final StemBlock stemBlock) {
- final Registry registry = ((Level) phaseContext.world).registryAccess().registryOrThrow(Registries.BLOCK);
- final @Nullable Block fruitBlock = registry.get(((StemBlockAccessor) stemBlock).accessor$fruit());
- final @Nullable Block attachedStemBlock = registry.get(((StemBlockAccessor) stemBlock).accessor$attachedStem());
+ final Registry registry = ((ServerLevel) phaseContext.world).registryAccess().lookupOrThrow(Registries.BLOCK);
+ final @Nullable Block fruitBlock = registry.getValue(((StemBlockAccessor) stemBlock).accessor$fruit());
+ final @Nullable Block attachedStemBlock = registry.getValue(((StemBlockAccessor) stemBlock).accessor$attachedStem());
if (newBlock == fruitBlock || newBlock == attachedStemBlock) {
return BlockChange.GROW;
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/EntityTickPhaseState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/EntityTickPhaseState.java
index 27405e72373..962b8c0cbd2 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/EntityTickPhaseState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/EntityTickPhaseState.java
@@ -40,6 +40,7 @@
import org.spongepowered.api.event.CauseStackManager;
import org.spongepowered.api.event.cause.entity.SpawnType;
import org.spongepowered.api.event.cause.entity.SpawnTypes;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.accessor.world.entity.decoration.ItemFrameAccessor;
import org.spongepowered.common.bridge.world.entity.EntityBridge;
import org.spongepowered.common.bridge.world.entity.TrackableEntityBridge;
@@ -124,7 +125,7 @@ protected EntityTickContext createNewContext(final PhaseTracker tracker) {
@Override
public void postBlockTransactionApplication(
- final EntityTickContext context, final BlockChange blockChange,
+ final EntityTickContext context, final ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt transaction
) {
if (blockChange == BlockChange.BREAK) {
@@ -159,12 +160,11 @@ public void postBlockTransactionApplication(
return false;
});
for (final HangingEntity entityHanging : hangingEntities) {
- if (entityHanging instanceof ItemFrame) {
- final ItemFrame itemFrame = (ItemFrame) entityHanging;
- if (!itemFrame.isRemoved()) {
- ((ItemFrameAccessor) itemFrame).invoker$dropItem((net.minecraft.world.entity.Entity) tickingEntity, true);
+ if (entityHanging instanceof ItemFrame iframe) {
+ if (!iframe.isRemoved()) {
+ ((ItemFrameAccessor) iframe).invoker$dropItem((ServerLevel) serverWorld, (net.minecraft.world.entity.Entity) tickingEntity, true);
}
- itemFrame.remove(net.minecraft.world.entity.Entity.RemovalReason.DISCARDED);
+ iframe.remove(net.minecraft.world.entity.Entity.RemovalReason.DISCARDED);
}
}
}
diff --git a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/LocationBasedTickPhaseState.java b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/LocationBasedTickPhaseState.java
index edb6df776fb..c6c59b088f8 100644
--- a/src/main/java/org/spongepowered/common/event/tracking/phase/tick/LocationBasedTickPhaseState.java
+++ b/src/main/java/org/spongepowered/common/event/tracking/phase/tick/LocationBasedTickPhaseState.java
@@ -35,6 +35,7 @@
import org.spongepowered.api.event.CauseStackManager;
import org.spongepowered.api.world.LocatableBlock;
import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.block.SpongeBlockSnapshot;
import org.spongepowered.common.bridge.world.TrackedWorldBridge;
import org.spongepowered.common.bridge.world.level.TrackableBlockEventDataBridge;
@@ -122,7 +123,7 @@ public void appendContextPreExplosion(final ExplosionContext explosionContext, f
@Override
public void postBlockTransactionApplication(
- final T context, final BlockChange blockChange,
+ final T context, ServerWorld serverWorld, final BlockChange blockChange,
final BlockTransactionReceipt receipt
) {
// If we do not have a notifier at this point then there is no need to attempt to retrieve one from the chunk
diff --git a/src/main/java/org/spongepowered/common/inventory/lens/impl/comp/CraftingGridInventoryLens.java b/src/main/java/org/spongepowered/common/inventory/lens/impl/comp/CraftingGridInventoryLens.java
index 6edb093807f..3dc828381ac 100644
--- a/src/main/java/org/spongepowered/common/inventory/lens/impl/comp/CraftingGridInventoryLens.java
+++ b/src/main/java/org/spongepowered/common/inventory/lens/impl/comp/CraftingGridInventoryLens.java
@@ -28,7 +28,7 @@
import net.minecraft.world.inventory.InventoryMenu;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.crafting.CraftingGridInventory;
-import org.spongepowered.common.accessor.world.inventory.CraftingMenuAccessor;
+import org.spongepowered.common.accessor.world.inventory.AbstractCraftingMenuAccessor;
import org.spongepowered.common.inventory.fabric.Fabric;
import org.spongepowered.common.inventory.fabric.OffsetFabric;
import org.spongepowered.common.inventory.lens.impl.AbstractLens;
@@ -70,7 +70,7 @@ public Inventory getAdapter(Fabric fabric, Inventory parent) {
return ((CraftingGridInventory) ((InventoryMenu) fabric).getCraftSlots());
}
if (fabric instanceof CraftingMenu) {
- return ((CraftingGridInventory) ((CraftingMenuAccessor) fabric).accessor$craftSlots());
+ return ((CraftingGridInventory) ((AbstractCraftingMenuAccessor) fabric).accessor$craftSlots());
}
throw new IllegalStateException(fabric.getClass().getName() + " is not a known CraftingGridInventory.");
}
diff --git a/src/main/java/org/spongepowered/common/inventory/lens/impl/slot/EquipmentSlotLens.java b/src/main/java/org/spongepowered/common/inventory/lens/impl/slot/EquipmentSlotLens.java
index e63fe04826a..c741fa7967d 100644
--- a/src/main/java/org/spongepowered/common/inventory/lens/impl/slot/EquipmentSlotLens.java
+++ b/src/main/java/org/spongepowered/common/inventory/lens/impl/slot/EquipmentSlotLens.java
@@ -24,8 +24,8 @@
*/
package org.spongepowered.common.inventory.lens.impl.slot;
+import net.minecraft.core.component.DataComponents;
import net.minecraft.world.entity.EquipmentSlot;
-import net.minecraft.world.item.Equipable;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.Slot;
import org.spongepowered.api.item.inventory.equipment.EquipmentType;
@@ -52,8 +52,8 @@ private static FilteringSlotLens.ItemStackFilter equipmentTypeFilter(EquipmentTy
if (item.isEmpty()) {
return true;
}
- final var equipable = Equipable.get(ItemStackUtil.fromLikeToNative(item));
- final var itemSlotType = equipable != null ? equipable.getEquipmentSlot() : EquipmentSlot.MAINHAND;
+ final var equippable = ItemStackUtil.fromLikeToNative(item).get(DataComponents.EQUIPPABLE);
+ final var itemSlotType = equippable != null ? equippable.slot() : EquipmentSlot.MAINHAND;
return itemSlotType == (Object) type;
};
}
diff --git a/src/main/java/org/spongepowered/common/inventory/util/InventoryUtil.java b/src/main/java/org/spongepowered/common/inventory/util/InventoryUtil.java
index b6c489f060c..dbdcfcdbe12 100644
--- a/src/main/java/org/spongepowered/common/inventory/util/InventoryUtil.java
+++ b/src/main/java/org/spongepowered/common/inventory/util/InventoryUtil.java
@@ -51,9 +51,8 @@
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.common.SpongeCommon;
-import org.spongepowered.common.accessor.world.inventory.CraftingMenuAccessor;
+import org.spongepowered.common.accessor.world.inventory.AbstractCraftingMenuAccessor;
import org.spongepowered.common.accessor.world.inventory.SmithingMenuAccessor;
-import org.spongepowered.common.accessor.world.inventory.StonecutterMenuAccessor;
import org.spongepowered.common.bridge.world.inventory.container.TrackedInventoryBridge;
import org.spongepowered.common.entity.player.SpongeUserData;
import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor;
@@ -97,9 +96,9 @@ public static Optional toCraftingInput(final Invent
case AbstractFurnaceBlockEntity furnace -> new SingleRecipeInput(furnace.getItem(0));
case CampfireBlockEntity campfire -> campfire.getItems().stream().filter(stack -> !stack.isEmpty()).findFirst()
.map(SingleRecipeInput::new).orElse(null);
- case CraftingMenuAccessor menu -> menu.accessor$craftSlots().asCraftInput();
+ case AbstractCraftingMenuAccessor menu -> menu.accessor$craftSlots().asCraftInput();
case InventoryMenu menu -> menu.getCraftSlots().asCraftInput();
- case StonecutterMenu menu -> StonecutterMenuAccessor.invoker$createRecipeInput(menu.container);
+ case StonecutterMenu menu -> new SingleRecipeInput(menu.container.getItem(0));
case SmithingMenuAccessor menu -> menu.invoker$createRecipeInput();
default -> null;
};
diff --git a/src/main/java/org/spongepowered/common/item/SpongeToolRuleFactory.java b/src/main/java/org/spongepowered/common/item/SpongeToolRuleFactory.java
index 5850e53f41d..5ce79c4d06f 100644
--- a/src/main/java/org/spongepowered/common/item/SpongeToolRuleFactory.java
+++ b/src/main/java/org/spongepowered/common/item/SpongeToolRuleFactory.java
@@ -24,6 +24,7 @@
*/
package org.spongepowered.common.item;
+import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.tags.TagKey;
@@ -41,12 +42,16 @@ public class SpongeToolRuleFactory implements ToolRule.Factory {
@Override
public ToolRule minesAndDrops(final List blocks, final double speed) {
- return (ToolRule) (Object) Tool.Rule.minesAndDrops(blocks.stream().map(Block.class::cast).toList(), (float) speed);
+ // TODO is Holder::direct allowed here?
+ final var holderSet = HolderSet.direct(blocks.stream().map(Block.class::cast).map(Holder::direct).toList());
+ return (ToolRule) (Object) Tool.Rule.minesAndDrops(holderSet, (float) speed);
}
@Override
public ToolRule minesAndDrops(final Tag blockTypeTag, final double speed) {
- return (ToolRule) (Object) Tool.Rule.minesAndDrops((TagKey) (Object) blockTypeTag, (float) speed);
+ final var tag = (TagKey) (Object) blockTypeTag;
+ final var holderSet = BuiltInRegistries.BLOCK.get(tag).map(hs -> (HolderSet) hs).orElse(HolderSet.empty());
+ return (ToolRule) (Object) Tool.Rule.minesAndDrops(holderSet, (float) speed);
}
@Override
@@ -58,17 +63,22 @@ public ToolRule deniesDrops(final List blocks) {
@Override
public ToolRule deniesDrops(final Tag blockTypeTag) {
- return (ToolRule) (Object) Tool.Rule.deniesDrops((TagKey) (Object) blockTypeTag);
+ final var tag = (TagKey) (Object) blockTypeTag;
+ final var holderSet = BuiltInRegistries.BLOCK.get(tag).map(hs -> (HolderSet) hs).orElse(HolderSet.empty());
+ return (ToolRule) (Object) Tool.Rule.deniesDrops(holderSet);
}
@Override
public ToolRule overrideSpeed(final List blocks, final double speed) {
- return (ToolRule) (Object) Tool.Rule.overrideSpeed(blocks.stream().map(Block.class::cast).toList(), (float) speed);
+ final var holderSet = HolderSet.direct(blocks.stream().map(Block.class::cast).map(Block::builtInRegistryHolder).toList());
+ return (ToolRule) (Object) Tool.Rule.overrideSpeed(holderSet, (float) speed);
}
@Override
public ToolRule overrideSpeed(final Tag blockTypeTag, final double speed) {
- return (ToolRule) (Object) Tool.Rule.overrideSpeed((TagKey) (Object) blockTypeTag, (float) speed);
+ final var tag = (TagKey) (Object) blockTypeTag;
+ final var holderSet = BuiltInRegistries.BLOCK.get(tag).map(hs -> (HolderSet) hs).orElse(HolderSet.empty());
+ return (ToolRule) (Object) Tool.Rule.overrideSpeed(holderSet, (float) speed);
}
@Override
@@ -81,7 +91,8 @@ public ToolRule forBlocks(final List blocks, @Nullable final Double s
@Override
public ToolRule forTag(final Tag blockTypeTag, @Nullable final Double speed, @Nullable final Boolean drops) {
// See Tool#forTag
- final var holderSet = BuiltInRegistries.BLOCK.getOrCreateTag((TagKey) (Object) blockTypeTag);
+ final var tag = (TagKey) (Object) blockTypeTag;
+ final var holderSet = BuiltInRegistries.BLOCK.get(tag).map(hs -> (HolderSet) hs).orElse(HolderSet.empty());
return (ToolRule) (Object) new Tool.Rule(holderSet, Optional.ofNullable(speed).map(Double::floatValue), Optional.ofNullable(drops));
}
}
diff --git a/src/main/java/org/spongepowered/common/item/enchantment/SpongeRandomEnchantmentListBuilder.java b/src/main/java/org/spongepowered/common/item/enchantment/SpongeRandomEnchantmentListBuilder.java
index 1c8c25e8881..7c2699c0549 100644
--- a/src/main/java/org/spongepowered/common/item/enchantment/SpongeRandomEnchantmentListBuilder.java
+++ b/src/main/java/org/spongepowered/common/item/enchantment/SpongeRandomEnchantmentListBuilder.java
@@ -93,8 +93,8 @@ public List build() throws IllegalStateException {
if (this.pool == null || this.pool.isEmpty()) {
Objects.requireNonNull(this.item, "The item cannot be null");
this.randomSource.setSeed(this.seed + this.option);
- final var registry = SpongeCommon.server().registryAccess().registryOrThrow(Registries.ENCHANTMENT);
- var stream = registry.holders().map($$0x -> (Holder)$$0x);
+ final var registry = SpongeCommon.server().registryAccess().lookupOrThrow(Registries.ENCHANTMENT);
+ var stream = registry.listElements().map($$0x -> (Holder)$$0x);
enchantments = EnchantmentHelper.selectEnchantment(this.randomSource, ItemStackUtil.toNative(this.item), this.level, stream);
} else {
this.randomSource.setSeed(this.seed + this.option);
@@ -139,7 +139,7 @@ public static List fromNative(final List list)
}
public static List toNative(final List list) {
- final var registry = SpongeCommon.server().registryAccess().registryOrThrow(Registries.ENCHANTMENT);
+ final var registry = SpongeCommon.server().registryAccess().lookupOrThrow(Registries.ENCHANTMENT);
return list.stream().map(ench -> {
var mcEnch = registry.wrapAsHolder((net.minecraft.world.item.enchantment.Enchantment) (Object) ench.type());
return new EnchantmentInstance(mcEnch, ench.level());
diff --git a/src/main/java/org/spongepowered/common/item/recipe/SpongeRecipeRegistration.java b/src/main/java/org/spongepowered/common/item/recipe/SpongeRecipeRegistration.java
index 7688025bf6a..ceddabfb89a 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/SpongeRecipeRegistration.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/SpongeRecipeRegistration.java
@@ -35,6 +35,7 @@
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
import net.minecraft.core.NonNullList;
import net.minecraft.core.RegistryAccess;
+import net.minecraft.core.registries.Registries;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceLocation;
@@ -71,9 +72,10 @@ public SpongeRecipeRegistration(final ResourceLocation key,
this.key = key;
this.serializer = serializer;
this.pack = pack;
+ var rKey = net.minecraft.resources.ResourceKey.create(Registries.RECIPE, key);
this.advancement = Advancement.Builder.advancement()
- .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(key))
- .rewards(AdvancementRewards.Builder.recipe(key))
+ .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(rKey))
+ .rewards(AdvancementRewards.Builder.recipe(rKey))
.build(ResourceLocation.fromNamespaceAndPath(key.getNamespace(), "recipes/" + recipeCategory.getFolderName() + "/" + key.getPath()));
this.group = group == null ? "" : group;
}
@@ -101,12 +103,7 @@ public static boolean isVanillaSerializer(final ItemStac
if (!resultStack.getComponents().isEmpty() || resultFunction != null || remainingItemsFunction != null) {
return false;
}
- for (final Ingredient value : ingredients) {
- if (value instanceof SpongeIngredient) {
- return false;
- }
- }
- return true;
+ return ingredients.stream().noneMatch(value -> value instanceof SpongeIngredient);
}
@Override
diff --git a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeBlastingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeBlastingRecipe.java
index 6675d43b475..4d3223616b3 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeBlastingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeBlastingRecipe.java
@@ -59,12 +59,5 @@ public ItemStack assemble(final SingleRecipeInput $$0, final HolderLookup.Provid
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
-// if (this.resultFunction != null) {
-// return ItemStack.EMPTY;
-// }
- return super.getResultItem($$1);
- }
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCampfireCookingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCampfireCookingRecipe.java
index ecce010f0ab..6fd30630776 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCampfireCookingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCampfireCookingRecipe.java
@@ -59,12 +59,4 @@ public ItemStack assemble(final SingleRecipeInput $$0, final HolderLookup.Provid
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
- if (this.resultFunctionId != null) {
- return ItemStack.EMPTY;
- }
- return super.getResultItem($$1);
- }
-
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCookingRecipeRegistration.java b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCookingRecipeRegistration.java
index 040c5be9642..6a1b01b74e4 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCookingRecipeRegistration.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeCookingRecipeRegistration.java
@@ -47,7 +47,6 @@
import org.spongepowered.common.util.SpongeTicks;
import java.util.Collections;
-import java.util.List;
import java.util.function.Function;
public class SpongeCookingRecipeRegistration extends SpongeRecipeRegistration implements SpongeRecipeRegistration.ResultFunctionRegistration{
@@ -118,7 +117,7 @@ public Recipe recipe() {
final int ticksCookingTime = SpongeTicks.toSaturatedIntOrInfinite(this.cookingTime);
final String resultFunctionId = this.resultFunction == null ? null : this.key.toString();
- final List ingredientList = Collections.singletonList(ingredient);
+ final var ingredientList = Collections.singletonList(ingredient);
final boolean isVanilla = SpongeRecipeRegistration.isVanillaSerializer(this.spongeResult, this.resultFunction, null, ingredientList);
if (type == RecipeType.BLASTING) {
diff --git a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmeltingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmeltingRecipe.java
index 13e51a37ac7..cdd5b5e9999 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmeltingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmeltingRecipe.java
@@ -59,12 +59,4 @@ public ItemStack assemble(final SingleRecipeInput $$0, final HolderLookup.Provid
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
- if (this.resultFunctionId != null) {
- return ItemStack.EMPTY;
- }
- return super.getResultItem($$1);
- }
-
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmokingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmokingRecipe.java
index 5397cad2138..e761bb39b93 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmokingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/cooking/SpongeSmokingRecipe.java
@@ -59,13 +59,5 @@ public ItemStack assemble(final SingleRecipeInput $$0, final HolderLookup.Provid
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
- if (this.resultFunctionId != null) {
- return ItemStack.EMPTY;
- }
- return super.getResultItem($$1);
- }
-
}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java b/src/main/java/org/spongepowered/common/item/recipe/crafting/RecipeUtil.java
similarity index 54%
rename from src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java
rename to src/main/java/org/spongepowered/common/item/recipe/crafting/RecipeUtil.java
index a1b9f45069e..180026731e4 100644
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/crafting/RecipeUtil.java
@@ -22,31 +22,33 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package org.spongepowered.common.mixin.api.itemstacklike.item.inventory;
+package org.spongepowered.common.item.recipe.crafting;
-import org.spongepowered.api.item.inventory.Equipable;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.equipment.EquipmentType;
-import org.spongepowered.asm.mixin.Mixin;
+import net.minecraft.util.context.ContextMap;
+import net.minecraft.world.item.crafting.display.DisplayContentsFactory;
+import net.minecraft.world.item.crafting.display.SlotDisplayContext;
+import org.spongepowered.api.Sponge;
+import org.spongepowered.common.SpongeCommon;
-import java.util.function.Supplier;
+import java.util.List;
-@Mixin(value = Equipable.class, remap = false)
-public interface EquipableMixin_ItemStackLike {
+public final class RecipeUtil {
- default boolean canEquip(EquipmentType type, ItemStack equipment) {
- return ((Equipable) this).canEquip(type, equipment);
+ public static ContextMap serverBasedContextMap() {
+ if (!Sponge.isServerAvailable()) {
+ return new ContextMap.Builder().create(SlotDisplayContext.CONTEXT);
+ }
+ final var server = SpongeCommon.server();
+ return new ContextMap.Builder()
+ .withParameter(SlotDisplayContext.FUEL_VALUES, server.fuelValues())
+ .withParameter(SlotDisplayContext.REGISTRIES, server.registryAccess())
+ .create(SlotDisplayContext.CONTEXT);
}
- default boolean canEquip(Supplier extends EquipmentType> type, ItemStack equipment) {
- return ((Equipable) this).canEquip(type, equipment);
- }
-
- default boolean equip(EquipmentType type, ItemStack equipment) {
- return ((Equipable) this).equip(type, equipment);
- }
-
- default boolean equip(Supplier extends EquipmentType> type, ItemStack equipment) {
- return ((Equipable) this).equip(type, equipment);
+ public class RemainderResolver implements DisplayContentsFactory.ForRemainders {
+ @Override
+ public T addRemainder(T var1, List var2) {
+ return null;
+ }
}
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/crafting/custom/SpongeSpecialRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/crafting/custom/SpongeSpecialRecipe.java
index 09531ed46b4..bc2ec36d749 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/crafting/custom/SpongeSpecialRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/crafting/custom/SpongeSpecialRecipe.java
@@ -36,14 +36,11 @@
import net.minecraft.world.item.crafting.CustomRecipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.Level;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.common.inventory.util.InventoryUtil;
import org.spongepowered.common.item.util.ItemStackUtil;
import org.spongepowered.common.util.Constants;
-import org.spongepowered.common.util.MissingImplementationException;
import java.util.List;
import java.util.function.BiPredicate;
@@ -91,12 +88,6 @@ public ItemStack assemble(final CraftingInput input, final HolderLookup.Provider
return ItemStackUtil.toNative(this.resultFunction.apply(InventoryUtil.toSponge(input)));
}
- @OnlyIn(Dist.CLIENT)
- @Override
- public boolean canCraftInDimensions(int width, int height) {
- throw new MissingImplementationException("SpongeSpecialRecipe", "canFit");
- }
-
@Override
public NonNullList getRemainingItems(final CraftingInput input) {
if (this.remainingItemsFunction == null) {
@@ -109,7 +100,7 @@ public NonNullList getRemainingItems(final CraftingInput input) {
}
@Override
- public RecipeSerializer> getSerializer() {
+ public RecipeSerializer extends CustomRecipe> getSerializer() {
// Fake special crafting serializer
// because of Unknown recipe serializer when using our serializer with a vanilla client
// return Registry.RECIPE_SERIALIZER.getOrDefault(this.id());
diff --git a/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedCraftingRecipeRegistration.java b/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedCraftingRecipeRegistration.java
index b65c5c09b99..8574bdcfaeb 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedCraftingRecipeRegistration.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedCraftingRecipeRegistration.java
@@ -39,6 +39,7 @@
import org.spongepowered.api.item.recipe.crafting.ShapedCraftingRecipe;
import org.spongepowered.common.item.recipe.SpongeRecipeRegistration;
+import java.util.Optional;
import java.util.function.Function;
public class SpongeShapedCraftingRecipeRegistration extends SpongeRecipeRegistration implements
@@ -79,7 +80,8 @@ public Function> remainingItems() {
@Override
public Recipe recipe() {
- if (SpongeRecipeRegistration.isVanillaSerializer(this.spongeResult, this.resultFunction, this.remainingItemsFunction, this.pattern.ingredients())) {
+ final var ingredients = this.pattern.ingredients().stream().filter(Optional::isPresent).map(Optional::get).toList();
+ if (SpongeRecipeRegistration.isVanillaSerializer(this.spongeResult, this.resultFunction, this.remainingItemsFunction, ingredients)) {
return (ShapedCraftingRecipe) new ShapedRecipe(this.group, this.craftingBookCategory, this.pattern, this.spongeResult, this.showNotification);
}
this.ensureCached();
diff --git a/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedRecipe.java
index 0dd447c0c7c..6ce7547a3f7 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/crafting/shaped/SpongeShapedRecipe.java
@@ -48,7 +48,7 @@ public class SpongeShapedRecipe extends ShapedRecipe implements ResultFunctionRe
public static final MapCodec SPONGE_CODEC = RecordCodecBuilder.mapCodec(
$$0 -> $$0.group(
Codec.STRING.fieldOf(Constants.Recipe.SPONGE_TYPE).forGetter(t -> "custom"), // important to fail early when decoding vanilla recipes
- Codec.STRING.optionalFieldOf(Constants.Recipe.GROUP, "").forGetter(ShapedRecipe::getGroup),
+ Codec.STRING.optionalFieldOf(Constants.Recipe.GROUP, "").forGetter(ShapedRecipe::group),
CraftingBookCategory.CODEC.fieldOf(Constants.Recipe.CATEGORY).orElse(CraftingBookCategory.MISC).forGetter(ShapedRecipe::category),
ShapedRecipePattern.MAP_CODEC.forGetter($$0x -> ((ShapedRecipeBridge) $$0x).bridge$pattern()),
ItemStack.CODEC.fieldOf(Constants.Recipe.RESULT).forGetter($$0x -> ((RecipeResultBridge)$$0x).bridge$result()),
@@ -118,12 +118,4 @@ public ItemStack assemble(final CraftingInput $$0, final HolderLookup.Provider $
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$0) {
- if (this.resultFunctionId != null) {
- return ItemStack.EMPTY;
- }
- return super.getResultItem($$0);
- }
-
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/crafting/shapeless/SpongeShapelessRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/crafting/shapeless/SpongeShapelessRecipe.java
index 8090a7189f6..daed310a648 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/crafting/shapeless/SpongeShapelessRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/crafting/shapeless/SpongeShapelessRecipe.java
@@ -25,7 +25,6 @@
package org.spongepowered.common.item.recipe.crafting.shapeless;
import com.mojang.serialization.Codec;
-import com.mojang.serialization.DataResult;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.HolderLookup;
@@ -36,6 +35,7 @@
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.ShapelessRecipe;
import net.minecraft.world.level.Level;
+import org.spongepowered.common.accessor.world.item.crafting.ShapelessRecipeAccessor;
import org.spongepowered.common.bridge.world.item.crafting.RecipeResultBridge;
import org.spongepowered.common.item.recipe.ingredient.IngredientResultUtil;
import org.spongepowered.common.item.recipe.ingredient.SpongeIngredient;
@@ -60,26 +60,12 @@ public class SpongeShapelessRecipe extends ShapelessRecipe {
public static final MapCodec SPONGE_CODEC = RecordCodecBuilder.mapCodec(
$$0 -> $$0.group(
Codec.STRING.fieldOf(Constants.Recipe.SPONGE_TYPE).forGetter(t -> "custom"), // important to fail early when decoding vanilla recipes
- Codec.STRING.optionalFieldOf("group", "").forGetter(ShapelessRecipe::getGroup),
+ Codec.STRING.optionalFieldOf("group", "").forGetter(ShapelessRecipe::group),
CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(ShapelessRecipe::category),
ItemStack.CODEC.fieldOf(Constants.Recipe.RESULT).forGetter($$0x -> ((RecipeResultBridge)$$0x).bridge$result()),
- Ingredient.CODEC_NONEMPTY
- .listOf()
+ Ingredient.CODEC.listOf(1,9)
.fieldOf(Constants.Recipe.SHAPELESS_INGREDIENTS)
- .flatXmap(
- $$0x -> {
- Ingredient[] $$1 = $$0x.stream().filter($$0xx -> !$$0xx.isEmpty()).toArray(Ingredient[]::new);
- if ($$1.length == 0) {
- return DataResult.error(() -> "No ingredients for shapeless recipe");
- } else {
- return $$1.length > 9
- ? DataResult.error(() -> "Too many ingredients for shapeless recipe")
- : DataResult.success(NonNullList.of(Ingredient.EMPTY, $$1));
- }
- },
- DataResult::success
- )
- .forGetter(ShapelessRecipe::getIngredients),
+ .forGetter(sr -> ((ShapelessRecipeAccessor) sr).accessor$ingredients()),
IngredientResultUtil.CACHED_RESULT_FUNC_CODEC.optionalFieldOf(Constants.Recipe.SPONGE_RESULTFUNCTION).forGetter(SpongeShapelessRecipe::resultFunctionId),
IngredientResultUtil.CACHED_REMAINING_FUNC_CODEC.optionalFieldOf(Constants.Recipe.SPONGE_REMAINING_ITEMS).forGetter(SpongeShapelessRecipe::remainingItemsFunctionId)
)
@@ -96,7 +82,7 @@ public static SpongeShapelessRecipe of(
final String groupIn,
final CraftingBookCategory category,
final ItemStack recipeOutputIn,
- final NonNullList recipeItemsIn,
+ final List recipeItemsIn,
final Optional resultFunctionId,
final Optional remainingItemsFunctionId)
{
@@ -106,7 +92,7 @@ public static SpongeShapelessRecipe of(
public SpongeShapelessRecipe(final String groupIn,
final CraftingBookCategory category,
- final NonNullList recipeItemsIn,
+ final List recipeItemsIn,
final ItemStack spongeResultStack,
final String resultFunctionId,
final String remainingItemsFunctionId) {
@@ -129,7 +115,7 @@ public boolean matches(final CraftingInput $$0, final Level $$1) {
if (this.onlyVanillaIngredients) {
return super.matches($$0, $$1);
}
- return SpongeShapelessRecipe.matches($$0.items(), this.getIngredients());
+ return SpongeShapelessRecipe.matches($$0.items(), ((ShapelessRecipeAccessor) this).accessor$ingredients());
}
@Override
@@ -149,14 +135,6 @@ public ItemStack assemble(final CraftingInput $$0, final HolderLookup.Provider $
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
-// if (this.resultFunctionId != null) {
-// return ItemStack.EMPTY;
-// }
- return super.getResultItem($$1);
- }
-
private static boolean
matches(List stacks, List ingredients) {
final int elements = ingredients.size();
diff --git a/src/main/java/org/spongepowered/common/item/recipe/ingredient/IngredientUtil.java b/src/main/java/org/spongepowered/common/item/recipe/ingredient/IngredientUtil.java
index 23c02c5921f..228ba81923a 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/ingredient/IngredientUtil.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/ingredient/IngredientUtil.java
@@ -24,6 +24,8 @@
*/
package org.spongepowered.common.item.recipe.ingredient;
+import net.minecraft.core.HolderSet;
+import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
@@ -59,7 +61,8 @@ public static org.spongepowered.api.item.recipe.crafting.Ingredient of(ItemType.
public static org.spongepowered.api.item.recipe.crafting.@Nullable Ingredient of(ResourceKey tagKey) {
final TagKey- key = TagKey.create(Registries.ITEM, (ResourceLocation) (Object) tagKey);
- return IngredientUtil.fromNative(Ingredient.of(key));
+ var holderset = BuiltInRegistries.ITEM.get(key).map(hs -> (HolderSet
- ) hs).orElse(HolderSet.empty());
+ return IngredientUtil.fromNative(Ingredient.of(holderset));
}
private static net.minecraft.world.item.ItemStack[] toNativeStacks(ItemStack[] stacks) {
diff --git a/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeIngredient.java b/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeIngredient.java
index 887b9e888ff..bbb97b5c596 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeIngredient.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeIngredient.java
@@ -28,6 +28,7 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.codecs.RecordCodecBuilder;
+import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
@@ -44,7 +45,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
-import java.util.stream.Stream;
public class SpongeIngredient extends Ingredient {
@@ -83,8 +83,8 @@ public class SpongeIngredient extends Ingredient {
if (predicate == null) {
return DataResult.error(() -> "Could not find predicate for custom ingredient with id " + raw.predicateId.get());
}
- final SpongeIngredient ingredient = new SpongeIngredient(raw.type,
- new SpongePredicateItemList(raw.predicateId.get(), predicate, raw.stacks.toArray(new ItemStack[0])), raw.predicateId.orElse(null));
+ final var predicateList = new SpongePredicateItemList(raw.predicateId.get(), predicate, raw.stacks.toArray(new ItemStack[0]));
+ final SpongeIngredient ingredient = new SpongeIngredient(raw.type, predicateList, raw.predicateId.orElse(null));
return DataResult.success(ingredient);
}
default -> {
@@ -94,7 +94,7 @@ public class SpongeIngredient extends Ingredient {
}, spongeIngredient -> {
switch (spongeIngredient.type) {
case SpongeStackItemList.TYPE_STACK -> {
- var stacks = Arrays.stream(spongeIngredient.values).flatMap(v -> v.getItems().stream()).toList();
+ final var stacks = Arrays.asList(spongeIngredient.itemList.stacks);
return DataResult.success(new SpongeRawIngredient(spongeIngredient.type, stacks, Optional.empty()));
}
case SpongePredicateItemList.TYPE_PREDICATE -> {
@@ -105,19 +105,17 @@ public class SpongeIngredient extends Ingredient {
});
public final String type;
public final String predicateId;
+ private final SpongeItemList itemList;
record SpongeRawIngredient(String type, List stacks, Optional predicateId) {
}
- public SpongeIngredient(final String type, final Stream extends Ingredient.Value> values, final String predicateId) {
- super(values);
+ public SpongeIngredient(final String type, final SpongeItemList itemList, final String predicateId) {
+ super(HolderSet.direct(itemList.stream().toList()));
this.type = type;
this.predicateId = predicateId;
- }
-
- public SpongeIngredient(final String type, final Ingredient.Value value, final String predicateId) {
- this(type, Stream.of(value), predicateId);
+ this.itemList = itemList;
}
public static void clearCache() {
@@ -130,22 +128,7 @@ public boolean test(final ItemStack testStack) {
return false;
}
- for (final Value acceptedItem : this.values) {
- if (acceptedItem instanceof SpongeItemList) {
- if (((SpongeItemList) acceptedItem).test(testStack)) {
- return true;
- }
- } else {
- // TODO caching (relevant for TagList)
- for (final ItemStack stack : acceptedItem.getItems()) {
- if (stack.getItem() == testStack.getItem()) {
- return true;
- }
- }
- }
- }
-
- return false;
+ return this.itemList.test(testStack);
}
public static SpongeIngredient spongeFromStacks(net.minecraft.world.item.ItemStack... stacks) {
diff --git a/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeItemList.java b/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeItemList.java
index 80def6626f2..27a5e0a08b4 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeItemList.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/ingredient/SpongeItemList.java
@@ -26,13 +26,25 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+import com.mojang.datafixers.util.Either;
+import net.minecraft.Util;
+import net.minecraft.core.Holder;
+import net.minecraft.core.HolderOwner;
+import net.minecraft.core.HolderSet;
+import net.minecraft.tags.TagKey;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.crafting.Ingredient;
+import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
-public abstract class SpongeItemList implements Ingredient.Value {
+public abstract class SpongeItemList implements HolderSet
- {
public static final String INGREDIENT_TYPE = "sponge:type";
public static final String INGREDIENT_ITEM = "sponge:item";
@@ -44,6 +56,62 @@ public SpongeItemList(ItemStack... stacks) {
}
@Override
+ public Stream> stream() {
+ return Arrays.stream(this.stacks)
+ .map(ItemStack::getItemHolder);
+ }
+
+ @Override
+ public int size() {
+ return this.stacks.length;
+ }
+
+ @Override
+ public boolean isBound() {
+ return true;
+ }
+
+ @Override
+ public Either, List>> unwrap() {
+ return Either.right(this.stream().toList());
+ }
+
+ @Override
+ public Optional> getRandomElement(RandomSource source) {
+ return this.stacks.length == 0 ? Optional.empty() :
+ Optional.of(Util.getRandom(this.stacks, source)).
+ map(ItemStack::getItemHolder);
+ }
+
+ @Override
+ public Holder
- get(int var1) {
+ final var stack = this.stacks[var1];
+ return stack.getItemHolder();
+ }
+
+ @Override
+ public boolean contains(Holder
- var1) {
+ return false;
+ }
+
+ @Override
+ public boolean canSerializeIn(HolderOwner
- var1) {
+ // TODO - maybe? What's this for?
+ return true;
+ }
+
+ @Override
+ public Optional> unwrapKey() {
+ return Optional.empty();
+ }
+
+ @Override
+ public @NotNull Iterator> iterator() {
+ return Arrays.stream(this.stacks)
+ .map(ItemStack::getItemHolder)
+ .iterator();
+ }
+
public Collection getItems() {
return Arrays.asList(this.stacks);
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipe.java
index bff50643488..42e3cf263b2 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipe.java
@@ -47,9 +47,9 @@ public class SpongeSmithingRecipe extends SmithingTransformRecipe implements Res
public static final MapCodec SPONGE_CODEC = RecordCodecBuilder.mapCodec(
$$0 -> $$0.group(
Codec.STRING.fieldOf(SPONGE_TYPE).forGetter(a -> "custom"),
- Ingredient.CODEC.fieldOf("template").forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$template()),
- Ingredient.CODEC.fieldOf(Constants.Recipe.SMITHING_BASE_INGREDIENT).forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$base()),
- Ingredient.CODEC.fieldOf(Constants.Recipe.SMITHING_ADDITION_INGREDIENT).forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$addition()),
+ Ingredient.CODEC.optionalFieldOf(Constants.Recipe.SMITHING_TEMPLATE_INGREDIENT).forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$template()),
+ Ingredient.CODEC.optionalFieldOf(Constants.Recipe.SMITHING_BASE_INGREDIENT).forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$base()),
+ Ingredient.CODEC.optionalFieldOf(Constants.Recipe.SMITHING_ADDITION_INGREDIENT).forGetter($$0x -> ((SmithingRecipeBridge) $$0x).bridge$addition()),
ItemStack.CODEC.fieldOf(Constants.Recipe.RESULT).forGetter($$0x -> ((RecipeResultBridge) $$0x).bridge$result()),
IngredientResultUtil.CACHED_RESULT_FUNC_CODEC.optionalFieldOf(Constants.Recipe.SPONGE_RESULTFUNCTION).forGetter(ResultFunctionRecipe::resultFunctionId)
)
@@ -58,14 +58,14 @@ public class SpongeSmithingRecipe extends SmithingTransformRecipe implements Res
private final String resultFunctionId;
- public static SpongeSmithingRecipe of(final String spongeType, final Ingredient template, final Ingredient base,
- final Ingredient addition, final ItemStack resultIn, final Optional resultFunctionId)
+ public static SpongeSmithingRecipe of(final String spongeType, final Optional template, final Optional base,
+ final Optional addition, final ItemStack resultIn, final Optional resultFunctionId)
{
return new SpongeSmithingRecipe(template, base, addition, resultIn, resultFunctionId.orElse(null));
}
- public SpongeSmithingRecipe(final Ingredient template, final Ingredient base,
- final Ingredient addition, final ItemStack spongeResult, final String resultFunctionId) {
+ public SpongeSmithingRecipe(final Optional template, final Optional base,
+ final Optional addition, final ItemStack spongeResult, final String resultFunctionId) {
super(template, base, addition, spongeResult);
this.resultFunctionId = resultFunctionId;
}
@@ -81,25 +81,7 @@ public ItemStack assemble(final SmithingRecipeInput $$0, final HolderLookup.Prov
return IngredientResultUtil.cachedResultFunction(this.resultFunctionId).apply($$0);
}
- final ItemStack resultItem = this.getResultItem($$1);
- if (!resultItem.getComponents().isEmpty()) {
- final ItemStack itemStack = resultItem.copy();
- var patch = $$0.getItem(0).getComponentsPatch();
- if (!patch.isEmpty()) {
- itemStack.applyComponents(patch);
- return itemStack;
- }
- }
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(HolderLookup.Provider $$1) {
- if (this.resultFunctionId != null) {
- return ItemStack.EMPTY;
- }
- return super.getResultItem($$1);
- }
-
-
}
diff --git a/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipeRegistration.java b/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipeRegistration.java
index 39a62cbb37a..26261ca7cc3 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipeRegistration.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/smithing/SpongeSmithingRecipeRegistration.java
@@ -38,6 +38,7 @@
import org.spongepowered.common.item.recipe.SpongeRecipeRegistration;
import java.util.List;
+import java.util.Optional;
import java.util.function.Function;
public class SpongeSmithingRecipeRegistration extends SpongeRecipeRegistration implements
@@ -68,10 +69,11 @@ public SpongeSmithingRecipeRegistration(ResourceLocation key, String group, fina
public Recipe recipe() {
this.ensureCached();
if (SpongeRecipeRegistration.isVanillaSerializer(this.spongeResult, this.resultFunction, null, List.of(this.template, this.base, this.addition))) {
- return (SmithingRecipe) new SmithingTransformRecipe(this.template, this.base, this.addition, this.spongeResult);
+ return (SmithingRecipe) new SmithingTransformRecipe(Optional.of(this.template), Optional.of(this.base), Optional.of(this.addition), this.spongeResult);
}
- return (SmithingRecipe) new SpongeSmithingRecipe(this.template, this.base, this.addition, this.spongeResult, this.resultFunction == null ? null : this.key.toString());
+ return (SmithingRecipe) new SpongeSmithingRecipe(Optional.ofNullable(this.template), Optional.ofNullable(this.base), Optional.ofNullable(this.addition),
+ this.spongeResult, this.resultFunction == null ? null : this.key.toString());
}
@Override
diff --git a/src/main/java/org/spongepowered/common/item/recipe/stonecutting/SpongeStonecuttingRecipe.java b/src/main/java/org/spongepowered/common/item/recipe/stonecutting/SpongeStonecuttingRecipe.java
index a2401eadcd8..7cc74df448e 100644
--- a/src/main/java/org/spongepowered/common/item/recipe/stonecutting/SpongeStonecuttingRecipe.java
+++ b/src/main/java/org/spongepowered/common/item/recipe/stonecutting/SpongeStonecuttingRecipe.java
@@ -57,9 +57,9 @@ public class SpongeStonecuttingRecipe extends StonecutterRecipe implements Resul
public static final MapCodec SPONGE_CODEC = RecordCodecBuilder.mapCodec(
$$1 -> $$1.group(
Codec.STRING.fieldOf(SPONGE_TYPE).forGetter(a -> "custom"),
- Codec.STRING.optionalFieldOf("group", "").forGetter(SingleItemRecipe::getGroup),
- Ingredient.CODEC_NONEMPTY.fieldOf(Constants.Recipe.STONECUTTING_INGREDIENT).forGetter($$0x -> $$0x.getIngredients().get(0)),
- RESULT_CODEC.forGetter($$0x -> ((RecipeResultBridge)$$0x).bridge$result()),
+ Codec.STRING.optionalFieldOf("group", "").forGetter(SingleItemRecipe::group),
+ Ingredient.CODEC.fieldOf(Constants.Recipe.STONECUTTING_INGREDIENT).forGetter(SingleItemRecipe::input),
+ RESULT_CODEC.forGetter($$0x -> $$0x.result()),
ItemStack.CODEC.optionalFieldOf(Constants.Recipe.SPONGE_RESULT, ItemStack.EMPTY).forGetter($$0x -> ((RecipeResultBridge)$$0x).bridge$spongeResult()),
IngredientResultUtil.CACHED_RESULT_FUNC_CODEC.optionalFieldOf(Constants.Recipe.SPONGE_RESULTFUNCTION).forGetter(ResultFunctionRecipe::resultFunctionId)
)
@@ -95,12 +95,4 @@ public ItemStack assemble(final SingleRecipeInput $$0, final HolderLookup.Provid
return super.assemble($$0, $$1);
}
- @Override
- public ItemStack getResultItem(final HolderLookup.Provider $$1) {
-// if (this.resultFunctionId != null) {
-// return ItemStack.EMPTY;
-// }
- return super.getResultItem($$1);
- }
-
}
diff --git a/src/main/java/org/spongepowered/common/network/packet/SpongePacketHandler.java b/src/main/java/org/spongepowered/common/network/packet/SpongePacketHandler.java
index a77808af907..7c611271f66 100644
--- a/src/main/java/org/spongepowered/common/network/packet/SpongePacketHandler.java
+++ b/src/main/java/org/spongepowered/common/network/packet/SpongePacketHandler.java
@@ -99,7 +99,7 @@ public static void init(final SpongeChannelManager registry) {
return;
}
- final DimensionType dimensionType = SpongeCommon.vanillaRegistry(Registries.DIMENSION_TYPE).get(packet.dimensionLogic);
+ final DimensionType dimensionType = SpongeCommon.vanillaRegistry(Registries.DIMENSION_TYPE).getValue(packet.dimensionLogic);
((ClientLevelAccessor) world).accessor$effects(DimensionSpecialEffects.forType(dimensionType));
}
);
diff --git a/src/main/java/org/spongepowered/common/registry/ProxiedRegistryAccess.java b/src/main/java/org/spongepowered/common/registry/ProxiedRegistryAccess.java
deleted file mode 100644
index f37c2ef7ac5..00000000000
--- a/src/main/java/org/spongepowered/common/registry/ProxiedRegistryAccess.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.registry;
-
-import net.minecraft.core.Registry;
-import net.minecraft.core.RegistryAccess;
-import net.minecraft.resources.ResourceKey;
-import org.checkerframework.checker.nullness.qual.Nullable;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-public final class ProxiedRegistryAccess implements RegistryAccess {
-
- private final RegistryAccess access;
- private final Map>, Registry>> overrides;
-
- public ProxiedRegistryAccess(final RegistryAccess access, final Map>, Registry>> overrides) {
- this.access = access;
- this.overrides = Map.copyOf(overrides);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Optional> registry(final ResourceKey extends Registry extends E>> var1) {
- final @Nullable Registry> override = this.overrides.get(var1);
- if (override != null) {
- return Optional.of((Registry) override);
- }
- return this.access.registry(var1);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- public Stream> registries() {
- return Stream.concat(
- this.access.registries().filter(entry -> !this.overrides.containsKey(entry.key())),
- (Stream>) (Stream) this.overrides.entrySet().stream().map(entry -> new RegistryAccess.RegistryEntry(entry.getKey(), entry.getValue()))
- );
- }
-
-}
diff --git a/src/main/java/org/spongepowered/common/registry/RegistryHolderLogic.java b/src/main/java/org/spongepowered/common/registry/RegistryHolderLogic.java
index 5b1d397126f..2e48e15fb31 100644
--- a/src/main/java/org/spongepowered/common/registry/RegistryHolderLogic.java
+++ b/src/main/java/org/spongepowered/common/registry/RegistryHolderLogic.java
@@ -94,14 +94,12 @@ public void setRootMinecraftRegistry(final net.minecraft.core.Registry Registry registry(final RegistryType type) {
- final net.minecraft.core.Registry> root = this.roots.get(Objects.requireNonNull(type, "type").root());
+ final var root = this.roots.get(Objects.requireNonNull(type, "type").root());
if (root == null) {
throw new ValueNotFoundException(String.format("No '%s' root registry has been defined", type.root()));
}
- final net.minecraft.core.Registry> registry = root.get((ResourceLocation) (Object) type.location());
- if (registry == null) {
- throw new ValueNotFoundException(String.format("No '%s' registry has been defined in root '%s'", type.location(), type.root()));
- }
+ final var registry = root.getOptional((ResourceLocation) (Object) type.location())
+ .orElseThrow(() -> new ValueNotFoundException(String.format("No '%s' registry has been defined in root '%s'", type.location(), type.root())));
return (Registry) registry;
}
@@ -161,7 +159,7 @@ public Registry createRegistry(final RegistryType type, final @Nullabl
if (root == null) {
throw new ValueNotFoundException(String.format("No '%s' root registry has been defined", type.root()));
}
- net.minecraft.core.Registry> registry = root.get((ResourceLocation) (Object) type.location());
+ var registry = root.getValue((ResourceLocation) (Object) type.location());
final boolean exists = registry != null;
if (!replace && exists) {
throw new DuplicateRegistrationException(String.format("Registry '%s' in root '%s' has already been defined", type.location(), type.root()));
diff --git a/src/main/java/org/spongepowered/common/registry/loader/CommandRegistryLoader.java b/src/main/java/org/spongepowered/common/registry/loader/CommandRegistryLoader.java
index 4b6f07a7b43..f0c4ab3d9c8 100644
--- a/src/main/java/org/spongepowered/common/registry/loader/CommandRegistryLoader.java
+++ b/src/main/java/org/spongepowered/common/registry/loader/CommandRegistryLoader.java
@@ -217,7 +217,7 @@ public static RegistryLoader clientCompletionType() {
public static RegistryLoader clientSuggestionProvider() {
return RegistryLoader.of(l -> {
// TODO based on SuggestionProviders.PROVIDERS_BY_NAME instead
- l.add(CommandCompletionProviders.ALL_RECIPES, k -> (CommandCompletionProvider) SuggestionProviders.ALL_RECIPES);
+// l.add(CommandCompletionProviders.ALL_RECIPES, k -> (CommandCompletionProvider) SuggestionProviders.ALL_RECIPES);
l.add(CommandCompletionProviders.AVAILABLE_SOUNDS, k -> (CommandCompletionProvider) SuggestionProviders.AVAILABLE_SOUNDS);
l.add(CommandCompletionProviders.SUMMONABLE_ENTITIES, k -> (CommandCompletionProvider) SuggestionProviders.SUMMONABLE_ENTITIES);
});
@@ -293,7 +293,7 @@ public static RegistryLoader> commandRegistrarType() {
// Helper
static ArgumentType> argumentTypeFromKey(ResourceKey key, CommandBuildContext ctx) {
- final ArgumentTypeInfo,?> argumentTypeInfo = BuiltInRegistries.COMMAND_ARGUMENT_TYPE.get((ResourceLocation) (Object) key);
+ final ArgumentTypeInfo,?> argumentTypeInfo = BuiltInRegistries.COMMAND_ARGUMENT_TYPE.getValue((ResourceLocation) (Object) key);
if (argumentTypeInfo instanceof SingletonArgumentInfo> s) {
return s.unpack(null).instantiate(ctx);
}
diff --git a/src/main/java/org/spongepowered/common/registry/loader/SpongeRegistryLoader.java b/src/main/java/org/spongepowered/common/registry/loader/SpongeRegistryLoader.java
index de3bfb4931a..54cc7107c21 100644
--- a/src/main/java/org/spongepowered/common/registry/loader/SpongeRegistryLoader.java
+++ b/src/main/java/org/spongepowered/common/registry/loader/SpongeRegistryLoader.java
@@ -581,7 +581,7 @@ public static RegistryLoader noiseConfig() {
}
public static RegistryLoader flatGeneratorConfig(RegistryAccess registryAccess) {
- final Registry registry = registryAccess.registryOrThrow(Registries.FLAT_LEVEL_GENERATOR_PRESET);
+ final Registry registry = registryAccess.lookupOrThrow(Registries.FLAT_LEVEL_GENERATOR_PRESET);
return RegistryLoader.of(l -> {
for (final var entry : registry.entrySet()) {
l.add(RegistryKey.of(RegistryTypes.FLAT_GENERATOR_CONFIG, (ResourceKey) (Object) entry.getKey().location()), () -> (FlatGeneratorConfig) entry.getValue().settings());
diff --git a/src/main/java/org/spongepowered/common/registry/loader/VanillaRegistryLoader.java b/src/main/java/org/spongepowered/common/registry/loader/VanillaRegistryLoader.java
index 8dd24c87c8d..8a2491cc8d2 100644
--- a/src/main/java/org/spongepowered/common/registry/loader/VanillaRegistryLoader.java
+++ b/src/main/java/org/spongepowered/common/registry/loader/VanillaRegistryLoader.java
@@ -54,12 +54,11 @@
import net.minecraft.world.entity.player.ChatVisiblity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.raid.Raid;
-import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Rarity;
-import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.component.FireworkExplosion;
+import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
@@ -142,6 +141,17 @@ private void loadInstanceRegistries() {
map.put(EnderDragonPhase.HOVERING, "hover");
}, phase -> CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, ((EnderDragonPhaseAccessor) phase).accessor$name()));
this.holder.createRegistry(RegistryTypes.FIREWORK_SHAPE, VanillaRegistryLoader.fireworkShape());
+// final var materials = new HashMap();
+// materials.put(ArmorMaterials.LEATHER, ArmorMaterials.LEATHER.modelId().toString());
+// materials.put(ArmorMaterials.CHAIN, ArmorMaterials.CHAIN.modelId().toString());
+// materials.put(ArmorMaterials.IRON, ArmorMaterials.IRON.modelId().toString());
+// materials.put(ArmorMaterials.GOLD, ArmorMaterials.GOLD.modelId().toString());
+// materials.put(ArmorMaterials.DIAMOND, ArmorMaterials.DIAMOND.modelId().toString());
+// materials.put(ArmorMaterials.TURTLE_SCUTE, ResourceKey.minecraft("turtle").toString());
+// materials.put(ArmorMaterials.NETHERITE, ArmorMaterials.NETHERITE.modelId().toString());
+// materials.put(ArmorMaterials.ARMADILLO_SCUTE, ArmorMaterials.ARMADILLO_SCUTE.modelId().toString());
+//
+// this.naming(RegistryTypes.ARMOR_MATERIAL, materials.keySet().toArray(new ArmorMaterial[]{}), materials);
this.knownName(RegistryTypes.GAME_RULE, GameRulesAccessor.accessor$GAME_RULE_TYPES().keySet(), rule -> CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, rule.getId()));
}
@@ -155,7 +165,6 @@ private void loadEnumRegistries() {
map.put(AttributeModifier.Operation.ADD_MULTIPLIED_BASE, "multiply_base");
map.put(AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL, "multiply_total");
});
- this.automaticName(RegistryTypes.BOAT_TYPE, Boat.Type.values());
this.automaticName(RegistryTypes.CHEST_ATTACHMENT_TYPE, ChestType.values());
this.automaticName(RegistryTypes.COLLISION_RULE, Team.CollisionRule.values());
this.automaticName(RegistryTypes.COMPARATOR_MODE, ComparatorMode.values());
@@ -165,15 +174,16 @@ private void loadEnumRegistries() {
this.automaticName(RegistryTypes.DRIPSTONE_SEGMENT, DripstoneThickness.values());
this.automaticName(RegistryTypes.EQUIPMENT_GROUP, EquipmentSlot.Type.values());
this.automaticName(RegistryTypes.EQUIPMENT_TYPE, EquipmentSlot.values());
- this.automaticName(RegistryTypes.FOX_TYPE, Fox.Type.values());
+ this.automaticName(RegistryTypes.FOX_TYPE, Fox.Variant.values());
this.automaticName(RegistryTypes.GAME_MODE, GameType.values());
this.automaticName(RegistryTypes.HAND_PREFERENCE, HumanoidArm.values());
this.automaticName(RegistryTypes.HAND_TYPE, InteractionHand.values());
this.automaticName(RegistryTypes.INSTRUMENT_TYPE, NoteBlockInstrument.values());
this.automaticName(RegistryTypes.ITEM_RARITY, Rarity.values());
- this.automaticName(RegistryTypes.ITEM_TIER, Tiers.values());
+ // TODO - Figure out if we should make a registry - Snapshot 24w34a
+// this.automaticName(RegistryTypes.ITEM_TIER, ToolMaterial.values());
this.automaticName(RegistryTypes.JIGSAW_BLOCK_ORIENTATION, FrontAndTop.values());
- this.automaticName(RegistryTypes.MOOSHROOM_TYPE, MushroomCow.MushroomType.values());
+ this.automaticName(RegistryTypes.MOOSHROOM_TYPE, MushroomCow.Variant.values());
this.automaticName(RegistryTypes.OBJECTIVE_DISPLAY_MODE, ObjectiveCriteria.RenderType.values());
this.automaticName(RegistryTypes.PANDA_GENE, Panda.Gene.values());
this.automaticName(RegistryTypes.PHANTOM_PHASE, Phantom.AttackPhase.values());
@@ -202,7 +212,6 @@ private void loadEnumRegistries() {
this.automaticName(RegistryTypes.GRASS_COLOR_MODIFIER, BiomeSpecialEffects.GrassColorModifier.values());
this.automaticName(RegistryTypes.PRECIPITATION, Biome.Precipitation.values());
this.automaticName(RegistryTypes.TEMPERATURE_MODIFIER, Biome.TemperatureModifier.values());
- this.automaticName(RegistryTypes.CARVING_STEP, GenerationStep.Carving.values());
this.automaticName(RegistryTypes.DECORATION_STEP, GenerationStep.Decoration.values());
this.automaticName(RegistryTypes.PARROT_TYPE, Parrot.Variant.values());
this.automaticName(RegistryTypes.RABBIT_TYPE, Rabbit.Variant.values());
@@ -219,6 +228,7 @@ private void loadEnumRegistries() {
this.automaticName(RegistryTypes.PUSH_REACTION, PushReaction.values());
this.automaticName(RegistryTypes.TRIAL_SPAWNER_STATE, TrialSpawnerState.values());
this.automaticName(RegistryTypes.VAULT_STATE, VaultState.values());
+ this.automaticName(RegistryTypes.EXPLOSION_BLOCK_INTERACTION, Explosion.BlockInteraction.values());
}
private static RegistryLoader criterion() {
diff --git a/src/main/java/org/spongepowered/common/util/DirectionUtil.java b/src/main/java/org/spongepowered/common/util/DirectionUtil.java
index dcbede764bb..d7d8dd9365f 100644
--- a/src/main/java/org/spongepowered/common/util/DirectionUtil.java
+++ b/src/main/java/org/spongepowered/common/util/DirectionUtil.java
@@ -25,7 +25,7 @@
package org.spongepowered.common.util;
-import net.minecraft.world.level.block.state.properties.DirectionProperty;
+import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.spongepowered.api.util.Direction;
import java.util.Objects;
@@ -34,45 +34,31 @@ public final class DirectionUtil {
public static net.minecraft.core.Direction getFor(final Direction direction) {
Objects.requireNonNull(direction);
- switch (direction) {
- case UP:
- return net.minecraft.core.Direction.UP;
- case DOWN:
- return net.minecraft.core.Direction.DOWN;
- case WEST:
- return net.minecraft.core.Direction.WEST;
- case SOUTH:
- return net.minecraft.core.Direction.SOUTH;
- case EAST:
- return net.minecraft.core.Direction.EAST;
- case NORTH:
- return net.minecraft.core.Direction.NORTH;
- default:
- return null;
- }
+ return switch (direction) {
+ case UP -> net.minecraft.core.Direction.UP;
+ case DOWN -> net.minecraft.core.Direction.DOWN;
+ case WEST -> net.minecraft.core.Direction.WEST;
+ case SOUTH -> net.minecraft.core.Direction.SOUTH;
+ case EAST -> net.minecraft.core.Direction.EAST;
+ case NORTH -> net.minecraft.core.Direction.NORTH;
+ default -> null;
+ };
}
public static Direction getFor(final net.minecraft.core.Direction facing) {
Objects.requireNonNull(facing);
- switch (facing) {
- case UP:
- return Direction.UP;
- case DOWN:
- return Direction.DOWN;
- case WEST:
- return Direction.WEST;
- case SOUTH:
- return Direction.SOUTH;
- case EAST:
- return Direction.EAST;
- case NORTH:
- return Direction.NORTH;
- default:
- throw new IllegalStateException();
- }
+ return switch (facing) {
+ case UP -> Direction.UP;
+ case DOWN -> Direction.DOWN;
+ case WEST -> Direction.WEST;
+ case SOUTH -> Direction.SOUTH;
+ case EAST -> Direction.EAST;
+ case NORTH -> Direction.NORTH;
+ default -> throw new IllegalStateException();
+ };
}
- public static net.minecraft.world.level.block.state.BlockState set(final net.minecraft.world.level.block.state.BlockState holder, final Direction value, final DirectionProperty property) {
+ public static net.minecraft.world.level.block.state.BlockState set(final net.minecraft.world.level.block.state.BlockState holder, final Direction value, final EnumProperty property) {
final net.minecraft.core.Direction direction = DirectionUtil.getFor(value);
if (direction == null || !property.getPossibleValues().contains(direction)) {
return holder;
@@ -81,168 +67,101 @@ public static net.minecraft.world.level.block.state.BlockState set(final net.min
}
public static Direction fromRotation(int i) {
- switch (i) {
- case 0:
- return Direction.SOUTH;
- case 1:
- return Direction.SOUTH_SOUTHWEST;
- case 2:
- return Direction.SOUTHWEST;
- case 3:
- return Direction.WEST_SOUTHWEST;
- case 4:
- return Direction.WEST;
- case 5:
- return Direction.WEST_NORTHWEST;
- case 6:
- return Direction.NORTHWEST;
- case 7:
- return Direction.NORTH_NORTHWEST;
- case 8:
- return Direction.NORTH;
- case 9:
- return Direction.NORTH_NORTHEAST;
- case 10:
- return Direction.NORTHEAST;
- case 11:
- return Direction.EAST_NORTHEAST;
- case 12:
- return Direction.EAST;
- case 13:
- return Direction.EAST_SOUTHEAST;
- case 14:
- return Direction.SOUTHEAST;
- case 15:
- return Direction.SOUTH_SOUTHEAST;
- default:
- return Direction.NORTH;
- }
+ return switch (i) {
+ case 0 -> Direction.SOUTH;
+ case 1 -> Direction.SOUTH_SOUTHWEST;
+ case 2 -> Direction.SOUTHWEST;
+ case 3 -> Direction.WEST_SOUTHWEST;
+ case 4 -> Direction.WEST;
+ case 5 -> Direction.WEST_NORTHWEST;
+ case 6 -> Direction.NORTHWEST;
+ case 7 -> Direction.NORTH_NORTHWEST;
+ case 8 -> Direction.NORTH;
+ case 9 -> Direction.NORTH_NORTHEAST;
+ case 10 -> Direction.NORTHEAST;
+ case 11 -> Direction.EAST_NORTHEAST;
+ case 12 -> Direction.EAST;
+ case 13 -> Direction.EAST_SOUTHEAST;
+ case 14 -> Direction.SOUTHEAST;
+ case 15 -> Direction.SOUTH_SOUTHEAST;
+ default -> Direction.NORTH;
+ };
}
public static int toRotation(final Direction direction) {
- switch (direction) {
- case SOUTH:
- return 0;
- case SOUTH_SOUTHWEST:
- return 1;
- case SOUTHWEST:
- return 2;
- case WEST_SOUTHWEST:
- return 3;
- case WEST:
- return 4;
- case WEST_NORTHWEST:
- return 5;
- case NORTHWEST:
- return 6;
- case NORTH_NORTHWEST:
- return 7;
- case NORTH:
- return 8;
- case NORTH_NORTHEAST:
- return 9;
- case NORTHEAST:
- return 10;
- case EAST_NORTHEAST:
- return 11;
- case EAST:
- return 12;
- case EAST_SOUTHEAST:
- return 13;
- case SOUTHEAST:
- return 14;
- case SOUTH_SOUTHEAST:
- return 15;
- default:
- return 0;
- }
+ return switch (direction) {
+ case SOUTH -> 0;
+ case SOUTH_SOUTHWEST -> 1;
+ case SOUTHWEST -> 2;
+ case WEST_SOUTHWEST -> 3;
+ case WEST -> 4;
+ case WEST_NORTHWEST -> 5;
+ case NORTHWEST -> 6;
+ case NORTH_NORTHWEST -> 7;
+ case NORTH -> 8;
+ case NORTH_NORTHEAST -> 9;
+ case NORTHEAST -> 10;
+ case EAST_NORTHEAST -> 11;
+ case EAST -> 12;
+ case EAST_SOUTHEAST -> 13;
+ case SOUTHEAST -> 14;
+ case SOUTH_SOUTHEAST -> 15;
+ default -> 0;
+ };
}
public static Direction fromHorizontalHanging(int i) {
- switch (i) {
- case 0:
- return Direction.SOUTH;
- case 1:
- return Direction.WEST;
- case 2:
- return Direction.NORTH;
- case 3:
- return Direction.EAST;
- default:
- return Direction.NORTH;
- }
+ return switch (i) {
+ case 0 -> Direction.SOUTH;
+ case 1 -> Direction.WEST;
+ case 2 -> Direction.NORTH;
+ case 3 -> Direction.EAST;
+ default -> Direction.NORTH;
+ };
}
public static int toHorizontalHanging(Direction direction) {
- switch (direction) {
- case SOUTH:
- return 0;
- case WEST:
- return 1;
- case NORTH:
- return 2;
- case EAST:
- return 3;
- default:
- return 0;
- }
+ return switch (direction) {
+ case SOUTH -> 0;
+ case WEST -> 1;
+ case NORTH -> 2;
+ case EAST -> 3;
+ default -> 0;
+ };
}
public static Direction fromHanging(int i) {
- switch (i) {
- case 0:
- return Direction.DOWN;
- case 1:
- return Direction.UP;
- case 2:
- return Direction.NORTH;
- case 3:
- return Direction.SOUTH;
- case 4:
- return Direction.WEST;
- case 5:
- return Direction.EAST;
- default:
- return Direction.DOWN;
- }
+ return switch (i) {
+ case 0 -> Direction.DOWN;
+ case 1 -> Direction.UP;
+ case 2 -> Direction.NORTH;
+ case 3 -> Direction.SOUTH;
+ case 4 -> Direction.WEST;
+ case 5 -> Direction.EAST;
+ default -> Direction.DOWN;
+ };
}
public static int toHanging(Direction direction) {
- switch (direction) {
- case DOWN:
- return 0;
- case UP:
- return 1;
- case NORTH:
- return 2;
- case SOUTH:
- return 3;
- case WEST:
- return 4;
- case EAST:
- return 5;
- default:
- return 0;
- }
+ return switch (direction) {
+ case DOWN -> 0;
+ case UP -> 1;
+ case NORTH -> 2;
+ case SOUTH -> 3;
+ case WEST -> 4;
+ case EAST -> 5;
+ default -> 0;
+ };
}
public static int directionToIndex(final Direction direction) {
- switch (direction) {
- case NORTH:
- case NORTHEAST:
- case NORTHWEST:
- return 0;
- case SOUTH:
- case SOUTHEAST:
- case SOUTHWEST:
- return 1;
- case EAST:
- return 2;
- case WEST:
- return 3;
- default:
- throw new IllegalArgumentException("Unexpected direction");
- }
+ return switch (direction) {
+ case NORTH, NORTHEAST, NORTHWEST -> 0;
+ case SOUTH, SOUTHEAST, SOUTHWEST -> 1;
+ case EAST -> 2;
+ case WEST -> 3;
+ default -> throw new IllegalArgumentException("Unexpected direction");
+ };
}
private DirectionUtil() {
diff --git a/src/main/java/org/spongepowered/common/util/DyeColorUtil.java b/src/main/java/org/spongepowered/common/util/DyeColorUtil.java
index 8a81546118f..fa690dafe0b 100644
--- a/src/main/java/org/spongepowered/common/util/DyeColorUtil.java
+++ b/src/main/java/org/spongepowered/common/util/DyeColorUtil.java
@@ -24,11 +24,11 @@
*/
package org.spongepowered.common.util;
+import net.minecraft.data.loot.packs.LootData;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
-import org.spongepowered.common.accessor.world.entity.animal.SheepAccessor;
import java.util.HashMap;
import java.util.Map;
@@ -36,7 +36,7 @@
public class DyeColorUtil {
- public static final Map COLOR_BY_WOOL = SheepAccessor.accessor$ITEM_BY_DYE().entrySet()
+ public static final Map COLOR_BY_WOOL = LootData.WOOL_ITEM_BY_DYE.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey));
diff --git a/src/main/java/org/spongepowered/common/util/ReflectionUtil.java b/src/main/java/org/spongepowered/common/util/ReflectionUtil.java
index 557baa4bed3..6328a3e6616 100644
--- a/src/main/java/org/spongepowered/common/util/ReflectionUtil.java
+++ b/src/main/java/org/spongepowered/common/util/ReflectionUtil.java
@@ -28,7 +28,6 @@
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import org.apache.logging.log4j.Marker;
@@ -47,40 +46,16 @@
public final class ReflectionUtil {
public static final Marker REFLECTION_SCANNING = MarkerManager.getMarker("REFLECTION_SCANNING");
- private static final Class>[] NEIGHBOR_CHANGED_METHOD_ARGS = {
- BlockState.class,
- Level.class,
- BlockPos.class,
- Block.class,
- BlockPos.class,
- boolean.class
- };
private static final Class>[] ENTITY_INSIDE_METHOD_ARGS = {
BlockState.class,
Level.class,
BlockPos.class,
Entity.class
};
- private static final Class>[] STEP_ON_METHOD_ARGS = {
- Level.class,
- BlockPos.class,
- BlockState.class,
- Entity.class
- };
private static final Class>[] PLAYER_TOUCH_METHOD_ARGS= {
Player.class
};
- public static boolean isNeighborChangedDeclared(final Class> targetClass) {
- return ReflectionUtil.doesMethodExist(
- targetClass,
- Block.class,
- "neighborChanged",
- ReflectionUtil.NEIGHBOR_CHANGED_METHOD_ARGS,
- void.class
- );
- }
-
public static boolean isEntityInsideDeclared(final Class> targetClass) {
return ReflectionUtil.doesMethodExist(
targetClass,
@@ -91,16 +66,6 @@ public static boolean isEntityInsideDeclared(final Class> targetClass) {
);
}
- public static boolean isStepOnDeclared(final Class> targetClass) {
- return ReflectionUtil.doesMethodExist(
- targetClass,
- Block.class,
- "stepOn",
- ReflectionUtil.STEP_ON_METHOD_ARGS,
- void.class
- );
- }
-
public static boolean isPlayerTouchDeclared(final Class> targetClass) {
return ReflectionUtil.doesMethodExist(
targetClass,
diff --git a/src/main/java/org/spongepowered/common/util/TristateUtil.java b/src/main/java/org/spongepowered/common/util/TristateUtil.java
deleted file mode 100644
index eb28df33435..00000000000
--- a/src/main/java/org/spongepowered/common/util/TristateUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.util;
-
-import com.google.common.collect.EnumBiMap;
-import net.minecraft.world.InteractionResult;
-import org.spongepowered.api.util.Tristate;
-
-public final class TristateUtil {
-
- private static final EnumBiMap map = EnumBiMap.create(InteractionResult.class, Tristate.class);
-
- static {
- TristateUtil.map.put(InteractionResult.FAIL, Tristate.FALSE);
- TristateUtil.map.put(InteractionResult.PASS, Tristate.UNDEFINED);
- TristateUtil.map.put(InteractionResult.SUCCESS, Tristate.TRUE);
- }
-
- public static Tristate fromActionResult(final InteractionResult result) {
- return TristateUtil.map.get(result);
- }
-
- public static InteractionResult toActionResult(final Tristate tristate) {
- return TristateUtil.map.inverse().get(tristate);
- }
-
- private TristateUtil() {
- }
-}
diff --git a/src/main/java/org/spongepowered/common/world/SpongeExplosionBuilder.java b/src/main/java/org/spongepowered/common/world/SpongeExplosionBuilder.java
index 52a6f8486aa..b1ebdd6ef6b 100644
--- a/src/main/java/org/spongepowered/common/world/SpongeExplosionBuilder.java
+++ b/src/main/java/org/spongepowered/common/world/SpongeExplosionBuilder.java
@@ -24,18 +24,18 @@
*/
package org.spongepowered.common.world;
-import net.minecraft.core.particles.ParticleTypes;
-import net.minecraft.sounds.SoundEvents;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
-import net.minecraft.world.level.Explosion.BlockInteraction;
-import net.minecraft.world.level.Level;
+import net.minecraft.world.level.ServerExplosion;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.entity.explosive.Explosive;
import org.spongepowered.api.world.World;
import org.spongepowered.api.world.explosion.Explosion;
+import org.spongepowered.api.world.explosion.ExplosionBlockInteraction;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.common.bridge.world.level.ExplosionBridge;
import org.spongepowered.common.util.Preconditions;
+import org.spongepowered.common.util.VecHelper;
import org.spongepowered.math.vector.Vector3d;
import java.util.Objects;
@@ -46,13 +46,14 @@ public class SpongeExplosionBuilder implements Explosion.Builder {
@Nullable private Explosive sourceExplosive;
private float radius;
private boolean canCauseFire;
- private boolean shouldBreakBlocks = true;
+ private net.minecraft.world.level.Explosion.BlockInteraction blockInteraction;
private boolean shouldSmoke;
private boolean shouldDamageEntities = true;
private int resolution = 16;
private float randomness = 1.0F;
private double knockback = 1;
+
public SpongeExplosionBuilder() {
this.reset();
}
@@ -94,11 +95,12 @@ public Explosion.Builder shouldPlaySmoke(boolean smoke) {
}
@Override
- public Explosion.Builder shouldBreakBlocks(boolean destroy) {
- this.shouldBreakBlocks = destroy;
+ public Explosion.Builder blockInteraction(final ExplosionBlockInteraction interaction) {
+ this.blockInteraction = (net.minecraft.world.level.Explosion.BlockInteraction) (Object) interaction;
return this;
}
+
@Override
public Explosion.Builder resolution(int resolution) {
//A value of 1 would cause a DivideByZeroException
@@ -124,7 +126,7 @@ public Explosion.Builder from(Explosion value) {
this.sourceExplosive = value.sourceExplosive().orElse(null);
this.radius = value.radius();
this.canCauseFire = value.canCauseFire();
- this.shouldBreakBlocks = value.shouldBreakBlocks();
+ this.blockInteraction = ((ServerExplosion) value).getBlockInteraction();
this.shouldSmoke = value.shouldPlaySmoke();
this.shouldDamageEntities = value.shouldDamageEntities();
this.resolution = value.resolution();
@@ -136,10 +138,10 @@ public Explosion.Builder from(Explosion value) {
@Override
public SpongeExplosionBuilder reset() {
this.location = null;
+ this.blockInteraction = null;
this.sourceExplosive = null;
this.radius = 0;
this.canCauseFire = false;
- this.shouldBreakBlocks = true;
this.shouldSmoke = false;
this.shouldDamageEntities = true;
this.resolution = 16;
@@ -155,14 +157,9 @@ public Explosion build() throws IllegalStateException {
final World, ?> world = this.location.world();
final Vector3d origin = this.location.position();
- final net.minecraft.world.level.Explosion explosion = new net.minecraft.world.level.Explosion((Level) world,
- (Entity) this.sourceExplosive, null, null, origin.x(), origin.y(), origin.z(), this.radius,
- this.canCauseFire, this.shouldBreakBlocks ? BlockInteraction.DESTROY : BlockInteraction.KEEP,
- // TODO configurable explosion particles & sound?
- ParticleTypes.EXPLOSION,
- ParticleTypes.EXPLOSION_EMITTER,
- SoundEvents.GENERIC_EXPLODE);
- ((ExplosionBridge) explosion).bridge$setShouldBreakBlocks(this.shouldBreakBlocks);
+ final var explosion = new net.minecraft.world.level.ServerExplosion((ServerLevel) world,
+ (Entity) this.sourceExplosive, null, null, VecHelper.toVanillaVector3d(origin), this.radius,
+ this.canCauseFire, this.blockInteraction);
((ExplosionBridge) explosion).bridge$setShouldDamageEntities(this.shouldDamageEntities);
((ExplosionBridge) explosion).bridge$setShouldPlaySmoke(this.shouldSmoke);
((ExplosionBridge) explosion).bridge$setResolution(this.resolution);
diff --git a/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeProviderFactory.java b/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeProviderFactory.java
index 44d1b9fdcd8..5e41f562610 100644
--- a/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeProviderFactory.java
+++ b/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeProviderFactory.java
@@ -61,7 +61,7 @@ public final class SpongeBiomeProviderFactory implements BiomeProvider.Factory {
@Override
public ConfigurableBiomeProvider overworld() {
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
return (ConfigurableBiomeProvider) MultiNoiseBiomeSource.createFromPreset(holder);
}
@@ -77,7 +77,7 @@ public ConfigurableBiomeProvider multiNoise(final MultiNo
@Override
public ConfigurableBiomeProvider nether() {
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
return (ConfigurableBiomeProvider) MultiNoiseBiomeSource.createFromPreset(holder);
}
@@ -94,7 +94,7 @@ public ConfigurableBiomeProvider endStyle(final EndStyleBio
@Override
public ConfigurableBiomeProvider end() {
- return (ConfigurableBiomeProvider) TheEndBiomeSource.create(this.registry().asLookup());
+ return (ConfigurableBiomeProvider) TheEndBiomeSource.create(this.registry());
}
@Override
@@ -114,6 +114,6 @@ private Registry registry() {
}
private Holder biomeHolder(final RegistryReference biome) {
- return this.registry().getHolderOrThrow(ResourceKey.create(Registries.BIOME, (ResourceLocation) (Object) biome.location()));
+ return this.registry().getOrThrow(ResourceKey.create(Registries.BIOME, (ResourceLocation) (Object) biome.location()));
}
}
diff --git a/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeTemplate.java b/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeTemplate.java
index cea046cce1d..481ed65a69c 100644
--- a/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeTemplate.java
+++ b/src/main/java/org/spongepowered/common/world/biome/SpongeBiomeTemplate.java
@@ -63,7 +63,6 @@
import org.spongepowered.api.world.biome.spawner.NaturalSpawnCost;
import org.spongepowered.api.world.biome.spawner.NaturalSpawner;
import org.spongepowered.api.world.generation.carver.Carver;
-import org.spongepowered.api.world.generation.carver.CarvingStep;
import org.spongepowered.api.world.generation.feature.DecorationStep;
import org.spongepowered.api.world.generation.feature.PlacedFeature;
import org.spongepowered.common.SpongeCommon;
@@ -185,7 +184,7 @@ protected BiomeTemplate build0() {
final Map, NaturalSpawnCost> spawnerCosts = this.manipulator.getOrElse(Keys.NATURAL_SPAWNER_COST, Map.of());
final Map> features = this.manipulator.getOrElse(Keys.FEATURES, Map.of());
- final Map> carvers = this.manipulator.getOrElse(Keys.CARVERS, Map.of());
+ final List carvers = this.manipulator.getOrElse(Keys.CARVERS, List.of());
final BiomeSpecialEffects.Builder effectsBuilder = new BiomeSpecialEffects.Builder()
.fogColor(fogColor.rgb())
@@ -196,7 +195,7 @@ protected BiomeTemplate build0() {
foliageColor.ifPresent(c -> effectsBuilder.foliageColorOverride(c.rgb()));
grassColor.ifPresent(c -> effectsBuilder.grassColorOverride(c.rgb()));
particleSettings.ifPresent(ps -> effectsBuilder.ambientParticle((AmbientParticleSettings) ps));
- ambientSound.ifPresent(s -> effectsBuilder.ambientLoopSound(Holder.direct((SoundEvent) s)));
+ ambientSound.ifPresent(s -> effectsBuilder.ambientLoopSound(Holder.direct((SoundEvent) (Object) s)));
ambientMood.ifPresent(m -> effectsBuilder.ambientMoodSound((net.minecraft.world.level.biome.AmbientMoodSettings) m));
additionalSound.ifPresent(s -> effectsBuilder.ambientAdditionsSound((AmbientAdditionsSettings) s));
backgroundMusic.ifPresent(m -> effectsBuilder.backgroundMusic((Music) m));
@@ -211,11 +210,10 @@ protected BiomeTemplate build0() {
final Registry placedFeatureRegistry = SpongeCommon.vanillaRegistry(Registries.PLACED_FEATURE);
final Registry> configuredWorldCarverRegistry = SpongeCommon.vanillaRegistry(Registries.CONFIGURED_CARVER);
- final BiomeGenerationSettings.Builder generationBuilder = new BiomeGenerationSettings.Builder(placedFeatureRegistry.asLookup(), configuredWorldCarverRegistry.asLookup());
+ final BiomeGenerationSettings.Builder generationBuilder = new BiomeGenerationSettings.Builder(placedFeatureRegistry, configuredWorldCarverRegistry);
features.forEach((step, list) -> list.forEach(feature -> generationBuilder.addFeature((GenerationStep.Decoration) (Object) step,
Holder.direct((net.minecraft.world.level.levelgen.placement.PlacedFeature) (Object) feature))));
- carvers.forEach((step, list) -> list.forEach(carver -> generationBuilder.addCarver((GenerationStep.Carving) (Object) step,
- Holder.direct((ConfiguredWorldCarver>) (Object) carver))));
+ carvers.forEach((carver) -> generationBuilder.addCarver(Holder.direct((ConfiguredWorldCarver>) (Object) carver)));
final Biome.BiomeBuilder vanillaBuilder = new Biome.BiomeBuilder()
.hasPrecipitation(precipitation)
diff --git a/src/main/java/org/spongepowered/common/world/biome/ambient/SpongeSoundConfigFactory.java b/src/main/java/org/spongepowered/common/world/biome/ambient/SpongeSoundConfigFactory.java
index 425d535c24c..286d309f889 100644
--- a/src/main/java/org/spongepowered/common/world/biome/ambient/SpongeSoundConfigFactory.java
+++ b/src/main/java/org/spongepowered/common/world/biome/ambient/SpongeSoundConfigFactory.java
@@ -36,16 +36,16 @@ public class SpongeSoundConfigFactory implements SoundConfig.Factory {
@Override
public SoundConfig.Mood ofAmbientMood(final SoundType sound, final int tickDelay, final int searchRadius, final double distanceModifier) {
- return (SoundConfig.Mood) new AmbientMoodSettings(Holder.direct((SoundEvent) sound), tickDelay, searchRadius, distanceModifier);
+ return (SoundConfig.Mood) new AmbientMoodSettings(Holder.direct((SoundEvent) (Object) sound), tickDelay, searchRadius, distanceModifier);
}
@Override
public SoundConfig.Additional ofAdditional(final SoundType sound, final double tickChance) {
- return (SoundConfig.Additional) new AmbientAdditionsSettings(Holder.direct((SoundEvent) sound), tickChance);
+ return (SoundConfig.Additional) new AmbientAdditionsSettings(Holder.direct((SoundEvent) (Object) sound), tickChance);
}
@Override
public SoundConfig.BackgroundMusic ofBackroundMusic(final SoundType sound, final int minDelay, final int maxDelay, final boolean replacesCurrent) {
- return (SoundConfig.BackgroundMusic) new Music(Holder.direct((SoundEvent) sound), minDelay, maxDelay, replacesCurrent);
+ return (SoundConfig.BackgroundMusic) new Music(Holder.direct((SoundEvent) (Object) sound), minDelay, maxDelay, replacesCurrent);
}
}
diff --git a/src/main/java/org/spongepowered/common/world/biome/provider/SpongeMultiNoiseBiomeConfig.java b/src/main/java/org/spongepowered/common/world/biome/provider/SpongeMultiNoiseBiomeConfig.java
index 8ce6d49e842..8d6a39836ad 100644
--- a/src/main/java/org/spongepowered/common/world/biome/provider/SpongeMultiNoiseBiomeConfig.java
+++ b/src/main/java/org/spongepowered/common/world/biome/provider/SpongeMultiNoiseBiomeConfig.java
@@ -131,7 +131,7 @@ public static final class FactoryImpl implements Factory {
@Override
public MultiNoiseBiomeConfig nether() {
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
final var biomeSource = (MultiNoiseBiomeSourceAccessor) MultiNoiseBiomeSource.createFromPreset(holder);
return new BuilderImpl().addMcBiomes(biomeSource.accessor$parameters()).build();
}
@@ -139,7 +139,7 @@ public MultiNoiseBiomeConfig nether() {
@Override
public MultiNoiseBiomeConfig overworld() {
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
final var biomeSource = (MultiNoiseBiomeSourceAccessor) MultiNoiseBiomeSource.createFromPreset(holder);
return new BuilderImpl().addMcBiomes(biomeSource.accessor$parameters()).build();
}
diff --git a/src/main/java/org/spongepowered/common/world/generation/SpongeChunkGeneratorFactory.java b/src/main/java/org/spongepowered/common/world/generation/SpongeChunkGeneratorFactory.java
index 81c290117ee..9c52d42e4b0 100644
--- a/src/main/java/org/spongepowered/common/world/generation/SpongeChunkGeneratorFactory.java
+++ b/src/main/java/org/spongepowered/common/world/generation/SpongeChunkGeneratorFactory.java
@@ -72,26 +72,26 @@ public ConfigurableChunkGenerator noise(final BiomeProvide
public ConfigurableChunkGenerator overworld() {
var noiseGeneratorSettingsRegistry = SpongeCommon.vanillaRegistry(Registries.NOISE_SETTINGS);
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.OVERWORLD);
final var biomeSource = MultiNoiseBiomeSource.createFromPreset(holder);
- return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getHolderOrThrow(NoiseGeneratorSettings.OVERWORLD));
+ return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.OVERWORLD));
}
@Override
public ConfigurableChunkGenerator theNether() {
var noiseGeneratorSettingsRegistry = SpongeCommon.vanillaRegistry(Registries.NOISE_SETTINGS);
final var registry = SpongeCommon.vanillaRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST);
- final var holder = registry.getHolderOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
+ final var holder = registry.getOrThrow(MultiNoiseBiomeSourceParameterLists.NETHER);
final var biomeSource = MultiNoiseBiomeSource.createFromPreset(holder);
- return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getHolderOrThrow(NoiseGeneratorSettings.NETHER));
+ return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.NETHER));
}
@Override
public ConfigurableChunkGenerator theEnd() {
var biomeRegistry = SpongeCommon.vanillaRegistry(Registries.BIOME);
var noiseGeneratorSettingsRegistry = SpongeCommon.vanillaRegistry(Registries.NOISE_SETTINGS);
- var biomeSource = TheEndBiomeSource.create(biomeRegistry.asLookup());
- return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getHolderOrThrow(NoiseGeneratorSettings.END));
+ var biomeSource = TheEndBiomeSource.create(biomeRegistry);
+ return this.noiseBasedChunkGenerator(biomeSource, noiseGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END));
}
@Override
diff --git a/src/main/java/org/spongepowered/common/world/generation/config/flat/SpongeFlatGeneratorConfig.java b/src/main/java/org/spongepowered/common/world/generation/config/flat/SpongeFlatGeneratorConfig.java
index 0581d934635..40eb67f8158 100644
--- a/src/main/java/org/spongepowered/common/world/generation/config/flat/SpongeFlatGeneratorConfig.java
+++ b/src/main/java/org/spongepowered/common/world/generation/config/flat/SpongeFlatGeneratorConfig.java
@@ -138,10 +138,10 @@ public FlatGeneratorConfig.Builder from(final FlatGeneratorConfig value) {
throw new IllegalStateException("Flat generation requires at least 1 Layer!");
}
final Registry biomeRegistry = SpongeCommon.vanillaRegistry(Registries.BIOME);
- final HolderLookup.RegistryLookup placedFeatureRegistryLookup = SpongeCommon.vanillaRegistry(Registries.PLACED_FEATURE).asLookup();
+ final HolderLookup.RegistryLookup placedFeatureRegistryLookup = SpongeCommon.vanillaRegistry(Registries.PLACED_FEATURE);
final Holder.Reference biome =
- biomeRegistry.asLookup().getOrThrow(ResourceKey.create(Registries.BIOME, (ResourceLocation) (Object) this.biome.location()));
+ biomeRegistry.getOrThrow(ResourceKey.create(Registries.BIOME, (ResourceLocation) (Object) this.biome.location()));
return (FlatGeneratorConfig) FlatLevelGeneratorSettingsAccessor.invoker$new(
this.structureSets == null ? Optional.empty() : Optional.of(HolderSet.direct((Function) Holder::direct, this.structureSets)),
(List) (Object) this.layers,
diff --git a/src/main/java/org/spongepowered/common/world/generation/feature/SpongePlacedFeatureTemplate.java b/src/main/java/org/spongepowered/common/world/generation/feature/SpongePlacedFeatureTemplate.java
index 637c7386973..77a0b06ab0c 100644
--- a/src/main/java/org/spongepowered/common/world/generation/feature/SpongePlacedFeatureTemplate.java
+++ b/src/main/java/org/spongepowered/common/world/generation/feature/SpongePlacedFeatureTemplate.java
@@ -131,7 +131,7 @@ public Builder feature(final Feature feature) {
if (key == null) {
this.feature = Holder.direct((ConfiguredFeature, ?>) (Object) feature);
} else {
- this.feature = registry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(Registries.CONFIGURED_FEATURE, key));
+ this.feature = registry.getOrThrow(net.minecraft.resources.ResourceKey.create(Registries.CONFIGURED_FEATURE, key));
}
return this;
}
@@ -141,7 +141,7 @@ public Builder feature(final FeatureTemplate feature) {
final Registry> registry = SpongeCommon.vanillaRegistry(Registries.CONFIGURED_FEATURE);
final net.minecraft.resources.ResourceKey> key =
net.minecraft.resources.ResourceKey.create(Registries.CONFIGURED_FEATURE, ((ResourceLocation) (Object) feature.key()));
- this.feature = Holder.Reference.createStandAlone(registry.asLookup(), key);
+ this.feature = Holder.Reference.createStandAlone(registry, key);
return this;
}
diff --git a/src/main/java/org/spongepowered/common/world/generation/structure/SpongeStructurePlacementBuilder.java b/src/main/java/org/spongepowered/common/world/generation/structure/SpongeStructurePlacementBuilder.java
index 4c8d9b61c12..60ed58a9dad 100644
--- a/src/main/java/org/spongepowered/common/world/generation/structure/SpongeStructurePlacementBuilder.java
+++ b/src/main/java/org/spongepowered/common/world/generation/structure/SpongeStructurePlacementBuilder.java
@@ -28,7 +28,6 @@
import net.minecraft.core.Registry;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.Registries;
-import net.minecraft.tags.TagKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement;
import net.minecraft.world.level.levelgen.structure.placement.RandomSpreadStructurePlacement;
@@ -154,7 +153,8 @@ public ConcentricRings count(final int count) {
@Override
public ConcentricRings preferredBiomes(final Tag preferredBiomes) {
final Registry registry = SpongeCommon.vanillaRegistry(Registries.BIOME);
- this.preferredBiomes = registry.getOrCreateTag((TagKey) (Object) preferredBiomes);
+ // TODO - Snapshot 24w34a
+// this.preferredBiomes = registry.getOrCreateTag((TagKey) (Object) preferredBiomes);
return this;
}
diff --git a/src/main/java/org/spongepowered/common/world/level/chunk/storage/SpongeEntityChunk.java b/src/main/java/org/spongepowered/common/world/level/chunk/storage/SpongeEntityChunk.java
index 67f5bce8b7c..ba21ecb1e0a 100644
--- a/src/main/java/org/spongepowered/common/world/level/chunk/storage/SpongeEntityChunk.java
+++ b/src/main/java/org/spongepowered/common/world/level/chunk/storage/SpongeEntityChunk.java
@@ -76,7 +76,7 @@ public SpongeEntityChunk(final ServerLevel level, final Vector3i chunkPosition,
public Vector3i min() {
if (this.blockMin == null) {
if (this.chunkLayout == null) {
- this.chunkLayout = new SpongeChunkLayout(this.level.getMinBuildHeight(), this.level.getHeight());
+ this.chunkLayout = new SpongeChunkLayout(this.level.getMinY(), this.level.getHeight());
}
this.blockMin = this.chunkLayout.forceToWorld(this.chunkPosition);
}
@@ -87,7 +87,7 @@ public Vector3i min() {
public Vector3i max() {
if (this.blockMax == null) {
if (this.chunkLayout == null) {
- this.chunkLayout = new SpongeChunkLayout(this.level.getMinBuildHeight(), this.level.getHeight());
+ this.chunkLayout = new SpongeChunkLayout(this.level.getMinY(), this.level.getHeight());
}
this.blockMax = this.min().add(this.chunkLayout.chunkSize()).sub(1, 1, 1);
}
diff --git a/src/main/java/org/spongepowered/common/world/portal/SpongeCompositePortalLogic.java b/src/main/java/org/spongepowered/common/world/portal/SpongeCompositePortalLogic.java
index 9e5f9112353..f517ca6991c 100644
--- a/src/main/java/org/spongepowered/common/world/portal/SpongeCompositePortalLogic.java
+++ b/src/main/java/org/spongepowered/common/world/portal/SpongeCompositePortalLogic.java
@@ -27,7 +27,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
-import net.minecraft.world.level.portal.DimensionTransition;
+import net.minecraft.world.level.portal.TeleportTransition;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.api.util.Axis;
import org.spongepowered.api.world.portal.Portal;
@@ -50,7 +50,7 @@ public SpongeCompositePortalLogic(final List p.getPortalDestination(sourceLevel, entity, portalPos))
.filter(Objects::nonNull)
diff --git a/src/main/java/org/spongepowered/common/world/portal/SpongeCustomPortalLogic.java b/src/main/java/org/spongepowered/common/world/portal/SpongeCustomPortalLogic.java
index 65bf3c1c70d..7e73377ce5f 100644
--- a/src/main/java/org/spongepowered/common/world/portal/SpongeCustomPortalLogic.java
+++ b/src/main/java/org/spongepowered/common/world/portal/SpongeCustomPortalLogic.java
@@ -27,7 +27,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
-import net.minecraft.world.level.portal.DimensionTransition;
+import net.minecraft.world.level.portal.TeleportTransition;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.util.Axis;
import org.spongepowered.api.world.portal.Portal;
@@ -60,7 +60,7 @@ public SpongeCustomPortalLogic(final PortalLogic.PortalExitCalculator calulator,
}
@Nullable @Override
- public DimensionTransition getPortalDestination(final ServerLevel fromLevel, final Entity entity, final BlockPos fromPos) {
+ public TeleportTransition getPortalDestination(final ServerLevel fromLevel, final Entity entity, final BlockPos fromPos) {
final var spongeEntity = (org.spongepowered.api.entity.Entity) entity;
// Calculate desired portal location
// Then find existing portal or generate if not found
@@ -70,14 +70,14 @@ public DimensionTransition getPortalDestination(final ServerLevel fromLevel, fin
).orElse(null);
}
- private static DimensionTransition generateTransition(final Entity entity, final ServerLocation finalExit) {
- return new DimensionTransition(
+ private static TeleportTransition generateTransition(final Entity entity, final ServerLocation finalExit) {
+ return new TeleportTransition(
(ServerLevel) finalExit.world(),
VecHelper.toVanillaVector3d(finalExit.position()),
entity.getDeltaMovement(),
entity.getYRot(),
entity.getXRot(),
- DimensionTransition.PLACE_PORTAL_TICKET);
+ TeleportTransition.PLACE_PORTAL_TICKET);
}
@Override
diff --git a/src/main/java/org/spongepowered/common/world/schematic/SchematicTranslator.java b/src/main/java/org/spongepowered/common/world/schematic/SchematicTranslator.java
index d3c32a85a77..54b41bbb76d 100644
--- a/src/main/java/org/spongepowered/common/world/schematic/SchematicTranslator.java
+++ b/src/main/java/org/spongepowered/common/world/schematic/SchematicTranslator.java
@@ -327,7 +327,7 @@ private static void deserializeBiomeContainer(
.orElseThrow(() -> new InvalidDataException("Missing BiomePalette as required by the schematic spec"));
final Set biomeKeys = biomeMap.keys(false);
- final Registry biomeRegistry = VolumeStreamUtils.nativeToSpongeRegistry(SpongeCommon.server().registryAccess().registryOrThrow(Registries.BIOME));
+ final Registry biomeRegistry = VolumeStreamUtils.nativeToSpongeRegistry(SpongeCommon.server().registryAccess().lookupOrThrow(Registries.BIOME));
biomePalette = new MutableBimapPalette<>(
PaletteTypes.BIOME_PALETTE.get(),
biomeRegistry,
@@ -454,7 +454,7 @@ public DataView addTo(final Schematic schematic, final DataView data) {
final Registry blockRegistry = VolumeStreamUtils.nativeToSpongeRegistry(
- SpongeCommon.server().registryAccess().registryOrThrow(Registries.BLOCK));
+ SpongeCommon.server().registryAccess().lookupOrThrow(Registries.BLOCK));
SchematicTranslator.writePaletteToView(
blockData, palette, blockRegistry, Constants.Sponge.Schematic.BLOCK_PALETTE, BlockState::type,
@@ -506,7 +506,7 @@ public DataView addTo(final Schematic schematic, final DataView data) {
// Should never reach here.
}
- final Registry biomeRegistry = VolumeStreamUtils.nativeToSpongeRegistry(SpongeCommon.server().registryAccess().registryOrThrow(Registries.BIOME));
+ final Registry biomeRegistry = VolumeStreamUtils.nativeToSpongeRegistry(SpongeCommon.server().registryAccess().lookupOrThrow(Registries.BIOME));
SchematicTranslator.writePaletteToView(
biomeContainer, biomePalette, biomeRegistry, Constants.Sponge.Schematic.BIOME_PALETTE,
diff --git a/src/main/java/org/spongepowered/common/world/server/SpongeWorldManager.java b/src/main/java/org/spongepowered/common/world/server/SpongeWorldManager.java
index 332f4d325c2..2ded515fb9b 100644
--- a/src/main/java/org/spongepowered/common/world/server/SpongeWorldManager.java
+++ b/src/main/java/org/spongepowered/common/world/server/SpongeWorldManager.java
@@ -279,7 +279,7 @@ public CompletableFuture loadWorld(final ResourceKey key) {
// First find a loaded level-stem / To load based on a datapack load using the WorldTemplate instead
final net.minecraft.resources.ResourceKey rKey = net.minecraft.resources.ResourceKey.create(Registries.LEVEL_STEM, (ResourceLocation) (Object) key);
- final LevelStem levelStem = SpongeCommon.vanillaRegistry(Registries.LEVEL_STEM).get(rKey);
+ final LevelStem levelStem = SpongeCommon.vanillaRegistry(Registries.LEVEL_STEM).getValue(rKey);
if (levelStem != null) {
return this.loadWorld0(registryKey, levelStem);
}
@@ -337,7 +337,7 @@ private LevelSettings createLevelSettings(final PrimaryLevelData defaultLevelDat
hardcore == null ? defaultLevelData.isHardcore() : hardcore,
difficulty == null ? defaultLevelData.getDifficulty() : difficulty,
allowCommands == null ? defaultLevelData.isAllowCommands() : allowCommands,
- defaultLevelData.getGameRules().copy(),
+ defaultLevelData.getGameRules().copy(defaultLevelData.enabledFeatures()),
defaultLevelData.getDataConfiguration());
}
@@ -795,7 +795,7 @@ private PrimaryLevelData getOrCreateLevelData(@Nullable final Dynamic> dynamic
}
private PrimaryLevelData loadLevelData(final RegistryAccess.Frozen access, final WorldDataConfiguration datapackConfig, final Dynamic> dataTag) {
- final LevelDataAndDimensions levelData = LevelStorageSource.getLevelDataAndDimensions(dataTag, datapackConfig, access.registryOrThrow(Registries.LEVEL_STEM), access);
+ final LevelDataAndDimensions levelData = LevelStorageSource.getLevelDataAndDimensions(dataTag, datapackConfig, access.lookupOrThrow(Registries.LEVEL_STEM), access);
return (PrimaryLevelData) levelData.worldData();
}
@@ -888,7 +888,7 @@ private ServerLevel prepareWorld(final ServerLevel world) {
}
} else if (levelData.worldGenOptions().generateBonusChest()) {
final BlockPos pos = levelData.getSpawnPos();
- final ConfiguredFeature, ?> bonusChestFeature = SpongeCommon.vanillaRegistry(Registries.CONFIGURED_FEATURE).get(MiscOverworldFeatures.BONUS_CHEST);
+ final ConfiguredFeature, ?> bonusChestFeature = SpongeCommon.vanillaRegistry(Registries.CONFIGURED_FEATURE).getValue(MiscOverworldFeatures.BONUS_CHEST);
bonusChestFeature.place(world, world.getChunkSource().getGenerator(), world.random, pos);
}
levelData.setInitialized(true);
diff --git a/src/main/java/org/spongepowered/common/world/server/SpongeWorldTemplate.java b/src/main/java/org/spongepowered/common/world/server/SpongeWorldTemplate.java
index 96183174218..05a87b59d10 100644
--- a/src/main/java/org/spongepowered/common/world/server/SpongeWorldTemplate.java
+++ b/src/main/java/org/spongepowered/common/world/server/SpongeWorldTemplate.java
@@ -289,12 +289,12 @@ protected WorldTemplate build0() {
@NonNull
private static Holder dimensionTypeHolder(final WorldType worldType) {
- final Registry dimensionTypeRegistry = SpongeCommon.server().registryAccess().registryOrThrow(Registries.DIMENSION_TYPE);
+ final Registry dimensionTypeRegistry = SpongeCommon.server().registryAccess().lookupOrThrow(Registries.DIMENSION_TYPE);
final ResourceLocation key = dimensionTypeRegistry.getKey((DimensionType) (Object) worldType);
if (key == null) {
return Holder.direct((DimensionType) (Object) worldType);
}
- return dimensionTypeRegistry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(Registries.DIMENSION_TYPE, key));
+ return dimensionTypeRegistry.getOrThrow(net.minecraft.resources.ResourceKey.create(Registries.DIMENSION_TYPE, key));
}
}
diff --git a/src/main/java/org/spongepowered/common/world/server/SpongeWorldTypeTemplate.java b/src/main/java/org/spongepowered/common/world/server/SpongeWorldTypeTemplate.java
index b5ae4af961c..586e9d4380d 100644
--- a/src/main/java/org/spongepowered/common/world/server/SpongeWorldTypeTemplate.java
+++ b/src/main/java/org/spongepowered/common/world/server/SpongeWorldTypeTemplate.java
@@ -139,7 +139,7 @@ public Builder reset() {
this.data = DataManipulator.mutableOf();
this.key = null;
this.pack = DataPacks.WORLD_TYPE;
- final DimensionType defaultOverworld = SpongeCommon.vanillaRegistry(Registries.DIMENSION_TYPE).get(BuiltinDimensionTypes.OVERWORLD);
+ final DimensionType defaultOverworld = SpongeCommon.vanillaRegistry(Registries.DIMENSION_TYPE).getValue(BuiltinDimensionTypes.OVERWORLD);
this.fromValue((WorldType) (Object) defaultOverworld);
return this;
}
diff --git a/src/main/java/org/spongepowered/common/world/teleport/ConfigTeleportHelperFilter.java b/src/main/java/org/spongepowered/common/world/teleport/ConfigTeleportHelperFilter.java
index 8349954ede6..ee6f96040e5 100644
--- a/src/main/java/org/spongepowered/common/world/teleport/ConfigTeleportHelperFilter.java
+++ b/src/main/java/org/spongepowered/common/world/teleport/ConfigTeleportHelperFilter.java
@@ -66,7 +66,7 @@ private static void updateCacheIfNecessary() {
final TeleportHelperCategory teleportHelperCat = SpongeConfigs.getCommon().get().teleportHelper;
ConfigTeleportHelperFilter.floorBlockTypes = teleportHelperCat.unsafeFloorBlocks.stream()
.map(x -> ResourceKey.resolve(x.toLowerCase(Locale.ENGLISH)))
- .map(x -> (BlockType) blockRegistry.get((ResourceLocation) (Object) x))
+ .map(x -> (BlockType) blockRegistry.getValue((ResourceLocation) (Object) x))
.filter(Objects::nonNull)
.collect(Collectors.toList());
@@ -79,7 +79,7 @@ private static void updateCacheIfNecessary() {
ConfigTeleportHelperFilter.bodyBlockTypes = teleportHelperCat.unsafeBlockBlocks.stream()
.map(x -> ResourceKey.resolve(x.toLowerCase(Locale.ENGLISH)))
- .map(x -> (BlockType) blockRegistry.get((ResourceLocation) (Object) x))
+ .map(x -> (BlockType) blockRegistry.getValue((ResourceLocation) (Object) x))
.filter(Objects::nonNull)
.collect(Collectors.toList());
diff --git a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java
index 60b6d5a4af7..b6f2f0b20dd 100644
--- a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java
+++ b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java
@@ -34,6 +34,7 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Tuple;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntitySpawnReason;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
@@ -242,7 +243,7 @@ public static BiConsumer getOrCloneEnti
return shouldCarbonCopy ? (pos, entity) -> {
final CompoundTag nbt = new CompoundTag();
entity.save(nbt);
- final net.minecraft.world.entity.@Nullable Entity cloned = entity.getType().create(level);
+ final net.minecraft.world.entity.@Nullable Entity cloned = entity.getType().create(level, EntitySpawnReason.COMMAND);
Objects.requireNonNull(
cloned,
() -> String.format(
@@ -320,7 +321,7 @@ public static boolean setBiome(final ChunkAccess chunk, final int x, final int y
) {
final boolean result = VolumeStreamUtils.setBiome(chunk.getSection(chunk.getSectionIndex(y)), x, y, z, biome);
if (result) {
- chunk.setUnsaved(true);
+ chunk.markUnsaved();
}
return result;
}
@@ -508,7 +509,7 @@ public static > VolumeStream biomeRegistry = reader.registryAccess().registryOrThrow(Registries.BIOME);
+ final Registry biomeRegistry = reader.registryAccess().lookupOrThrow(Registries.BIOME);
backingVolume = new ObjectArrayMutableBiomeBuffer(min, size, VolumeStreamUtils.nativeToSpongeRegistry(biomeRegistry));
} else {
backingVolume = null;
diff --git a/src/main/resources/common.accesswidener b/src/main/resources/common.accesswidener
index 215cc24aa91..c370b151d43 100644
--- a/src/main/resources/common.accesswidener
+++ b/src/main/resources/common.accesswidener
@@ -12,9 +12,8 @@ accessible class net/minecraft/server/network/ServerLoginPacketListenerImpl$Stat
extendable method net/minecraft/server/players/IpBanList getIpFromAddress (Ljava/net/SocketAddress;)Ljava/lang/String;
accessible class net/minecraft/server/commands/TeleportCommand$LookAt
extendable class net/minecraft/world/item/crafting/Ingredient
-extendable method net/minecraft/world/item/crafting/Ingredient (Ljava/util/stream/Stream;)V
-accessible field net/minecraft/world/item/crafting/Ingredient values [Lnet/minecraft/world/item/crafting/Ingredient$Value;
-accessible class net/minecraft/world/item/crafting/Ingredient$Value
+extendable method net/minecraft/world/item/crafting/Ingredient (Lnet/minecraft/core/HolderSet;)V
+accessible field net/minecraft/world/item/crafting/Ingredient values Lnet/minecraft/core/HolderSet;
accessible method net/minecraft/world/level/biome/Biome getTemperature (Lnet/minecraft/core/BlockPos;)F
accessible class net/minecraft/server/level/ServerLevel$EntityCallbacks
accessible class net/minecraft/network/protocol/game/ServerboundInteractPacket$Action
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java
deleted file mode 100644
index 651609ec6ac..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.event.cause.entity.damage;
-
-import org.spongepowered.api.event.cause.entity.damage.DamageModifier;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = DamageModifier.Builder.class, remap = false)
-public abstract class DamageModifier_BuilderMixin_ItemStackLike {
-
- public DamageModifier.Builder item(ItemStack itemStack) {
- return ((DamageModifier.Builder) (Object) this).item(itemStack);
- }
-
- public DamageModifier.Builder item(ItemStackSnapshot snapshot) {
- return ((DamageModifier.Builder) (Object) this).item(snapshot);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java
deleted file mode 100644
index 64fbebeb6ca..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.enchantment;
-
-import org.spongepowered.api.item.enchantment.EnchantmentType;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = EnchantmentType.class, remap = false)
-public interface EnchantmentTypeMixin_ItemStackLike {
-
- default boolean canBeAppliedToStack(ItemStack stack) {
- return ((EnchantmentType) this).canBeAppliedToStack(stack);
- }
-
- default boolean canBeAppliedByTable(ItemStack stack) {
- return ((EnchantmentType) this).canBeAppliedByTable(stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java
deleted file mode 100644
index 364cfa752b8..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory;
-
-import org.spongepowered.api.data.type.HandType;
-import org.spongepowered.api.item.inventory.ArmorEquipable;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.asm.mixin.Mixin;
-
-import java.util.function.Supplier;
-
-@Mixin(value = ArmorEquipable.class, remap = false)
-public interface ArmorEquipableMixin_ItemStackLike {
-
- default void setHead(ItemStack head) {
- ((ArmorEquipable) this).setHead(head);
- }
-
- default void setChest(ItemStack chest) {
- ((ArmorEquipable) this).setChest(chest);
- }
-
- default void setLegs(ItemStack legs) {
- ((ArmorEquipable) this).setLegs(legs);
- }
-
- default void setFeet(ItemStack feet) {
- ((ArmorEquipable) this).setFeet(feet);
- }
-
- default void setItemInHand(Supplier extends HandType> handType, ItemStack itemInHand) {
- ((ArmorEquipable) this).setItemInHand(handType, itemInHand);
- }
-
- default void setItemInHand(HandType handType, ItemStack itemInHand) {
- ((ArmorEquipable) this).setItemInHand(handType, itemInHand);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java
deleted file mode 100644
index 41d156060d8..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory;
-
-import org.spongepowered.api.item.inventory.Container;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = Container.class, remap = false)
-public interface ContainerMixin_ItemStackLike {
-
- default boolean setCursor(ItemStack item) {
- return ((Container) this).setCursor(item);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java
deleted file mode 100644
index 1c3e2e1d5b3..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory;
-
-import org.spongepowered.api.item.inventory.Inventory;
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = Inventory.class, remap = false)
-public interface InventoryMixin_ItemStackLike {
-
- default InventoryTransactionResult offer(ItemStack... stacks) {
- return ((Inventory) this).offer(stacks);
- }
-
- default boolean canFit(ItemStack stack) {
- return ((Inventory) this).canFit(stack);
- }
-
- default InventoryTransactionResult offer(int index, ItemStack stack) {
- return ((Inventory) this).offer(index, stack);
- }
-
- default InventoryTransactionResult set(int index, ItemStack stack) {
- return ((Inventory) this).set(index, stack);
- }
-
- default boolean contains(ItemStack stack) {
- return ((Inventory) this).contains(stack);
- }
-
- default boolean containsAny(ItemStack stack) {
- return ((Inventory) this).containsAny(stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java
deleted file mode 100644
index aa7d328d3bb..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.Slot;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = Slot.class, remap = false)
-public interface SlotMixin_ItemStackLike {
-
- default InventoryTransactionResult set(ItemStack stack) {
- return ((Slot) this).set(stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java
deleted file mode 100644
index 87611017b43..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.equipment;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.equipment.EquipmentInventory;
-import org.spongepowered.api.item.inventory.equipment.EquipmentType;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.asm.mixin.Mixin;
-
-import java.util.function.Supplier;
-
-@Mixin(value = EquipmentInventory.class, remap = false)
-public interface EquipmentInventoryMixin_ItemStackLike {
-
- default InventoryTransactionResult set(EquipmentType equipmentType, ItemStack stack) {
- return ((EquipmentInventory) this).set(equipmentType, stack);
- }
-
- default InventoryTransactionResult set(Supplier extends EquipmentType> equipmentType, ItemStack stack) {
- return ((EquipmentInventory) this).set(equipmentType, stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java
deleted file mode 100644
index 47ad0ab29f4..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.slot;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.slot.FilteringSlot;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = FilteringSlot.class, remap = false)
-public interface FilteringSlotMixin_ItemStackLike {
-
- default boolean isValidItem(ItemStack stack) {
- return ((FilteringSlot) this).isValidItem(stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java
deleted file mode 100644
index 51c5d822d0d..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.transaction;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = InventoryTransactionResult.Builder.class, remap = false)
-public interface InventoryTransactionResult_BuilderMixin_ItemStackLike {
-
- default InventoryTransactionResult.Builder reject(ItemStack... itemStacks) {
- return ((InventoryTransactionResult.Builder) this).reject(itemStacks);
- }
-
- default InventoryTransactionResult.Builder.PollBuilder poll(ItemStackSnapshot itemStack) {
- return ((InventoryTransactionResult.Builder) this).poll(itemStack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java
deleted file mode 100644
index 90faa9215ae..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.transaction;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.transaction.SlotTransaction;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = SlotTransaction.class, remap = false)
-public abstract class SlotTransactionMixin_ItemStackLike {
-
- public void setCustom(ItemStack stack) {
- ((SlotTransaction) (Object) this).setCustom(stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java
deleted file mode 100644
index 54ece4cfa91..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.type;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.api.item.inventory.type.GridInventory;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = GridInventory.class, remap = false)
-public interface GridInventoryMixin_ItemStackLike {
-
- default InventoryTransactionResult set(int x, int y, ItemStack stack) {
- return ((GridInventory) this).set(x, y, stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java
deleted file mode 100644
index 58dbb68f0d2..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.type;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
-import org.spongepowered.api.item.inventory.type.Inventory2D;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.math.vector.Vector2i;
-
-@Mixin(value = Inventory2D.class, remap = false)
-public interface Inventory2DMixin_ItemStackLike {
-
- default InventoryTransactionResult set(Vector2i pos, ItemStack stack) {
- return ((Inventory2D) this).set(pos, stack);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java
deleted file mode 100644
index 7044bb40170..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.inventory.type;
-
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
-import org.spongepowered.api.item.inventory.type.ViewableInventory;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = ViewableInventory.Builder.DummyStep.class, remap = false)
-public interface ViewableInventory_Builder_DummyStepMixin_ItemStackLike {
-
- default ViewableInventory.Builder.BuildingStep item(ItemStackSnapshot item) {
- return ((ViewableInventory.Builder.DummyStep) this).item(item);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java
deleted file mode 100644
index 44317b114a9..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.merchant;
-
-import org.spongepowered.api.item.inventory.ItemStack;
-import org.spongepowered.api.item.merchant.TradeOffer;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(value = TradeOffer.Builder.class, remap = false)
-public interface TradeOffer_BuilderMixin_ItemStackLike {
-
- default TradeOffer.Builder firstBuyingItem(ItemStack item) {
- return ((TradeOffer.Builder) this).firstBuyingItem(item);
- }
-
- default TradeOffer.Builder secondBuyingItem(ItemStack item) {
- return ((TradeOffer.Builder) this).secondBuyingItem(item);
- }
-
- default TradeOffer.Builder sellingItem(ItemStack item) {
- return ((TradeOffer.Builder) this).sellingItem(item);
- }
-}
diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java
deleted file mode 100644
index 7fa4d9312c2..00000000000
--- a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of Sponge, licensed under the MIT License (MIT).
- *
- * Copyright (c) SpongePowered
- * 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.itemstacklike.item.recipe;
-
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
-import org.spongepowered.api.item.recipe.Recipe;
-import org.spongepowered.api.item.recipe.RecipeManager;
-import org.spongepowered.api.item.recipe.RecipeType;
-import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
-import org.spongepowered.asm.mixin.Mixin;
-
-import java.util.Collection;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-@Mixin(value = RecipeManager.class, remap = false)
-public interface RecipeManagerMixin_ItemStackLike {
-
- default > Collection findByResult(RecipeType type, ItemStackSnapshot result) {
- return ((RecipeManager) this).findByResult(type, result);
- }
-
- default > Collection findByResult(Supplier extends RecipeType> supplier, ItemStackSnapshot result) {
- return ((RecipeManager) this).findByResult(supplier, result);
- }
-
- default Optional findCookingRecipe(RecipeType type, ItemStackSnapshot ingredient) {
- return ((RecipeManager) this).findCookingRecipe(type, ingredient);
- }
-
- default