Stronk in Description, guard isCreative from NPE

This commit is contained in:
simibubi 2022-12-12 13:12:39 +01:00
parent 76aeb83254
commit 12065c6b09
2 changed files with 4 additions and 6 deletions

View file

@ -5,8 +5,6 @@ import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.foundation.config.AllConfigs;
import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.MutablePair;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
@ -20,6 +18,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity;
import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.config.ContraptionMovementSetting; import com.simibubi.create.foundation.config.ContraptionMovementSetting;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
@ -205,11 +204,10 @@ public class MinecartContraptionItem extends Item {
public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) { public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) {
Entity entity = event.getTarget(); Entity entity = event.getTarget();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!AllConfigs.SERVER.kinetics.survivalContraptionPickup.get() && !player.isCreative()) {
return;
}
if (player == null || entity == null) if (player == null || entity == null)
return; return;
if (!AllConfigs.SERVER.kinetics.survivalContraptionPickup.get() && !player.isCreative())
return;
ItemStack wrench = player.getItemInHand(event.getHand()); ItemStack wrench = player.getItemInHand(event.getHand());
if (!AllItems.WRENCH.isIn(wrench)) if (!AllItems.WRENCH.isIn(wrench))

View file

@ -106,7 +106,7 @@ public class CKinetics extends ConfigBase {
static String maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw"; static String maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw";
static String ejectorScanInterval = static String ejectorScanInterval =
"Time in ticks until the next item launched by an ejector scans blocks for potential collisions"; "Time in ticks until the next item launched by an ejector scans blocks for potential collisions";
static String survivalContraptionPickup = "Allow for minecart contartaption pickup in survival mode."; static String survivalContraptionPickup = "Whether minecart contraptions can be picked up in survival mode.";
static String spawnerMovement = "Configure how Spawner blocks can be moved by contraptions."; static String spawnerMovement = "Configure how Spawner blocks can be moved by contraptions.";
static String amethystMovement = "Configure how Budding Amethyst can be moved by contraptions."; static String amethystMovement = "Configure how Budding Amethyst can be moved by contraptions.";
static String obsidianMovement = "Configure how Obsidian blocks can be moved by contraptions."; static String obsidianMovement = "Configure how Obsidian blocks can be moved by contraptions.";