From a15c9b0ad5584bb82822351187bd06dce06d083a Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Thu, 17 Jun 2021 20:32:52 -0700 Subject: [PATCH] Fix errors from last commit - Create method overload in SchematicItem to solve errors - Organize imports and do formatting in schematic related classes --- .../content/schematics/SchematicPrinter.java | 19 ++++++------------- .../block/SchematicTableTileEntity.java | 1 - .../block/SchematicannonTileEntity.java | 9 --------- .../filtering/SchematicInstances.java | 1 - .../schematics/item/SchematicItem.java | 4 ++++ .../packet/SchematicPlacePacket.java | 8 +------- 6 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicPrinter.java b/src/main/java/com/simibubi/create/content/schematics/SchematicPrinter.java index 69a35ad9c..4006b976a 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicPrinter.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicPrinter.java @@ -1,21 +1,16 @@ package com.simibubi.create.content.schematics; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + import com.simibubi.create.AllBlocks; -import com.simibubi.create.AllTags; import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks; -import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity; -import com.simibubi.create.content.schematics.block.SchematicannonTileEntity; - import com.simibubi.create.content.schematics.item.SchematicItem; - import com.simibubi.create.foundation.utility.BlockHelper; -import com.simibubi.create.foundation.utility.IPartialSafeNBT; -import com.simibubi.create.foundation.utility.NBTProcessors; - import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; @@ -32,11 +27,8 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - public class SchematicPrinter { + public enum PrintStage { BLOCKS, DEFERRED_BLOCKS, ENTITIES } @@ -302,4 +294,5 @@ public class SchematicPrinter { public static boolean shouldDeferBlock(BlockState state) { return state.getBlock().is(AllBlocks.GANTRY_CARRIAGE.get()) || BlockMovementChecks.isBrittle(state); } + } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableTileEntity.java index a0d89ba0d..d75bb645b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableTileEntity.java @@ -14,7 +14,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.items.ItemStackHandler; public class SchematicTableTileEntity extends SyncedTileEntity implements ITickableTileEntity, INamedContainerProvider { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index 38dbba103..cb1cf4083 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -3,7 +3,6 @@ package com.simibubi.create.content.schematics.block; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; -import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -11,7 +10,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllTags.AllBlockTags; -import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; @@ -21,8 +19,6 @@ import com.simibubi.create.content.schematics.ItemRequirement; import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.content.schematics.MaterialChecklist; import com.simibubi.create.content.schematics.SchematicPrinter; -import com.simibubi.create.content.schematics.SchematicWorld; -import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CSchematics; import com.simibubi.create.foundation.item.ItemHelper; @@ -30,7 +26,6 @@ import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode; import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.IPartialSafeNBT; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; @@ -50,7 +45,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; -import net.minecraft.nbt.NBTUtil; import net.minecraft.network.PacketBuffer; import net.minecraft.state.properties.BedPart; import net.minecraft.state.properties.BlockStateProperties; @@ -61,10 +55,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; diff --git a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java index 90a184ddb..9ca103e6b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java +++ b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java @@ -1,6 +1,5 @@ package com.simibubi.create.content.schematics.filtering; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; diff --git a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java index 151e04350..eca91e789 100644 --- a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java @@ -99,6 +99,10 @@ public class SchematicItem extends Item { SchematicInstances.clearHash(blueprint); } + public static PlacementSettings getSettings(ItemStack blueprint) { + return getSettings(blueprint, true); + } + public static PlacementSettings getSettings(ItemStack blueprint, boolean processNBT) { CompoundNBT tag = blueprint.getTag(); PlacementSettings settings = new PlacementSettings(); diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java index 13e5c584b..01cc59d07 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java @@ -3,20 +3,14 @@ package com.simibubi.create.content.schematics.packet; import java.util.function.Supplier; import com.simibubi.create.content.schematics.SchematicPrinter; -import com.simibubi.create.content.schematics.SchematicProcessor; -import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.foundation.networking.SimplePacketBase; - import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.NBTUtil; import net.minecraft.network.PacketBuffer; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; import net.minecraftforge.fml.network.NetworkEvent.Context; public class SchematicPlacePacket extends SimplePacketBase { @@ -45,7 +39,7 @@ public class SchematicPlacePacket extends SimplePacketBase { SchematicPrinter printer = new SchematicPrinter(); printer.loadSchematic(stack, world, !player.canUseCommandBlock()); - while(printer.advanceCurrentPos()) { + while (printer.advanceCurrentPos()) { if (!printer.shouldPlaceCurrent(world)) continue;