mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
stop adventure mode from changing block configs (#7043)
This commit is contained in:
parent
2cf08a1231
commit
3f464bcefa
3 changed files with 17 additions and 4 deletions
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllTags.AllItemTags;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.SidedFilteringBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.SidedFilteringBehaviour;
|
||||||
|
import com.simibubi.create.foundation.utility.AdventureUtil;
|
||||||
import com.simibubi.create.foundation.utility.RaycastHelper;
|
import com.simibubi.create.foundation.utility.RaycastHelper;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -92,7 +93,6 @@ public class ValueSettingsInputHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canInteract(Player player) {
|
public static boolean canInteract(Player player) {
|
||||||
return player != null && !player.isSpectator() && !player.isShiftKeyDown();
|
return player != null && !player.isSpectator() && !player.isShiftKeyDown() && !AdventureUtil.isAdventure(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.simibubi.create.foundation.networking;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.blockEntity.SyncedBlockEntity;
|
import com.simibubi.create.foundation.blockEntity.SyncedBlockEntity;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.AdventureUtil;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
@ -33,7 +35,7 @@ public abstract class BlockEntityConfigurationPacket<BE extends SyncedBlockEntit
|
||||||
public boolean handle(Context context) {
|
public boolean handle(Context context) {
|
||||||
context.enqueueWork(() -> {
|
context.enqueueWork(() -> {
|
||||||
ServerPlayer player = context.getSender();
|
ServerPlayer player = context.getSender();
|
||||||
if (player == null)
|
if (player == null || player.isSpectator() || AdventureUtil.isAdventure(player))
|
||||||
return;
|
return;
|
||||||
Level world = player.level();
|
Level world = player.level();
|
||||||
if (world == null || !world.isLoaded(pos))
|
if (world == null || !world.isLoaded(pos))
|
||||||
|
@ -63,7 +65,7 @@ public abstract class BlockEntityConfigurationPacket<BE extends SyncedBlockEntit
|
||||||
protected void applySettings(ServerPlayer player, BE be) {
|
protected void applySettings(ServerPlayer player, BE be) {
|
||||||
applySettings(be);
|
applySettings(be);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean causeUpdate() {
|
protected boolean causeUpdate() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class AdventureUtil {
|
||||||
|
public static boolean isAdventure(@Nullable Player player) {
|
||||||
|
return player != null && !player.mayBuild() && !player.isSpectator();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue