Merge & Port

This commit is contained in:
grimmauld 2021-03-26 23:13:49 +01:00
commit fe10c258c4
12 changed files with 209 additions and 99 deletions

View file

@ -407,16 +407,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
768a724d6c921cb92790364cf7a692fe8742a885 assets/create/lang/en_ud.json
74c0dd6af2ffc332fe1459f9c3fbfc9371eb2507 assets/create/lang/en_us.json
97f7b6e61707a003e907ee166911ca106f0439d6 assets/create/lang/unfinished/de_de.json
363aca3d1194218b7d48fcec33d36c1b9c555e4e assets/create/lang/en_us.json
616063d3a66a6e56ccee1584ce38986d363908df assets/create/lang/unfinished/de_de.json
aa49b660299817b148b362f9f5c357906de8df90 assets/create/lang/unfinished/es_es.json
072cb64aac3feba48a2ca7e481cda325d7648b0f assets/create/lang/unfinished/es_mx.json
c85b6b95decefd03769debc9d6a2ac1bff481dd4 assets/create/lang/unfinished/es_mx.json
5463fcf22674ed540ce860358508fbac609c49d1 assets/create/lang/unfinished/fr_fr.json
7fbd50f2325711f3a2fd086d8307ff1afb577220 assets/create/lang/unfinished/it_it.json
ff653860335529694629c7cabb7953afebc6fea3 assets/create/lang/unfinished/ja_jp.json
332556b3f5364601e872431fab0fe3cdf40ac373 assets/create/lang/unfinished/ko_kr.json
cc8e5eb4c2ea1390a215d12462d54f761e076c64 assets/create/lang/unfinished/nl_nl.json
88fd1b02799e8d1392be7df529803321e334033d assets/create/lang/unfinished/pt_br.json
8043c3d6d26835c784d1163282a9d4a391a6c8dd assets/create/lang/unfinished/nl_nl.json
c562a4d350d9abb40e83ab4a78851eda3886dfe9 assets/create/lang/unfinished/pt_br.json
f58b4e50ef5042aad6b254db7ff8c219f06b9ea3 assets/create/lang/unfinished/ru_ru.json
e9e4cfbc8ef54b6c04ae77c776dfa7e546d05e02 assets/create/lang/unfinished/zh_cn.json
eb17617bb14d0ffac000f86d6f9aa23429e8f4c3 assets/create/lang/unfinished/zh_tw.json

View file

@ -882,7 +882,7 @@
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "Removed selection.",
"create.schematicAndQuill.title": "Schematic Name:",
"create.schematicAndQuill.convert": "Save and Deploy Immediately",
"create.schematicAndQuill.convert": "Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "My Schematic",
"create.schematicAndQuill.saved": "Saved as %1$s",
@ -897,12 +897,12 @@
"create.schematic.mirror.none": "None",
"create.schematic.mirror.frontBack": "Front-Back",
"create.schematic.mirror.leftRight": "Left-Right",
"create.schematic.tool.deploy": "Deploy",
"create.schematic.tool.deploy": "Position",
"create.schematic.tool.move": "Move XZ",
"create.schematic.tool.movey": "Move Y",
"create.schematic.tool.rotate": "Rotate",
"create.schematic.tool.print": "Print",
"create.schematic.tool.flip": "Flip",
"create.schematic.tool.flip": "Mirror",
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
"create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.",
@ -978,7 +978,7 @@
"create.schematicannon.status.placing": "Placing",
"create.schematicannon.status.clearing": "Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
"create.materialChecklist": "Material Checklist",

View file

@ -883,7 +883,7 @@
"create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.",
"create.schematicAndQuill.abort": "Auswahl zurückgesetzt.",
"create.schematicAndQuill.title": "Bauplanname:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Mein Bauplan",
"create.schematicAndQuill.saved": "Gespeichert als %1$s",

View file

