Clicks and Dings

- Added sounds for packagers, stock links, requesters and factory gauges
- Added tooltip for factory gauge screen explaining how to add ingredients
This commit is contained in:
simibubi 2025-01-07 12:31:57 +01:00
parent 187c1bc244
commit d05d10e1e0
19 changed files with 254 additions and 36 deletions

View file

@ -1,4 +1,4 @@
// 1.20.1 2025-01-06T22:46:25.6513213 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
// 1.20.1 2025-01-07T12:22:29.7526816 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
60bbdf92d2ac9824ea6144955c74043a6005f79d assets/create/blockstates/acacia_window.json
6a67703c2697d81b7dc83e9d72a66f9c9ff08383 assets/create/blockstates/acacia_window_pane.json
c3ae87b62e81d8e9476eccd793bb1548d74c66a1 assets/create/blockstates/adjustable_chain_gearshift.json
@ -642,8 +642,8 @@ b0d8f08968763a5f74e5cd5644377a76a9f39753 assets/create/blockstates/yellow_toolbo
fe8c497aacc641c2f01cec90bba9f19e59cc2ed2 assets/create/blockstates/yellow_valve_handle.json
e819e93fdcbe9fd9c050a052d2718ff3b3539365 assets/create/blockstates/zinc_block.json
64121dcb216381c83b4fe28aa361ea07c24c9ad0 assets/create/blockstates/zinc_ore.json
908484cff8ec27c3b4cf39ac683b6b7a5528e470 assets/create/lang/en_ud.json
7401dfd627e4b0177b75aff4068be5d249e326f2 assets/create/lang/en_us.json
f33342a6f59c0aadf05c761a24bd33bc927996ad assets/create/lang/en_ud.json
eef9a5ef2d3cb60dee7277624e8ad5bd54521cf6 assets/create/lang/en_us.json
a97e1060e00ae701a02e39cd4ef8054cf345fac4 assets/create/models/block/acacia_window.json
103e032c0b1a0a6a27c67da8c91179a564bd281c assets/create/models/block/acacia_window_pane_noside.json
fb00b627abda76ad4fea867ca57dbfadd24fffa3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -1,2 +1,2 @@
// 1.20.1 2025-01-06T22:46:25.6503343 Create's Custom Sounds
1305ab16efe6b554f5c852de0d52adaf419c4f76 assets/create/sounds.json
// 1.20.1 2025-01-07T12:22:29.7516833 Create's Custom Sounds
56957fbbc59f80d23bf39df63f1925112fbfef7d assets/create/sounds.json

View file

