mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Merge remote-tracking branch 'concealed/mc1.20.1/feature-dev' into mc1.20.1/feature-dev
This commit is contained in:
commit
8dd7e64c4c
9 changed files with 59 additions and 18 deletions
|
@ -24,13 +24,18 @@ public class AddressEditBox extends EditBox {
|
|||
|
||||
private DestinationSuggestions destinationSuggestions;
|
||||
private Consumer<String> mainResponder;
|
||||
private String prevValue = "=)";
|
||||
|
||||
public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom) {
|
||||
super(pFont, pX, pY, pWidth, pHeight, Component.empty());
|
||||
destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom);
|
||||
destinationSuggestions.setAllowSuggestions(true);
|
||||
destinationSuggestions.updateCommandInfo();
|
||||
mainResponder = t -> destinationSuggestions.updateCommandInfo();
|
||||
mainResponder = t -> {
|
||||
if (t.equals(prevValue))
|
||||
destinationSuggestions.updateCommandInfo();
|
||||
prevValue = t;
|
||||
};
|
||||
setResponder(mainResponder);
|
||||
setBordered(false);
|
||||
setFocused(false);
|
||||
|
@ -63,8 +68,8 @@ public class AddressEditBox extends EditBox {
|
|||
boolean wasFocused = isFocused();
|
||||
if (super.mouseClicked(pMouseX, pMouseY, pButton)) {
|
||||
if (!wasFocused) {
|
||||
setHighlightPos(getValue().length());
|
||||
setCursorPosition(0);
|
||||
setHighlightPos(0);
|
||||
setCursorPosition(getValue().length());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -81,8 +86,6 @@ public class AddressEditBox extends EditBox {
|
|||
@Override
|
||||
public void setFocused(boolean focused) {
|
||||
super.setFocused(focused);
|
||||
if (!focused)
|
||||
setHighlightPos(getCursorPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,6 @@ package com.simibubi.create.content.logistics.packagePort;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -114,14 +112,14 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
|
|||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (target != null)
|
||||
target.deregister(this, level, worldPosition);
|
||||
itemHandler.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (target != null)
|
||||
target.deregister(this, level, worldPosition);
|
||||
super.destroy();
|
||||
for (int i = 0; i < inventory.getSlots(); i++)
|
||||
drop(inventory.getStackInSlot(i));
|
||||
|
|
|
@ -53,6 +53,9 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
private boolean failedLastExport;
|
||||
private FrogportSounds sounds;
|
||||
|
||||
private ItemStack deferAnimationStart;
|
||||
private boolean deferAnimationInward;
|
||||
|
||||
private AdvancementBehaviour advancements;
|
||||
|
||||
public FrogportBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
|
@ -118,6 +121,11 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (deferAnimationStart != null) {
|
||||
startAnimation(deferAnimationStart, deferAnimationInward);
|
||||
deferAnimationStart = null;
|
||||
}
|
||||
|
||||
if (anticipationProgress.getValue() == 1)
|
||||
anticipationProgress.updateChaseTarget(0);
|
||||
|
||||
|
@ -293,7 +301,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
protected void write(CompoundTag tag, boolean clientPacket) {
|
||||
super.write(tag, clientPacket);
|
||||
tag.putFloat("PlacedYaw", passiveYaw);
|
||||
if (animatedPackage != null) {
|
||||
if (animatedPackage != null && isAnimationInProgress()) {
|
||||
tag.put("AnimatedPackage", animatedPackage.serializeNBT());
|
||||
tag.putBoolean("Deposit", currentlyDepositing);
|
||||
}
|
||||
|
@ -312,8 +320,10 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
failedLastExport = tag.getBoolean("FailedLastExport");
|
||||
if (!clientPacket)
|
||||
animatedPackage = null;
|
||||
if (tag.contains("AnimatedPackage"))
|
||||
startAnimation(ItemStack.of(tag.getCompound("AnimatedPackage")), tag.getBoolean("Deposit"));
|
||||
if (tag.contains("AnimatedPackage")) {
|
||||
deferAnimationInward = tag.getBoolean("Deposit");
|
||||
deferAnimationStart = ItemStack.of(tag.getCompound("AnimatedPackage"));
|
||||
}
|
||||
if (clientPacket && tag.contains("Anticipate"))
|
||||
anticipate();
|
||||
}
|
||||
|
|
|
@ -108,4 +108,9 @@ public class PostboxBlock extends HorizontalDirectionalBlock
|
|||
.orElse(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pMovedByPiston) {
|
||||
IBE.onRemove(pState, pLevel, pPos, pNewState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
|
|||
|
||||
@Override
|
||||
public boolean broadcastPackageRequest(RequestType type, PackageOrder order, IItemHandler ignoredHandler,
|
||||
String address) {
|
||||
boolean result = super.broadcastPackageRequest(type, order, ignoredHandler, address);
|
||||
String address, @Nullable PackageOrder orderContext) {
|
||||
boolean result = super.broadcastPackageRequest(type, order, ignoredHandler, address, orderContext);
|
||||
previouslyUsedAddress = address;
|
||||
notifyUpdate();
|
||||
return result;
|
||||
|
|
|
@ -13,8 +13,8 @@ import com.simibubi.create.content.schematics.requirement.ItemRequirement;
|
|||
import com.simibubi.create.foundation.blockEntity.IMergeableBE;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
|
||||
import net.createmod.catnip.math.BBHelper;
|
||||
import net.createmod.catnip.levelWrappers.SchematicLevel;
|
||||
import net.createmod.catnip.math.BBHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -32,6 +32,7 @@ import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
|||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
public class SchematicPrinter {
|
||||
|
||||
|
@ -338,4 +339,15 @@ public class SchematicPrinter {
|
|||
|| BlockMovementChecks.isBrittle(state);
|
||||
}
|
||||
|
||||
public void sendBlockUpdates(Level level) {
|
||||
BoundingBox bounds = blockReader.getBounds();
|
||||
BlockPos.betweenClosedStream(bounds.inflatedBy(1))
|
||||
.filter(pos -> !bounds.isInside(pos))
|
||||
.filter(
|
||||
pos -> level.isLoaded(pos.offset(schematicAnchor)) && level.getFluidState(pos.offset(schematicAnchor))
|
||||
.is(Fluids.WATER))
|
||||
.forEach(
|
||||
pos -> level.scheduleTick(pos.offset(schematicAnchor), Fluids.WATER, Fluids.WATER.getTickDelay(level)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -566,6 +566,8 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
}
|
||||
|
||||
public void finishedPrinting() {
|
||||
if (replaceMode == ConfigureSchematicannonPacket.Option.REPLACE_EMPTY.ordinal())
|
||||
printer.sendBlockUpdates(level);
|
||||
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_SCHEMATIC.get(), inventory.getStackInSlot(1)
|
||||
.getCount() + 1));
|
||||
|
|
|
@ -47,7 +47,15 @@ public class DestinationSuggestions extends CommandSuggestions {
|
|||
|
||||
@Override
|
||||
public void updateCommandInfo() {
|
||||
String value = textBox.getValue().substring(0, textBox.getCursorPosition());
|
||||
String trimmed = textBox.getValue()
|
||||
.substring(0, textBox.getCursorPosition());
|
||||
|
||||
if (!textBox.getHighlighted()
|
||||
.isBlank())
|
||||
trimmed = trimmed.replace(textBox.getHighlighted(), "");
|
||||
|
||||
final String value = trimmed;
|
||||
|
||||
if (value.equals(previous))
|
||||
return;
|
||||
if (!active) {
|
||||
|
|
|
@ -72,9 +72,12 @@ public class RuntimeDataGenerator {
|
|||
ResourceLocation buttonId = base.withSuffix("button");
|
||||
ResourceLocation signId = base.withSuffix("sign");
|
||||
|
||||
if (!noStrippedVariant)
|
||||
if (!noStrippedVariant) {
|
||||
simpleWoodRecipe(nonStrippedId, itemId);
|
||||
simpleWoodRecipe(itemId, planksId, 6);
|
||||
} else {
|
||||
simpleWoodRecipe(TagKey.create(Registries.ITEM, nonStrippedId.withSuffix("s")), planksId, 6);
|
||||
}
|
||||
|
||||
if (!path.contains("_wood") && !path.contains("_hyphae") && BuiltInRegistries.ITEM.containsKey(planksId)) {
|
||||
simpleWoodRecipe(planksId, stairsId);
|
||||
|
|
Loading…
Add table
Reference in a new issue