@ -883,7 +883,7 @@
"create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "UNLOCALIZED: My Schematic",
"create.schematicAndQuill.saved": "UNLOCALIZED: Saved as %1$s",
@ -898,12 +898,12 @@
"create.schematic.mirror.none": "UNLOCALIZED: None",
"create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back",
"create.schematic.mirror.leftRight": "UNLOCALIZED: Left-Right",
"create.schematic.tool.deploy": "UNLOCALIZED: Deploy",
"create.schematic.tool.deploy": "UNLOCALIZED: Position",
"create.schematic.tool.move": "UNLOCALIZED: Move XZ",
"create.schematic.tool.movey": "UNLOCALIZED: Move Y",
"create.schematic.tool.rotate": "UNLOCALIZED: Rotate",
"create.schematic.tool.print": "UNLOCALIZED: Print",
"create.schematic.tool.flip": "UNLOCALIZED: Flip",
"create.schematic.tool.flip": "UNLOCALIZED: Mirror",
"create.schematic.tool.deploy.description.0": "UNLOCALIZED: Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "UNLOCALIZED: Right-Click on the ground to place.",
"create.schematic.tool.deploy.description.2": "UNLOCALIZED: Hold [Ctrl] to select at a fixed distance.",
@ -979,7 +979,7 @@
"create.schematicannon.status.placing": "UNLOCALIZED: Placing",
"create.schematicannon.status.clearing": "UNLOCALIZED: Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "UNLOCALIZED: Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic Not Deployed",
"create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "UNLOCALIZED: Schematic File Expired",
"create.materialChecklist": "UNLOCALIZED: Material Checklist",

View file

@ -883,7 +883,7 @@
"create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.",
"create.schematicAndQuill.abort": "Keuze verwijderd.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Mijn Bouwtekening",
"create.schematicAndQuill.saved": "Opgeslagen als %1$s",

View file

@ -883,7 +883,7 @@
"create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.",
"create.schematicAndQuill.abort": "Seleção removida.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Meu Esquema",
"create.schematicAndQuill.saved": "Salvo como %1$s",

View file