@ -1226,7 +1226,7 @@
"create.gui.factory_panel.reset": "sbuıʇʇǝs ןןɐ ʇǝsǝᴚ",
"create.gui.factory_panel.restocker_address": "˙˙˙oʇ sɯǝʇı puǝS",
"create.gui.factory_panel.restocker_address_given": "oʇ buıpuǝS",
"create.gui.factory_panel.restocker_address_tip": "ןןıʍ ʇɐɥʇ ssǝɹppɐ ɹǝʇuƎ",
"create.gui.factory_panel.restocker_address_tip": "ןןıʍ ʇɐɥʇ ssǝɹppɐ ǝɥʇ ɹǝʇuƎ",
"create.gui.factory_panel.restocker_address_tip_1": "˙ǝɹǝɥ ǝʌıɹɹɐ oʇ sǝbɐʞɔɐd ǝsnɐɔ",
"create.gui.factory_panel.restocker_promises_tip": "ǝsıɯoɹd ɐ 'ʇuǝs ǝɹɐ sɯǝʇı uǝɥM",
"create.gui.factory_panel.restocker_promises_tip_1": "˙ǝʌıɹɹɐ ʎǝɥʇ ןıʇun pןǝɥ sı",
@ -1238,6 +1238,9 @@
"create.gui.factory_panel.sending_item_tip_1": "ʇunoɯɐ ʇǝbɹɐʇ ǝɥʇ ʍoןǝq sı",
"create.gui.factory_panel.title_as_recipe": "sbuıʇʇǝS ǝdıɔǝᴚ",
"create.gui.factory_panel.title_as_restocker": "sbuıʇʇǝS ɹǝʞɔoʇsǝᴚ",
"create.gui.factory_panel.unconfigured_input": "sʇuǝıpǝɹbuı ǝdıɔǝᴚ",
"create.gui.factory_panel.unconfigured_input_tip": "ʎq pǝppɐ ǝq uɐɔ sʇuǝıpǝɹbuI",
"create.gui.factory_panel.unconfigured_input_tip_1": "sǝbnɐb ʎɹoʇɔɐɟ ɹǝɥʇo buıʇɔǝuuoɔ",
"create.gui.filter.allow_list": "ʇsıꞀ-ʍoןןⱯ",
"create.gui.filter.allow_list.description": "˙buıɥʇʎɹǝʌǝ sʇɔǝظǝɹ ʇsıꞀ-ʍoןןⱯ ʎʇdɯǝ uⱯ ˙ǝʌoqɐ ǝɥʇ ɟo ʎuɐ ɥɔʇɐɯ ʎǝɥʇ ɟı ssɐd sɯǝʇI",
"create.gui.filter.deny_list": "ʇsıꞀ-ʎuǝᗡ",
@ -2744,6 +2747,7 @@
"create.subtitle.mechanical_press_activation_belt": "sʞuoq ssǝɹԀ ןɐɔıuɐɥɔǝW",
"create.subtitle.mixing": "sǝsıou buıxıW",
"create.subtitle.package_pop": "sʞɐǝɹq ǝbɐʞɔɐԀ",
"create.subtitle.packager": "sǝbɐʞɔɐd ɹǝbɐʞɔɐԀ",
"create.subtitle.peculiar_bell_use": "sןןoʇ ןןǝᗺ ɹɐıןnɔǝԀ",
"create.subtitle.potato_hit": "sʇɔɐdɯı ǝןqɐʇǝbǝΛ",
"create.subtitle.sanding_long": "sǝsıou buıpuɐS",
@ -2756,6 +2760,7 @@
"create.subtitle.slime_added": "sǝɥsınbs ǝɯıןS",
"create.subtitle.spout": "sʇɹnds ʇnodS",
"create.subtitle.steam": "sǝsıou ɯɐǝʇS",
"create.subtitle.stock_link": "sʇɔɐǝɹ ʞuıן ʞɔoʇS",
"create.subtitle.stock_ticker_request": "sʇsǝnbǝɹ ɹǝʞɔıʇ ʞɔoʇS",
"create.subtitle.stock_ticker_trade": ",¡buıɥɔ-ɐʞ, sǝob ɹǝʞɔıʇ ʞɔoʇS",
"create.subtitle.train": ןqɯnɹ sןǝǝɥʍ ʎǝboᗺ",

View file

@ -1226,7 +1226,7 @@
"create.gui.factory_panel.reset": "Reset all settings",
"create.gui.factory_panel.restocker_address": "Send items to...",
"create.gui.factory_panel.restocker_address_given": "Sending to",
"create.gui.factory_panel.restocker_address_tip": "Enter an address that will",
"create.gui.factory_panel.restocker_address_tip": "Enter the address that will",
"create.gui.factory_panel.restocker_address_tip_1": "cause packages to arrive here.",
"create.gui.factory_panel.restocker_promises_tip": "When items are sent, a promise",
"create.gui.factory_panel.restocker_promises_tip_1": "is held until they arrive.",
@ -1238,6 +1238,9 @@
"create.gui.factory_panel.sending_item_tip_1": "is below the target amount",
"create.gui.factory_panel.title_as_recipe": "Recipe Settings",
"create.gui.factory_panel.title_as_restocker": "Restocker Settings",
"create.gui.factory_panel.unconfigured_input": "Recipe ingredients",
"create.gui.factory_panel.unconfigured_input_tip": "Ingredients can be added by",
"create.gui.factory_panel.unconfigured_input_tip_1": "connecting other factory gauges",
"create.gui.filter.allow_list": "Allow-List",
"create.gui.filter.allow_list.description": "Items pass if they match any of the above. An empty Allow-List rejects everything.",
"create.gui.filter.deny_list": "Deny-List",
@ -2744,6 +2747,7 @@
"create.subtitle.mechanical_press_activation_belt": "Mechanical Press bonks",
"create.subtitle.mixing": "Mixing noises",
"create.subtitle.package_pop": "Package breaks",
"create.subtitle.packager": "Packager packages",
"create.subtitle.peculiar_bell_use": "Peculiar Bell tolls",
"create.subtitle.potato_hit": "Vegetable impacts",
"create.subtitle.sanding_long": "Sanding noises",
@ -2756,6 +2760,7 @@
"create.subtitle.slime_added": "Slime squishes",
"create.subtitle.spout": "Spout spurts",
"create.subtitle.steam": "Steam noises",
"create.subtitle.stock_link": "Stock link reacts",
"create.subtitle.stock_ticker_request": "Stock ticker requests",
"create.subtitle.stock_ticker_trade": "Stock ticker goes 'ka-ching!'",
"create.subtitle.train": "Bogey wheels rumble",

