Merge remote-tracking branch 'concealed/mc1.20.1/feature-dev' into mc1.20.1/feature-dev

This commit is contained in:
IThundxr 2025-01-29 16:43:09 -05:00
commit 8dd7e64c4c
Failed to generate hash of commit
9 changed files with 59 additions and 18 deletions

View file

@ -24,13 +24,18 @@ public class AddressEditBox extends EditBox {
private DestinationSuggestions destinationSuggestions; private DestinationSuggestions destinationSuggestions;
private Consumer<String> mainResponder; private Consumer<String> mainResponder;
private String prevValue = "=)";
public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom) { public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom) {
super(pFont, pX, pY, pWidth, pHeight, Component.empty()); super(pFont, pX, pY, pWidth, pHeight, Component.empty());
destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom); destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom);
destinationSuggestions.setAllowSuggestions(true); destinationSuggestions.setAllowSuggestions(true);
destinationSuggestions.updateCommandInfo(); destinationSuggestions.updateCommandInfo();
mainResponder = t -> destinationSuggestions.updateCommandInfo(); mainResponder = t -> {
if (t.equals(prevValue))
destinationSuggestions.updateCommandInfo();
prevValue = t;
};
setResponder(mainResponder); setResponder(mainResponder);
setBordered(false); setBordered(false);
setFocused(false); setFocused(false);
@ -63,8 +68,8 @@ public class AddressEditBox extends EditBox {
boolean wasFocused = isFocused(); boolean wasFocused = isFocused();
if (super.mouseClicked(pMouseX, pMouseY, pButton)) { if (super.mouseClicked(pMouseX, pMouseY, pButton)) {
if (!wasFocused) { if (!wasFocused) {
setHighlightPos(getValue().length()); setHighlightPos(0);
setCursorPosition(0); setCursorPosition(getValue().length());
} }
return true; return true;
} }
@ -81,8 +86,6 @@ public class AddressEditBox extends EditBox {
@Override @Override
public void setFocused(boolean focused) { public void setFocused(boolean focused) {
super.setFocused(focused); super.setFocused(focused);
if (!focused)
setHighlightPos(getCursorPosition());
} }
@Override @Override

View file

@ -3,8 +3,6 @@ package com.simibubi.create.content.logistics.packagePort;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -114,14 +112,14 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
@Override @Override
public void invalidate() { public void invalidate() {
if (target != null)
target.deregister(this, level, worldPosition);
itemHandler.invalidate(); itemHandler.invalidate();
super.invalidate(); super.invalidate();
} }
@Override @Override
public void destroy() { public void destroy() {
if (target != null)
target.deregister(this, level, worldPosition);
super.destroy(); super.destroy();
for (int i = 0; i < inventory.getSlots(); i++) for (int i = 0; i < inventory.getSlots(); i++)
drop(inventory.getStackInSlot(i)); drop(inventory.getStackInSlot(i));

View file

@ -53,6 +53,9 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
private boolean failedLastExport; private boolean failedLastExport;
private FrogportSounds sounds; private FrogportSounds sounds;
private ItemStack deferAnimationStart;
private boolean deferAnimationInward;
private AdvancementBehaviour advancements; private AdvancementBehaviour advancements;
public FrogportBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) { public FrogportBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
@ -118,6 +121,11 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
public void tick() { public void tick() {
super.tick(); super.tick();
if (deferAnimationStart != null) {
startAnimation(deferAnimationStart, deferAnimationInward);
deferAnimationStart = null;
}
if (anticipationProgress.getValue() == 1) if (anticipationProgress.getValue() == 1)
anticipationProgress.updateChaseTarget(0); anticipationProgress.updateChaseTarget(0);
@ -293,7 +301,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
protected void write(CompoundTag tag, boolean clientPacket) { protected void write(CompoundTag tag, boolean clientPacket) {
super.write(tag, clientPacket); super.write(tag, clientPacket);
tag.putFloat("PlacedYaw", passiveYaw); tag.putFloat("PlacedYaw", passiveYaw);
if (animatedPackage != null) { if (animatedPackage != null && isAnimationInProgress()) {
tag.put("AnimatedPackage", animatedPackage.serializeNBT()); tag.put("AnimatedPackage", animatedPackage.serializeNBT());
tag.putBoolean("Deposit", currentlyDepositing); tag.putBoolean("Deposit", currentlyDepositing);
} }
@ -312,8 +320,10 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
failedLastExport = tag.getBoolean("FailedLastExport"); failedLastExport = tag.getBoolean("FailedLastExport");
if (!clientPacket) if (!clientPacket)
animatedPackage = null; animatedPackage = null;
if (tag.contains("AnimatedPackage")) if (tag.contains("AnimatedPackage")) {
startAnimation(ItemStack.of(tag.getCompound("AnimatedPackage")), tag.getBoolean("Deposit")); deferAnimationInward = tag.getBoolean("Deposit");
deferAnimationStart = ItemStack.of(tag.getCompound("AnimatedPackage"));
}
if (clientPacket && tag.contains("Anticipate")) if (clientPacket && tag.contains("Anticipate"))
anticipate(); anticipate();
} }

View file

@ -108,4 +108,9 @@ public class PostboxBlock extends HorizontalDirectionalBlock
.orElse(0); .orElse(0);
} }
@Override
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pMovedByPiston) {
IBE.onRemove(pState, pLevel, pPos, pNewState);
}
} }

View file

@ -97,8 +97,8 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
@Override @Override
public boolean broadcastPackageRequest(RequestType type, PackageOrder order, IItemHandler ignoredHandler, public boolean broadcastPackageRequest(RequestType type, PackageOrder order, IItemHandler ignoredHandler,
String address) { String address, @Nullable PackageOrder orderContext) {
boolean result = super.broadcastPackageRequest(type, order, ignoredHandler, address); boolean result = super.broadcastPackageRequest(type, order, ignoredHandler, address, orderContext);
previouslyUsedAddress = address; previouslyUsedAddress = address;
notifyUpdate(); notifyUpdate();
return result; return result;

View file

@ -13,8 +13,8 @@ import com.simibubi.create.content.schematics.requirement.ItemRequirement;
import com.simibubi.create.foundation.blockEntity.IMergeableBE; import com.simibubi.create.foundation.blockEntity.IMergeableBE;
import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.BlockHelper;
import net.createmod.catnip.math.BBHelper;
import net.createmod.catnip.levelWrappers.SchematicLevel; import net.createmod.catnip.levelWrappers.SchematicLevel;
import net.createmod.catnip.math.BBHelper;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; 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.BoundingBox;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.level.material.Fluids;
public class SchematicPrinter { public class SchematicPrinter {
@ -338,4 +339,15 @@ public class SchematicPrinter {
|| BlockMovementChecks.isBrittle(state); || 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)));
}
} }