@ -1,6 +1,16 @@
package com.simibubi.create.content.contraptions.components.deployer;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
@ -8,23 +18,33 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.content.schematics.filtering.SchematicInstances;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.NBTProcessors;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.Constants.NBT;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.items.IItemHandler;
public class DeployerMovementBehaviour extends MovementBehaviour {
@ -52,6 +72,12 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
}
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
World world = context.world;
ItemStack filter = getFilter(context);
if (AllItems.SCHEMATIC.isIn(filter))
activateAsSchematicPrinter(context, pos, player, world, filter);
Vector3d facingVec = Vector3d.of(context.state.get(DeployerBlock.FACING)
.getDirectionVec());
facingVec = context.rotation.apply(facingVec);
@ -62,6 +88,61 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
DeployerHandler.activate(player, vec, pos, facingVec, mode);
}
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, World world,
ItemStack filter) {
if (!filter.hasTag())
return;
if (!world.getBlockState(pos)
.getMaterial()
.isReplaceable())
return;
CompoundNBT tag = filter.getTag();
if (!tag.getBoolean("Deployed"))
return;
SchematicWorld schematicWorld = SchematicInstances.get(world, filter);
if (!schematicWorld.getBounds()
.isVecInside(pos.subtract(schematicWorld.anchor)))
return;
BlockState blockState = schematicWorld.getBlockState(pos);
ItemRequirement requirement = ItemRequirement.of(blockState);
if (requirement.isInvalid() || requirement.isEmpty())
return;
if (AllBlocks.BELT.has(blockState))
return;
List<ItemStack> requiredItems = requirement.getRequiredItems();
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
IItemHandler iItemHandler = context.contraption.inventory;
for (ItemStack required : requiredItems) {
int amountFound = ItemHelper
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), true)
.getCount();
if (amountFound < required.getCount())
return;
}
for (ItemStack required : requiredItems)
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), false);
CompoundNBT data = null;
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null) {
data = tile.write(new CompoundNBT());
data = NBTProcessors.process(tile, data, true);
}
}
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.getRegistryKey(), world, pos);
BlockHelper.placeSchematicBlock(world, blockState, pos, firstRequired, data);
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
blocksnapshot.restore(true, false);
}
@Override
public void tick(MovementContext context) {
if (context.world.isRemote)
@ -109,6 +190,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
if (player.getHeldItemMainhand()
.isEmpty()) {
ItemStack filter = getFilter(context);
if (AllItems.SCHEMATIC.isIn(filter))
return;
ItemStack held = ItemHelper.extract(context.contraption.inventory,
stack -> FilterItem.test(context.world, stack, filter), 1, false);
player.setHeldItem(Hand.MAIN_HAND, held);

View file

@ -3,32 +3,23 @@ package com.simibubi.create.content.schematics.block;
import java.util.Optional;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
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.item.BeltConnectorItem;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.FluidTags;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.Constants;
public abstract class LaunchedItem {
@ -129,46 +120,7 @@ public abstract class LaunchedItem {
@Override
void place(World world) {
// Piston
if (state.contains(BlockStateProperties.EXTENDED))
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
if (state.contains(BlockStateProperties.WATERLOGGED))
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
if (AllBlocks.BELT.has(state)) {
world.setBlockState(target, state, 2);
return;
}
else if (state.getBlock() == Blocks.COMPOSTER)
state = Blocks.COMPOSTER.getDefaultState();
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
state = ((IPlantable) state.getBlock()).getPlant(world, target);
if (world.getDimension().isUltrawarm() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) {
int i = target.getX();
int j = target.getY();
int k = target.getZ();
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);
}
Block.spawnDrops(state, world, target);
return;
}
world.setBlockState(target, state, 18);
if (data != null) {
TileEntity tile = world.getTileEntity(target);
if (tile != null) {
data.putInt("x", target.getX());
data.putInt("y", target.getY());
data.putInt("z", target.getZ());
if (tile instanceof KineticTileEntity)
((KineticTileEntity) tile).warnOfMovement();
tile.fromTag(state, data);
}
}
state.getBlock().onBlockPlacedBy(world, target, state, null, stack);
BlockHelper.placeSchematicBlock(world, state, target, stack, data);
}
}

View file

@ -175,7 +175,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (compound.contains("CurrentPos"))
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
}
// Gui information
statusMsg = compound.getString("Status");
schematicProgress = compound.getFloat("Progress");
@ -185,17 +185,17 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
blocksPlaced = compound.getInt("AmountPlaced");
blocksToPlace = compound.getInt("AmountToPlace");
printingEntityIndex = compound.getInt("EntityProgress");
missingItem = null;
if (compound.contains("MissingItem"))
missingItem = ItemStack.read(compound.getCompound("MissingItem"));
// Settings
CompoundNBT options = compound.getCompound("Options");
replaceMode = options.getInt("ReplaceMode");
skipMissing = options.getBoolean("SkipMissing");
replaceTileEntities = options.getBoolean("ReplaceTileEntities");
// Printer & Flying Blocks
if (compound.contains("Target"))
target = NBTUtil.readBlockPos(compound.getCompound("Target"));
@ -250,7 +250,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
}
}
// Gui information
compound.putFloat("Progress", schematicProgress);
compound.putFloat("PaperProgress", bookPrintingProgress);
@ -260,17 +260,17 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
compound.putInt("AmountPlaced", blocksPlaced);
compound.putInt("AmountToPlace", blocksToPlace);
compound.putInt("EntityProgress", printingEntityIndex);
if (missingItem != null)
compound.put("MissingItem", missingItem.serializeNBT());
// Settings
CompoundNBT options = new CompoundNBT();
options.putInt("ReplaceMode", replaceMode);
options.putBoolean("SkipMissing", skipMissing);
options.putBoolean("ReplaceTileEntities", replaceTileEntities);
compound.put("Options", options);
// Printer & Flying Blocks
if (target != null)
compound.put("Target", NBTUtil.writeBlockPos(target));
@ -375,11 +375,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
}
if (missingItem == null && !positionNotLoaded) {
advanceCurrentPos();
do {
advanceCurrentPos();
if (state == State.STOPPED)
return;
// End reached
if (state == State.STOPPED)
return;
} while (!blockReader.getBounds()
.isVecInside(currentPos));
sendUpdate = true;
target = schematicAnchor.add(currentPos);
@ -710,10 +712,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (world == null)
return false;
BlockState toReplace = world.getBlockState(pos);
boolean placingAir = state.getBlock().isAir(state, world, pos);
boolean placingAir = state.getBlock()
.isAir(state, world, pos);
BlockState toReplaceOther = null;
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING)
&& state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
@ -726,11 +730,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
return false;
if (toReplace == state)
return false;
if (toReplace.getBlockHardness(world, pos) == -1 || (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
if (toReplace.getBlockHardness(world, pos) == -1
|| (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
return false;
if (pos.withinDistance(getPos(), 2f))
return false;
if (!replaceTileEntities && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
if (!replaceTileEntities
&& (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
return false;
if (shouldIgnoreBlockState(state))
@ -741,10 +747,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (replaceMode == 2 && !placingAir)
return true;
if (replaceMode == 1
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos)
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
&& !placingAir)
return true;
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos)
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
return true;
return false;
@ -754,7 +762,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
// Block doesnt have a mapping (Water, lava, etc)
if (state.getBlock() == Blocks.STRUCTURE_VOID)
return true;
ItemRequirement requirement = ItemRequirement.of(state);
if (requirement.isEmpty())
return false;
@ -851,7 +859,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
}
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
if (state.getBlock().isAir(state, world, target))
if (state.getBlock()
.isAir(state, world, target))
blocksPlaced++;
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
playFiringSound();

View file

@ -20,6 +20,7 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
@ -206,7 +207,10 @@ public class SchematicHandler {
return;
if (mc.objectMouseOver instanceof BlockRayTraceResult) {
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) mc.objectMouseOver;
if (AllBlocks.SCHEMATICANNON.has(mc.world.getBlockState(blockRayTraceResult.getPos())))
BlockState clickedBlock = mc.world.getBlockState(blockRayTraceResult.getPos());
if (AllBlocks.SCHEMATICANNON.has(clickedBlock))
return;
if (AllBlocks.DEPLOYER.has(clickedBlock))
return;
}
currentTool.getTool()

View file

@ -6,6 +6,9 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -17,12 +20,16 @@ import net.minecraft.fluid.FluidState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.state.Property;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.SlabType;
import net.minecraft.tags.BlockTags;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tags.FluidTags;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.VoxelShape;
@ -32,6 +39,7 @@ import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.IPlantable;
public class BlockHelper {
@ -194,9 +202,63 @@ public class BlockHelper {
return hasBlockSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader,
fromPos.offset(toDirection), toDirection.getOpposite());
}
public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) {
return reader.getBlockState(pos).getCollisionShape(reader, pos).isEmpty();
return reader.getBlockState(pos)
.getCollisionShape(reader, pos)
.isEmpty();
}
public static void placeSchematicBlock(World world, BlockState state, BlockPos target, ItemStack stack,
@Nullable CompoundNBT data) {
// Piston
if (state.contains(BlockStateProperties.EXTENDED))
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
if (state.contains(BlockStateProperties.WATERLOGGED))
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
if (AllBlocks.BELT.has(state)) {
world.setBlockState(target, state, 2);
return;
} else if (state.getBlock() == Blocks.COMPOSTER)
state = Blocks.COMPOSTER.getDefaultState();
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
state = ((IPlantable) state.getBlock()).getPlant(world, target);
if (world.getDimension().isUltrawarm() && state.getFluidState()
.getFluid()
.isIn(FluidTags.WATER)) {
int i = target.getX();
int j = target.getY();
int k = target.getZ();
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F,
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(),
0.0D, 0.0D, 0.0D);
}
Block.spawnDrops(state, world, target);
return;
}
world.setBlockState(target, state, 18);
if (data != null) {
TileEntity tile = world.getTileEntity(target);
if (tile != null) {
data.putInt("x", target.getX());
data.putInt("y", target.getY());
data.putInt("z", target.getZ());
if (tile instanceof KineticTileEntity)
((KineticTileEntity) tile).warnOfMovement();
tile.fromTag(tile.getBlockState(), data);
}
}
try {
state.getBlock()
.onBlockPlacedBy(world, target, state, null, stack);
} catch (Exception e) {
}
}
public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) {

View file

@ -228,7 +228,7 @@
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "Removed selection.",
"create.schematicAndQuill.title": "Schematic Name:",
"create.schematicAndQuill.convert": "Save and Deploy Immediately",
"create.schematicAndQuill.convert": "Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "My Schematic",
"create.schematicAndQuill.saved": "Saved as %1$s",
@ -244,12 +244,12 @@
"create.schematic.mirror.frontBack": "Front-Back",
"create.schematic.mirror.leftRight": "Left-Right",
"create.schematic.tool.deploy": "Deploy",
"create.schematic.tool.deploy": "Position",
"create.schematic.tool.move": "Move XZ",
"create.schematic.tool.movey": "Move Y",
"create.schematic.tool.rotate": "Rotate",
"create.schematic.tool.print": "Print",
"create.schematic.tool.flip": "Flip",
"create.schematic.tool.flip": "Mirror",
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
@ -329,7 +329,7 @@
"create.schematicannon.status.placing": "Placing",
"create.schematicannon.status.clearing": "Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
"create.materialChecklist": "Material Checklist",