View file

@ -414,7 +414,7 @@
"sounds": [
{
"type": "event",
"name": "minecraft:entity.armor_stand.break"
"name": "minecraft:block.chiseled_bookshelf.break"
}
],
"subtitle": "create.subtitle.package_pop"
@ -427,6 +427,15 @@
}
]
},
"packager": {
"sounds": [
{
"type": "event",
"name": "minecraft:entity.shulker.open"
}
],
"subtitle": "create.subtitle.packager"
},
"peculiar_bell_use": {
"sounds": [
{
@ -560,6 +569,15 @@
],
"subtitle": "create.subtitle.steam"
},
"stock_link": {
"sounds": [
{
"type": "file",
"name": "create:stock_link"
}
],
"subtitle": "create.subtitle.stock_link"
},
"stock_ticker_request": {
"sounds": [
{

View file

@ -68,7 +68,9 @@ import com.simibubi.create.content.logistics.filter.FilterScreenPacket;
import com.simibubi.create.content.logistics.funnel.FunnelFlapPacket;
import com.simibubi.create.content.logistics.packagePort.PackagePortConfigurationPacket;
import com.simibubi.create.content.logistics.packagePort.PackagePortPlacementPacket;
import com.simibubi.create.content.logistics.packagerLink.PackagerLinkEffectPacket;
import com.simibubi.create.content.logistics.redstoneRequester.RedstoneRequesterConfigurationPacket;
import com.simibubi.create.content.logistics.redstoneRequester.RedstoneRequesterEffectPacket;
import com.simibubi.create.content.logistics.stockTicker.LogisticalStockRequestPacket;
import com.simibubi.create.content.logistics.stockTicker.LogisticalStockResponsePacket;
import com.simibubi.create.content.logistics.stockTicker.PackageOrderRequestPacket;
@ -251,6 +253,8 @@ public enum AllPackets {
PACKAGE_DESTROYED(PackageDestroyPacket.class, PackageDestroyPacket::new, PLAY_TO_CLIENT),
LOGISTICS_STOCK_RESPONSE(LogisticalStockResponsePacket.class, LogisticalStockResponsePacket::new, PLAY_TO_CLIENT),
FACTORY_PANEL_EFFECT(FactoryPanelEffectPacket.class, FactoryPanelEffectPacket::new, PLAY_TO_CLIENT),
PACKAGER_LINK_EFFECT(PackagerLinkEffectPacket.class, PackagerLinkEffectPacket::new, PLAY_TO_CLIENT),
REDSTONE_REQUESTER_EFFECT(RedstoneRequesterEffectPacket.class, RedstoneRequesterEffectPacket::new, PLAY_TO_CLIENT),
KNOCKBACK(KnockbackPacket.class, KnockbackPacket::new, PLAY_TO_CLIENT),
TRAIN_MAP_SYNC(TrainMapSyncPacket.class, TrainMapSyncPacket::new, PLAY_TO_CLIENT),
CLIENTBOUND_CHAIN_CONVEYOR(ClientboundChainConveyorRidingPacket.class, ClientboundChainConveyorRidingPacket::new, PLAY_TO_CLIENT);

View file

@ -64,6 +64,11 @@ public class AllSoundEvents {
.category(SoundSource.BLOCKS)
.build(),
PACKAGER = create("packager").subtitle("Packager packages")
.playExisting(SoundEvents.SHULKER_OPEN, 0.125f, 0.75f)
.category(SoundSource.BLOCKS)
.build(),
SLIME_ADDED = create("slime_added").subtitle("Slime squishes")
.playExisting(SoundEvents.SLIME_BLOCK_PLACE)
.category(SoundSource.BLOCKS)
@ -162,6 +167,10 @@ public class AllSoundEvents {
.category(SoundSource.BLOCKS)
.build(),
STOCK_LINK = create("stock_link").subtitle("Stock link reacts")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_DEPOSIT = create("frogport_deposit").subtitle("Frogport places package")
.playExisting(SoundEvents.FROG_TONGUE, 1f, 1f)
.category(SoundSource.BLOCKS)
@ -196,8 +205,8 @@ public class AllSoundEvents {
.build(),
PACKAGE_POP = create("package_pop").subtitle("Package breaks")
.playExisting(SoundEvents.ARMOR_STAND_BREAK, .25f, .75f)
.playExisting(SoundEvents.WOOL_BREAK, .5f, 1.15f)
.playExisting(SoundEvents.CHISELED_BOOKSHELF_BREAK, .75f, 1f)
.playExisting(SoundEvents.WOOL_BREAK, .25f, 1.15f)
.category(SoundSource.BLOCKS)
.build(),

View file

@ -454,7 +454,7 @@ public class PackageEntity extends LivingEntity implements IEntityAdditionalSpaw
@Nullable
protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
return SoundEvents.CHISELED_BOOKSHELF_BREAK;
return null;
}
@Nullable

View file

@ -5,6 +5,7 @@ import java.util.List;
import javax.annotation.Nullable;
import com.simibubi.create.AllEntityTypes;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.Create;
import com.simibubi.create.content.logistics.box.PackageStyles.PackageStyle;
import com.simibubi.create.content.logistics.stockTicker.PackageOrder;
@ -285,8 +286,7 @@ public class PackageItem extends Item {
}
Vec3 position = playerIn.position();
worldIn.playSound((Player) null, position.x, position.y, position.z, SoundEvents.CHISELED_BOOKSHELF_BREAK,
SoundSource.PLAYERS, 0.5F, 1.0F);
AllSoundEvents.PACKAGE_POP.playOnServer(worldIn, playerIn.blockPosition());
if (worldIn.isClientSide()) {
for (int i = 0; i < 10; i++) {

View file

@ -19,6 +19,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllPackets;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.AllTags.AllItemTags;
import com.simibubi.create.Create;
import com.simibubi.create.content.logistics.BigItemStack;
@ -93,6 +94,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
private boolean promisePrimedForMarkDirty;
private boolean active;
private boolean queueDing;
private int lastReportedUnloadedLinks;
private int lastReportedLevelInStorage;
private int lastReportedPromises;
@ -247,6 +249,11 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
&& promisedSatisfied == shouldPromiseSatisfy && waitingForNetwork == shouldWait)
return;
if (!satisfied && shouldSatisfy) {
AllSoundEvents.CONFIRM.playOnServer(getWorld(), getPos(), 0.075f, 1f);
AllSoundEvents.CONFIRM_2.playOnServer(getWorld(), getPos(), 0.125f, 0.575f);
}
boolean notifyOutputs = satisfied != shouldSatisfy;
lastReportedLevelInStorage = inStorage;
satisfied = shouldSatisfy;
@ -659,6 +666,8 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
return;
}
boolean previouslySatisfied = satisfied;
active = true;
filter = FilterItemStack.of(panelTag.getCompound("Filter"));
count = panelTag.getInt("FilterAmount");

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.factoryBoard;
import javax.annotation.Nullable;
import com.simibubi.create.AllPackets;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.logistics.factoryBoard.FactoryPanelBlock.PanelSlot;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
@ -16,6 +17,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.LevelAccessor;
@ -51,6 +54,7 @@ public class FactoryPanelConnectionHandler {
.component(), true);
connectingFrom = null;
connectingFromBox = null;
AllSoundEvents.DENY.playAt(player.level(), player.blockPosition(), 1, 1, false);
return true;
}
@ -69,6 +73,10 @@ public class FactoryPanelConnectionHandler {
connectingFrom = null;
connectingFromBox = null;
player.level()
.playLocalSound(player.blockPosition(), SoundEvents.AMETHYST_BLOCK_PLACE, SoundSource.BLOCKS, 0.5f, 0.5f,
false);
return true;
}
@ -180,6 +188,7 @@ public class FactoryPanelConnectionHandler {
.component(), true);
connectingFrom = null;
connectingFromBox = null;
AllSoundEvents.DENY.playAt(mc.level, mc.player.blockPosition(), 1, 1, false);
return true;
}
@ -209,6 +218,9 @@ public class FactoryPanelConnectionHandler {
connectingFrom = null;
connectingFromBox = null;
mc.player.level()
.playLocalSound(mc.player.blockPosition(), SoundEvents.AMETHYST_BLOCK_PLACE, SoundSource.BLOCKS,
0.5f, 0.5f, false);
return true;
}

View file

@ -35,9 +35,11 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -237,9 +239,26 @@ public class FactoryPanelScreen extends AbstractSimiScreen {
if (craftingActive) {
for (BigItemStack itemStack : craftingIngredients)
renderInputItem(graphics, slot++, itemStack, mouseX, mouseY);
} else
} else {
for (BigItemStack itemStack : inputConfig)
renderInputItem(graphics, slot++, itemStack, mouseX, mouseY);
if (inputConfig.isEmpty()) {
int inputX = guiLeft + (restocker ? 88 : 68 + (slot % 3 * 20));
int inputY = guiTop + (restocker ? 12 : 28) + (slot / 3 * 20);
if (!restocker && mouseY > inputY && mouseY < inputY + 60 && mouseX > inputX && mouseX < inputX + 60)
graphics.renderComponentTooltip(font,
List.of(CreateLang.translate("gui.factory_panel.unconfigured_input")
.color(ScrollInput.HEADER_RGB)
.component(),
CreateLang.translate("gui.factory_panel.unconfigured_input_tip")
.style(ChatFormatting.GRAY)
.component(),
CreateLang.translate("gui.factory_panel.unconfigured_input_tip_1")
.style(ChatFormatting.GRAY)
.component()),
mouseX, mouseY);
}
}
if (restocker)
renderInputItem(graphics, slot, new BigItemStack(behaviour.getFilter(), 1), mouseX, mouseY);
@ -517,6 +536,7 @@ public class FactoryPanelScreen extends AbstractSimiScreen {
int inputY = y + 28 + (i / 3 * 20);
if (mouseX >= inputX && mouseX < inputX + 16 && mouseY >= inputY && mouseY < inputY + 16) {
sendIt(connections.get(i).from, false);
playButtonSound();
return true;
}
}
@ -526,6 +546,7 @@ public class FactoryPanelScreen extends AbstractSimiScreen {
int itemY = y + windowHeight - 24;
if (mouseX >= itemX && mouseX < itemX + 16 && mouseY >= itemY && mouseY < itemY + 16) {
sendIt(null, true);
playButtonSound();
return true;
}
@ -535,12 +556,19 @@ public class FactoryPanelScreen extends AbstractSimiScreen {
if (mouseX >= itemX && mouseX < itemX + 16 && mouseY >= itemY && mouseY < itemY + 16) {
sendRedstoneReset = true;
sendIt(null, false);
playButtonSound();
return true;
}
return super.mouseClicked(mouseX, mouseY, pButton);
}
public void playButtonSound() {
Minecraft.getInstance()
.getSoundManager()
.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.get(), 1.0f, 0.25f));
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double pDelta) {
int x = guiLeft;

View file

@ -9,6 +9,7 @@ import java.util.UUID;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.actors.psi.PortableStorageInterfaceBlockEntity;
import com.simibubi.create.content.kinetics.crafter.MechanicalCrafterBlockEntity;
@ -39,6 +40,8 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.Containers;
import net.minecraft.world.item.ItemStack;
@ -130,6 +133,14 @@ public class PackagerBlockEntity extends SmartBlockEntity {
return;
}
if (level.isClientSide) {
if (animationTicks == CYCLE - (animationInward ? 5 : 1))
AllSoundEvents.PACKAGER.playAt(level, worldPosition, 1, 1, true);
if (animationTicks == (animationInward ? 1 : 5))
level.playLocalSound(worldPosition, SoundEvents.IRON_TRAPDOOR_CLOSE, SoundSource.BLOCKS, 0.075f, 0.75f,
true);
}
animationTicks--;
if (animationTicks == 0 && !level.isClientSide()) {

View file

@ -7,23 +7,28 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.mutable.MutableBoolean;
import com.simibubi.create.AllPackets;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.logistics.packager.InventorySummary;
import com.simibubi.create.content.logistics.packager.PackagerBlockEntity;
import com.simibubi.create.content.logistics.packager.PackagingRequest;
import com.simibubi.create.content.logistics.packager.repackager.RepackagerBlockEntity;
import com.simibubi.create.content.logistics.stockTicker.PackageOrder;
import com.simibubi.create.content.redstone.displayLink.LinkWithBulbBlockEntity;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import net.createmod.catnip.utility.Pair;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.VibrationParticleOption;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.BlockPositionSource;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.items.IItemHandler;
public class PackagerLinkBlockEntity extends LinkWithBulbBlockEntity {
public class PackagerLinkBlockEntity extends SmartBlockEntity {
public LogisticallyLinkedBehaviour behaviour;
public UUID placedBy;
@ -40,12 +45,16 @@ public class PackagerLinkBlockEntity extends LinkWithBulbBlockEntity {
return InventorySummary.EMPTY;
if (packager.isTargetingSameInventory(ignoredHandler))
return InventorySummary.EMPTY;
sendPulseNextSync();
sendData();
return packager.getAvailableItems();
}
public void playEffect() {
AllSoundEvents.STOCK_LINK.playAt(level, worldPosition, 1.0f, 1.0f, false);
Vec3 vec3 = Vec3.atCenterOf(worldPosition);
level.addParticle(new VibrationParticleOption(new BlockPositionSource(worldPosition.above(3)), 6), vec3.x,
vec3.y, vec3.z, 1, 1, 1);
}
public Pair<PackagerBlockEntity, PackagingRequest> processRequest(ItemStack stack, int amount, String address,
int linkIndex, MutableBoolean finalLink, int orderId, @Nullable PackageOrder orderContext,
@Nullable IItemHandler ignoredHandler) {
@ -59,11 +68,9 @@ public class PackagerLinkBlockEntity extends LinkWithBulbBlockEntity {
int availableCount = summary.getCountOf(stack);
if (availableCount == 0)
return null;
sendPulseNextSync();
sendData();
int toWithdraw = Math.min(amount, availableCount);
if (toWithdraw != 0)
AllPackets.sendToNear(level, worldPosition, 32, new PackagerLinkEffectPacket(worldPosition));
return Pair.of(packager,
PackagingRequest.create(stack, toWithdraw, address, linkIndex, finalLink, 0, orderId, orderContext));
}

View file

@ -0,0 +1,39 @@
package com.simibubi.create.content.logistics.packagerLink;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkEvent.Context;
public class PackagerLinkEffectPacket extends SimplePacketBase {
private BlockPos pos;
public PackagerLinkEffectPacket(BlockPos pos) {
this.pos = pos;
}
public PackagerLinkEffectPacket(FriendlyByteBuf buffer) {
pos = buffer.readBlockPos();
}
@Override
public void write(FriendlyByteBuf buffer) {
buffer.writeBlockPos(pos);
}
@Override
@OnlyIn(Dist.CLIENT)
public boolean handle(Context context) {
context.enqueueWork(() -> {
if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof PackagerLinkBlockEntity plbe)
plbe.playEffect();
});
return true;
}
}

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.logistics.redstoneRequester;
import com.simibubi.create.AllPackets;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.logistics.BigItemStack;
import com.simibubi.create.content.logistics.packager.InventorySummary;
import com.simibubi.create.content.logistics.packagerLink.LogisticallyLinkedBehaviour.RequestType;
@ -8,6 +10,7 @@ import com.simibubi.create.content.logistics.stockTicker.StockCheckingBlockEntit
import net.createmod.catnip.utility.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
@ -18,6 +21,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.network.NetworkHooks;
@ -53,18 +57,27 @@ public class RedstoneRequesterBlockEntity extends StockCheckingBlockEntity imple
if (encodedRequest.isEmpty())
return;
if (!allowPartialRequests) {
boolean anySucceeded = false;
InventorySummary summaryOfOrder = new InventorySummary();
encodedRequest.stacks()
.forEach(summaryOfOrder::add);
InventorySummary summary = getAccurateSummary();
for (BigItemStack entry : summaryOfOrder.getStacks())
if (summary.getCountOf(entry.stack) < entry.count)
for (BigItemStack entry : summaryOfOrder.getStacks()) {
if (summary.getCountOf(entry.stack) >= entry.count) {
anySucceeded = true;
continue;
}
if (!allowPartialRequests) {
AllPackets.sendToNear(level, worldPosition, 32,
new RedstoneRequesterEffectPacket(worldPosition, false));
return;
}
}
broadcastPackageRequest(RequestType.REDSTONE, encodedRequest, null, encodedTargetAdress);
AllPackets.sendToNear(level, worldPosition, 32, new RedstoneRequesterEffectPacket(worldPosition, anySucceeded));
lastRequestSucceeded = true;
}
@ -120,4 +133,16 @@ public class RedstoneRequesterBlockEntity extends StockCheckingBlockEntity imple
return RedstoneRequesterMenu.create(pContainerId, pPlayerInventory, this);
}
public void playEffect(boolean success) {
AllSoundEvents.STOCK_LINK.playAt(level, worldPosition, 1.0f, 1.0f, false);
Vec3 vec3 = Vec3.atCenterOf(worldPosition);
if (success) {
AllSoundEvents.CONFIRM.playAt(level, worldPosition, 0.5f, 1.5f, false);
level.addParticle(ParticleTypes.NOTE, vec3.x, vec3.y + 1, vec3.z, 0, 0, 0);
} else {
AllSoundEvents.DENY.playAt(level, worldPosition, 0.5f, 1, false);
level.addParticle(ParticleTypes.ENCHANTED_HIT, vec3.x, vec3.y + 1, vec3.z, 0, 0, 0);
}
}
}

View file

@ -0,0 +1,43 @@
package com.simibubi.create.content.logistics.redstoneRequester;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkEvent.Context;
public class RedstoneRequesterEffectPacket extends SimplePacketBase {
private BlockPos pos;
private boolean success;
public RedstoneRequesterEffectPacket(BlockPos pos, boolean success) {
this.pos = pos;
this.success = success;
}
public RedstoneRequesterEffectPacket(FriendlyByteBuf buffer) {
pos = buffer.readBlockPos();
success = buffer.readBoolean();
}
@Override
public void write(FriendlyByteBuf buffer) {
buffer.writeBlockPos(pos);
buffer.writeBoolean(success);
}
@Override
@OnlyIn(Dist.CLIENT)
public boolean handle(Context context) {
context.enqueueWork(() -> {
if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof RedstoneRequesterBlockEntity plbe)
plbe.playEffect(success);
});
return true;
}
}

View file

@ -1070,12 +1070,15 @@
"create.gui.factory_panel.recipe_address_tip_1": "this recipe is crafted.",
"create.gui.factory_panel.restocker_address": "Send items to...",
"create.gui.factory_panel.restocker_address_given": "Sending to",
"create.gui.factory_panel.restocker_address_tip": "Enter an address that will",
"create.gui.factory_panel.restocker_address_tip": "Enter the address that will",
"create.gui.factory_panel.restocker_address_tip_1": "cause packages to arrive here.",
"create.gui.factory_panel.activate_crafting": "Use Mechanical Crafting",
"create.gui.factory_panel.crafting_input": "Packaged Ingredients",
"create.gui.factory_panel.crafting_input_tip": "Unpackage into connected",
"create.gui.factory_panel.crafting_input_tip_1": "mechanical crafters (3x3)",
"create.gui.factory_panel.unconfigured_input": "Recipe ingredients",
"create.gui.factory_panel.unconfigured_input_tip": "Ingredients can be added by",
"create.gui.factory_panel.unconfigured_input_tip_1": "connecting other factory gauges",
"create.gui.factory_panel.inactive": " Inactive ",
"create.gui.factory_panel.address_missing": "Inactive: missing a target address",
"create.gui.factory_panel.no_target_amount_set": "Inactive: no target amount set",

Binary file not shown.