View file

@ -566,6 +566,8 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
} }
public void finishedPrinting() { public void finishedPrinting() {
if (replaceMode == ConfigureSchematicannonPacket.Option.REPLACE_EMPTY.ordinal())
printer.sendBlockUpdates(level);
inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setStackInSlot(0, ItemStack.EMPTY);
inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_SCHEMATIC.get(), inventory.getStackInSlot(1) inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_SCHEMATIC.get(), inventory.getStackInSlot(1)
.getCount() + 1)); .getCount() + 1));

View file

@ -47,7 +47,15 @@ public class DestinationSuggestions extends CommandSuggestions {
@Override @Override
public void updateCommandInfo() { 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)) if (value.equals(previous))
return; return;
if (!active) { if (!active) {

View file

@ -72,9 +72,12 @@ public class RuntimeDataGenerator {
ResourceLocation buttonId = base.withSuffix("button"); ResourceLocation buttonId = base.withSuffix("button");
ResourceLocation signId = base.withSuffix("sign"); ResourceLocation signId = base.withSuffix("sign");
if (!noStrippedVariant) if (!noStrippedVariant) {
simpleWoodRecipe(nonStrippedId, itemId); simpleWoodRecipe(nonStrippedId, itemId);
simpleWoodRecipe(itemId, planksId, 6);
} else {
simpleWoodRecipe(TagKey.create(Registries.ITEM, nonStrippedId.withSuffix("s")), planksId, 6); simpleWoodRecipe(TagKey.create(Registries.ITEM, nonStrippedId.withSuffix("s")), planksId, 6);
}
if (!path.contains("_wood") && !path.contains("_hyphae") && BuiltInRegistries.ITEM.containsKey(planksId)) { if (!path.contains("_wood") && !path.contains("_hyphae") && BuiltInRegistries.ITEM.containsKey(planksId)) {
simpleWoodRecipe(planksId, stairsId); simpleWoodRecipe(planksId, stairsId);