What does the frog say

- Sound additions and changes for frogports, stock tickers and table cloths
- Fixed trade overlay sprite boundaries
This commit is contained in:
simibubi 2025-01-05 12:43:13 +01:00
parent 3a9f7d591c
commit a647f11a6f
30 changed files with 324 additions and 64 deletions

View file

@ -1,4 +1,4 @@
// 1.20.1 2024-12-28T14:25:56.9899499 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-05T12:20:44.8131117 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
6a5bfb3525f178e198ef8fd4c0cb1a941c021ff5 assets/create/lang/en_ud.json
d3402f8a5a75f8c1f7ea6d2dfa56218d5f55d112 assets/create/lang/en_us.json
908484cff8ec27c3b4cf39ac683b6b7a5528e470 assets/create/lang/en_ud.json
7401dfd627e4b0177b75aff4068be5d249e326f2 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 2024-10-29T20:48:43.0728938 Create's Custom Sounds
95f92936f1028973cacb7aade6eb6acf582aaa8f assets/create/sounds.json
// 1.20.1 2025-01-05T12:20:44.8111168 Create's Custom Sounds
b55aef763ad0b3df0d27e53c2a4c656c942cfa7a assets/create/sounds.json

View file

@ -2699,7 +2699,7 @@
"create.station.train_not_aligned_1": "pǝubıןɐ sǝbɐıɹɹɐɔ ןןɐ ʇou",
"create.stock_keeper.cash_register_full": "ɹǝʇsıbǝᴚ ɥsɐƆ uı ǝɔɐds ɥbnouǝ ʇoN :pǝןןǝɔuɐɔ ǝsɐɥɔɹnԀ",
"create.stock_keeper.keeper_missing": "buıssıɯ ɹǝdǝǝʞ ʞɔoʇS",
"create.stock_keeper.limited_stock": "ǝןןıɐʌɐ ʞɔoʇs pǝʇıɯı",
"create.stock_keeper.limited_stock": "pǝɥɔɐǝɹ ʇıɯıן ʞɔoʇS",
"create.stock_keeper.locked": "pǝʞɔoן uǝǝq sɐɥ ssǝɔɔɐ ʇɔǝɹıp 'ʇsıן buıddoɥS ɐ buısn ʇɔɐɹǝʇuI",
"create.stock_keeper.no_price_set": "ʇsɹıɟ ǝɔıɹd ɐ ʇǝs ʇsnɯ ɹǝuʍo doɥS",
"create.stock_keeper.out_of_stock": "ʞɔoʇS ɟo ʇnO",
@ -2713,6 +2713,7 @@
"create.subtitle.cardboard_bonk": "ʞuoq ʇuɐuosǝᴚ",
"create.subtitle.cogs": ןqɯnɹ sןǝǝɥʍboƆ",
"create.subtitle.confirm": "buıp ǝʌıʇɐɯɹıɟɟⱯ",
"create.subtitle.confirm_2": "buıp ǝʌıʇɐɯɹıɟɟⱯ",
"create.subtitle.contraption_assemble": "sǝʌoɯ uoıʇdɐɹʇuoƆ",
"create.subtitle.contraption_disassemble": "sdoʇs uoıʇdɐɹʇuoƆ",
"create.subtitle.controller_click": "sʞɔıןɔ ɹǝןןoɹʇuoƆ",
@ -2727,6 +2728,13 @@
"create.subtitle.depot_plop": "spuɐן ɯǝʇI",
"create.subtitle.depot_slide": "sǝpıןs ɯǝʇI",
"create.subtitle.desk_bell": "sbuıp ןןǝq uoıʇdǝɔǝᴚ",
"create.subtitle.frogport_catch_1": "ǝbɐʞɔɐd sǝɥɔʇɐɔ ʇɹodboɹℲ",
"create.subtitle.frogport_catch_2": "ǝbɐʞɔɐd sǝɥɔʇɐɔ ʇɹodboɹℲ",
"create.subtitle.frogport_catch_3": "ǝbɐʞɔɐd sǝɥɔʇɐɔ ʇɹodboɹℲ",
"create.subtitle.frogport_catch_4": "ǝbɐʞɔɐd sǝɥɔʇɐɔ ʇɹodboɹℲ",
"create.subtitle.frogport_close": "sʇnɥs ʇɹodboɹℲ",
"create.subtitle.frogport_deposit": "ǝbɐʞɔɐd sǝɔɐןd ʇɹodboɹℲ",
"create.subtitle.frogport_open": "suǝdo ʇɹodboɹℲ",
"create.subtitle.funnel_flap": "sdɐןɟ ןǝuunℲ",
"create.subtitle.fwoomp": "dɯooʍɟ ʇuɐuosǝᴚ",
"create.subtitle.haunted_bell_convert": "suǝʞɐʍɐ ןןǝᗺ pǝʇunɐH",
@ -2748,6 +2756,8 @@
"create.subtitle.slime_added": "sǝɥsınbs ǝɯıןS",
"create.subtitle.spout": "sʇɹnds ʇnodS",
"create.subtitle.steam": "sǝsıou ɯɐǝʇ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ᗺ",
"create.subtitle.train3": "pǝןɟɟnɯ ǝןqɯnɹ sןǝǝɥʍ ʎǝboᗺ",
"create.subtitle.whistle": "buıןʇsıɥM",

View file

@ -2699,7 +2699,7 @@
"create.station.train_not_aligned_1": "not all carriages aligned",
"create.stock_keeper.cash_register_full": "Purchase cancelled: Not enough space in Cash Register",
"create.stock_keeper.keeper_missing": "Stock keeper missing",
"create.stock_keeper.limited_stock": "Limited stock available",
"create.stock_keeper.limited_stock": "Stock limit reached",
"create.stock_keeper.locked": "Interact using a Shopping list, direct access has been locked",
"create.stock_keeper.no_price_set": "Shop owner must set a price first",
"create.stock_keeper.out_of_stock": "Out of Stock",
@ -2713,6 +2713,7 @@
"create.subtitle.cardboard_bonk": "Resonant bonk",
"create.subtitle.cogs": "Cogwheels rumble",
"create.subtitle.confirm": "Affirmative ding",
"create.subtitle.confirm_2": "Affirmative ding",
"create.subtitle.contraption_assemble": "Contraption moves",
"create.subtitle.contraption_disassemble": "Contraption stops",
"create.subtitle.controller_click": "Controller clicks",
@ -2727,6 +2728,13 @@
"create.subtitle.depot_plop": "Item lands",
"create.subtitle.depot_slide": "Item slides",
"create.subtitle.desk_bell": "Reception bell dings",
"create.subtitle.frogport_catch_1": "Frogport catches package",
"create.subtitle.frogport_catch_2": "Frogport catches package",
"create.subtitle.frogport_catch_3": "Frogport catches package",
"create.subtitle.frogport_catch_4": "Frogport catches package",
"create.subtitle.frogport_close": "Frogport shuts",
"create.subtitle.frogport_deposit": "Frogport places package",
"create.subtitle.frogport_open": "Frogport opens",
"create.subtitle.funnel_flap": "Funnel flaps",
"create.subtitle.fwoomp": "Resonant fwoomp",
"create.subtitle.haunted_bell_convert": "Haunted Bell awakens",
@ -2748,6 +2756,8 @@
"create.subtitle.slime_added": "Slime squishes",
"create.subtitle.spout": "Spout spurts",
"create.subtitle.steam": "Steam noises",
"create.subtitle.stock_ticker_request": "Stock ticker requests",
"create.subtitle.stock_ticker_trade": "Stock ticker goes 'ka-ching!'",
"create.subtitle.train": "Bogey wheels rumble",
"create.subtitle.train3": "Bogey wheels rumble muffled",
"create.subtitle.whistle": "Whistling",

View file

@ -59,6 +59,15 @@
],
"subtitle": "create.subtitle.confirm"
},
"confirm_2": {
"sounds": [
{
"type": "file",
"name": "create:confirm_2"
}
],
"subtitle": "create.subtitle.confirm_2"
},
"contraption_assemble": {
"sounds": [
{
@ -226,6 +235,69 @@
],
"subtitle": "create.subtitle.desk_bell"
},
"frogport_catch_1": {
"sounds": [
{
"type": "file",
"name": "create:frogport_catch_1"
}
],
"subtitle": "create.subtitle.frogport_catch_1"
},
"frogport_catch_2": {
"sounds": [
{
"type": "file",
"name": "create:frogport_catch_2"
}
],
"subtitle": "create.subtitle.frogport_catch_2"
},
"frogport_catch_3": {
"sounds": [
{
"type": "file",
"name": "create:frogport_catch_3"
}
],
"subtitle": "create.subtitle.frogport_catch_3"
},
"frogport_catch_4": {
"sounds": [
{
"type": "file",
"name": "create:frogport_catch_4"
}
],
"subtitle": "create.subtitle.frogport_catch_4"
},
"frogport_close": {
"sounds": [
{
"type": "file",
"name": "create:frogport_close"
}
],
"subtitle": "create.subtitle.frogport_close"
},
"frogport_deposit": {
"sounds": [
{
"type": "event",
"name": "minecraft:entity.frog.tongue"
}
],
"subtitle": "create.subtitle.frogport_deposit"
},
"frogport_open": {
"sounds": [
{
"type": "file",
"name": "create:frogport_open"
}
],
"subtitle": "create.subtitle.frogport_open"
},
"funnel_flap": {
"sounds": [
{
@ -488,6 +560,24 @@
],
"subtitle": "create.subtitle.steam"
},
"stock_ticker_request": {
"sounds": [
{
"type": "file",
"name": "create:stock_ticker_request"
}
],
"subtitle": "create.subtitle.stock_ticker_request"
},
"stock_ticker_trade": {
"sounds": [
{
"type": "file",
"name": "create:stock_ticker_trade"
}
],
"subtitle": "create.subtitle.stock_ticker_trade"
},
"train": {
"sounds": [
{

View file

@ -116,6 +116,10 @@ public class AllSoundEvents {
.category(SoundSource.PLAYERS)
.build(),
CONFIRM_2 = create("confirm_2").subtitle("Affirmative ding")
.category(SoundSource.PLAYERS)
.build(),
DENY = create("deny").subtitle("Declining boop")
.playExisting(SoundEvents.NOTE_BLOCK_BASS, 1f, 0.5f)
.category(SoundSource.PLAYERS)
@ -133,6 +137,35 @@ public class AllSoundEvents {
.category(SoundSource.PLAYERS)
.build(),
FROGPORT_OPEN = create("frogport_open").subtitle("Frogport opens")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_CLOSE = create("frogport_close").subtitle("Frogport shuts")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_CATCH_1 = create("frogport_catch_1").subtitle("Frogport catches package")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_CATCH_2 = create("frogport_catch_2").subtitle("Frogport catches package")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_CATCH_3 = create("frogport_catch_3").subtitle("Frogport catches package")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_CATCH_4 = create("frogport_catch_4").subtitle("Frogport catches package")
.category(SoundSource.BLOCKS)
.build(),
FROGPORT_DEPOSIT = create("frogport_deposit").subtitle("Frogport places package")
.playExisting(SoundEvents.FROG_TONGUE, 1f, 1f)
.category(SoundSource.BLOCKS)
.build(),
POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts")
.playExisting(SoundEvents.ITEM_FRAME_BREAK, .75f, .75f)
.playExisting(SoundEvents.WEEPING_VINES_BREAK, .75f, 1.25f)
@ -326,7 +359,15 @@ public class AllSoundEvents {
HAUNTED_BELL_USE = create("haunted_bell_use").subtitle("Haunted Bell tolls")
.category(SoundSource.BLOCKS)
.build(),
.build(),
STOCK_TICKER_REQUEST = create("stock_ticker_request").subtitle("Stock ticker requests")
.category(SoundSource.BLOCKS)
.build(),
STOCK_TICKER_TRADE = create("stock_ticker_trade").subtitle("Stock ticker goes 'ka-ching!'")
.category(SoundSource.BLOCKS)
.build(),
CLIPBOARD_CHECKMARK = create("clipboard_check").noSubtitle()
.category(SoundSource.BLOCKS)
@ -367,8 +408,9 @@ public class AllSoundEvents {
}
public static void playItemPickup(Player player) {
player.level().playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f,
1f + Create.RANDOM.nextFloat());
player.level()
.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f,
1f + player.level().random.nextFloat());
}
// @SubscribeEvent

View file

@ -6,7 +6,6 @@ import org.joml.Quaternionf;
import org.joml.Quaternionfc;
import com.mojang.math.Axis;
import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.ShaftVisual;
import com.simibubi.create.content.processing.burner.ScrollInstance;

View file

@ -349,7 +349,7 @@ public class BlueprintOverlayRenderer {
TooltipRenderUtil.renderTooltipBackground(graphics, x - 2, y + 1, w + 4, 19, 0, 0x55_000000, 0x55_000000, 0,
0);
AllGuiTextures.TRADE_OVERLAY.render(graphics, width / 2 - 49, y - 19);
AllGuiTextures.TRADE_OVERLAY.render(graphics, width / 2 - 48, y - 19);
if (shopContext.purchases() > 0) {
graphics.renderItem(AllItems.SHOPPING_LIST.asStack(), width / 2 + 20, y - 20);
graphics.drawString(mc.font, Components.literal("x" + shopContext.purchases()), width / 2 + 20 + 16,

View file

@ -145,11 +145,17 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
return InteractionResult.PASS;
if (player instanceof FakePlayer)
return InteractionResult.PASS;
if (level.isClientSide)
return InteractionResult.SUCCESS;
ItemStack mainHandItem = player.getMainHandItem();
if (AllBlocks.CLIPBOARD.isIn(mainHandItem)) {
boolean clipboard = AllBlocks.CLIPBOARD.isIn(mainHandItem);
if (level.isClientSide) {
if (!clipboard)
onOpenedManually();
return InteractionResult.SUCCESS;
}
if (clipboard) {
addAddressToClipboard(player, mainHandItem);
return InteractionResult.SUCCESS;
}
@ -158,6 +164,8 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
return InteractionResult.SUCCESS;
}
protected void onOpenedManually() {};
private void addAddressToClipboard(Player player, ItemStack mainHandItem) {
if (addressFilter == null || addressFilter.isBlank())
return;

View file

@ -45,9 +45,11 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
public float passiveYaw;
private boolean failedLastExport;
private FrogportSounds sounds;
public FrogportBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
sounds = new FrogportSounds();
animationProgress = LerpedFloat.linear();
anticipationProgress = LerpedFloat.linear();
manualOpenAnimationProgress = LerpedFloat.linear()
@ -106,10 +108,14 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
anticipationProgress.updateChaseTarget(0);
manualOpenAnimationProgress.updateChaseTarget(openTracker.openCount > 0 ? 1 : 0);
boolean wasOpen = manualOpenAnimationProgress.getValue() > 0;
anticipationProgress.tickChaser();
manualOpenAnimationProgress.tickChaser();
if (level.isClientSide() && wasOpen && manualOpenAnimationProgress.getValue() == 0)
sounds.close(level, worldPosition);
if (!isAnimationInProgress())
return;
@ -135,6 +141,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
anticipationProgress.startWithValue(0);
animationProgress.startWithValue(0);
if (level.isClientSide()) {
// sounds.close(level, worldPosition);
animatedPackage = null;
return;
}
@ -161,13 +168,18 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
animatedPackage = box;
currentlyDepositing = deposit;
if (level != null && level.isClientSide() && !currentlyDepositing) {
Vec3 vec = target.getExactTargetLocation(this, level, worldPosition);
if (vec != null) {
for (int i = 0; i < 5; i++) {
level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, AllBlocks.ROPE.getDefaultState()),
vec.x, vec.y - level.random.nextFloat() * 0.25, vec.z, 0, 0, 0);
}
if (level != null && level.isClientSide()) {
if (currentlyDepositing) {
sounds.depositPackage(level, worldPosition);
} else {
sounds.catchPackage(level, worldPosition);
Vec3 vec = target.getExactTargetLocation(this, level, worldPosition);
if (vec != null)
for (int i = 0; i < 5; i++)
level.addParticle(
new BlockParticleOption(ParticleTypes.BLOCK, AllBlocks.ROPE.getDefaultState()), vec.x,
vec.y - level.random.nextFloat() * 0.25, vec.z, 0, 0, 0);
}
}
@ -298,4 +310,10 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
return true;
}
@Override
protected void onOpenedManually() {
if (level.isClientSide())
sounds.open(level, worldPosition);
}
}

View file

@ -0,0 +1,46 @@
package com.simibubi.create.content.logistics.packagePort.frogport;
import java.util.List;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.AllSoundEvents.SoundEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public class FrogportSounds {
private static final List<SoundEntry> CATCH_SOUNDS = List.of(AllSoundEvents.FROGPORT_CATCH_1,
AllSoundEvents.FROGPORT_CATCH_2, AllSoundEvents.FROGPORT_CATCH_3, AllSoundEvents.FROGPORT_CATCH_4);
public void open(Level level, BlockPos pos) {
AllSoundEvents.FROGPORT_OPEN.playAt(level, Vec3.atCenterOf(pos), 1, 1, false);
}
public void close(Level level, BlockPos pos) {
if (!isPlayerNear(pos))
return;
AllSoundEvents.FROGPORT_CLOSE.playAt(level, Vec3.atCenterOf(pos), 0.5f, 1.25f + level.random.nextFloat() * 0.25f,
true);
}
public void catchPackage(Level level, BlockPos pos) {
if (!isPlayerNear(pos))
return;
CATCH_SOUNDS.get(level.random.nextInt(CATCH_SOUNDS.size()))
.playAt(level, Vec3.atCenterOf(pos), 1, 1, false);
}
public void depositPackage(Level level, BlockPos pos) {
if (!isPlayerNear(pos))
return;
AllSoundEvents.FROGPORT_DEPOSIT.playAt(level, Vec3.atCenterOf(pos), 1, 1, false);
}
private boolean isPlayerNear(BlockPos pos) {
return pos.closerThan(Minecraft.getInstance().player.blockPosition(), 20);
}
}

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.packager;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.logistics.box.PackageItem;
import com.simibubi.create.foundation.block.IBE;
@ -97,6 +98,7 @@ public class PackagerBlock extends WrenchableDirectionalBlock implements IBE<Pac
be.unwrapBox(itemInHand.copy(), false);
be.triggerStockCheck();
itemInHand.shrink(1);
AllSoundEvents.DEPOT_PLOP.playOnServer(worldIn, pos);
if (itemInHand.isEmpty())
player.setItemInHand(handIn, ItemStack.EMPTY);
return InteractionResult.SUCCESS;
@ -108,6 +110,7 @@ public class PackagerBlock extends WrenchableDirectionalBlock implements IBE<Pac
if (!worldIn.isClientSide()) {
player.getInventory()
.placeItemBackInInventory(be.heldBox.copy());
AllSoundEvents.playItemPickup(player);
be.heldBox = ItemStack.EMPTY;
be.notifyUpdate();
}

View file

@ -64,6 +64,9 @@ public class LogisticsManager {
public static boolean broadcastPackageRequest(UUID freqId, RequestType type, PackageOrder order,
IItemHandler ignoredHandler, String address) {
if (order.isEmpty())
return false;
Multimap<PackagerBlockEntity, PackagingRequest> requests =
findPackagersForRequest(freqId, order, null, ignoredHandler, address);

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.logistics.stockTicker;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.logistics.packagerLink.LogisticallyLinkedBehaviour.RequestType;
import com.simibubi.create.content.logistics.redstoneRequester.RedstoneRequesterBlock;
import com.simibubi.create.foundation.networking.BlockEntityConfigurationPacket;
@ -44,6 +45,9 @@ public class PackageOrderRequestPacket extends BlockEntityConfigurationPacket<St
@Override
protected void applySettings(ServerPlayer player, StockTickerBlockEntity be) {
if (!order.isEmpty())
AllSoundEvents.STOCK_TICKER_REQUEST.playOnServer(be.getLevel(), pos);
if (encodeRequester) {
player.closeContainer();
RedstoneRequesterBlock.programRequester(player, be, order, address);

View file

@ -421,8 +421,9 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
blockEntity.refreshClientStockSnapshot();
LivingEntity keeper = stockKeeper.get();
if (keeper == null || !keeper.isAlive())
removed();
BlazeBurnerBlockEntity blazeKeeper = blaze.get();
if ((keeper == null || !keeper.isAlive()) && (blazeKeeper == null || blazeKeeper.isRemoved()))
menu.player.closeContainer();
}
@Override

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.stockTicker;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.logistics.packagerLink.LogisticallyLinkedBlockItem;
import com.simibubi.create.foundation.block.IBE;
@ -69,6 +70,7 @@ public class StockTickerBlock extends HorizontalDirectionalBlock implements IBE<
.placeItemBackInInventory(
stbe.receivedPayments.extractItem(i, stbe.receivedPayments.getStackInSlot(i)
.getCount(), false));
AllSoundEvents.playItemPickup(pPlayer);
return InteractionResult.SUCCESS;
}

View file

@ -184,6 +184,8 @@ public class StockTickerInteractionHandler {
tickerBE.broadcastPackageRequest(RequestType.PLAYER, order, null, ShoppingListItem.getAddress(mainHandItem));
player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
if (!order.isEmpty())
AllSoundEvents.STOCK_TICKER_TRADE.playOnServer(level, tickerBE.getBlockPos());
}
public static BlockPos getStockTickerPosition(Entity entity) {

View file

@ -108,8 +108,6 @@ public class TableClothBlock extends Block implements IHaveBigOutline, IWrenchab
if (!world.isClientSide() && !state.getValue(HAS_BE))
world.setBlockAndUpdate(pos, state.cycle(HAS_BE));
if (world.isClientSide())
return InteractionResult.SUCCESS;
return onBlockEntityUse(world, pos, dcbe -> dcbe.use(player, ray));
}

View file

@ -21,6 +21,7 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.utility.IntAttached;
import net.createmod.catnip.utility.NBTHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
@ -103,6 +104,8 @@ public class TableClothBlockEntity extends SmartBlockEntity {
public InteractionResult use(Player player, BlockHitResult ray) {
if (isShop())
return useShop(player);
if (level.isClientSide())
return InteractionResult.SUCCESS;
ItemStack heldItem = player.getItemInHand(InteractionHand.MAIN_HAND);
@ -110,6 +113,7 @@ public class TableClothBlockEntity extends SmartBlockEntity {
if (manuallyAddedItems.isEmpty())
return InteractionResult.SUCCESS;
player.setItemInHand(InteractionHand.MAIN_HAND, manuallyAddedItems.remove(manuallyAddedItems.size() - 1));
level.playSound(null, worldPosition, SoundEvents.ITEM_FRAME_REMOVE_ITEM, SoundSource.BLOCKS, 0.5f, 1f);
if (manuallyAddedItems.isEmpty()) {
level.setBlock(worldPosition, getBlockState().setValue(TableClothBlock.HAS_BE, false), 3);
@ -124,8 +128,10 @@ public class TableClothBlockEntity extends SmartBlockEntity {
if (manuallyAddedItems.size() >= 4)
return InteractionResult.SUCCESS;
level.playSound(null, worldPosition, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.5f, 1f);
manuallyAddedItems.add(heldItem.copyWithCount(1));
facing = player.getDirection().getOpposite();
facing = player.getDirection()
.getOpposite();
heldItem.shrink(1);
if (heldItem.isEmpty())
player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
@ -140,12 +146,10 @@ public class TableClothBlockEntity extends SmartBlockEntity {
}
public InteractionResult useShop(Player player) {
if (level.isClientSide())
return InteractionResult.SUCCESS;
ItemStack itemInHand = player.getItemInHand(InteractionHand.MAIN_HAND);
ItemStack prevListItem = ItemStack.EMPTY;
boolean addOntoList = false;
boolean clientSide = level.isClientSide();
// Remove other lists from inventory
for (int i = 0; i < 9; i++) {
@ -155,8 +159,9 @@ public class TableClothBlockEntity extends SmartBlockEntity {
continue;
prevListItem = item;
addOntoList = true;
player.getInventory()
.setItem(i, ItemStack.EMPTY);
if (!clientSide)
player.getInventory()
.setItem(i, ItemStack.EMPTY);
}
// add onto existing list if in hand
@ -166,16 +171,20 @@ public class TableClothBlockEntity extends SmartBlockEntity {
}
if (!itemInHand.isEmpty() && !addOntoList) {
CreateLang.translate("stock_keeper.shopping_list_empty_hand")
.sendStatus(player);
AllSoundEvents.DENY.playOnServer(level, worldPosition);
if (clientSide) {
CreateLang.translate("stock_keeper.shopping_list_empty_hand")
.sendStatus(player);
AllSoundEvents.DENY.playAt(level, worldPosition, 1, 1, false);
}
return InteractionResult.SUCCESS;
}
if (getPaymentItem().isEmpty()) {
CreateLang.translate("stock_keeper.no_price_set")
.sendStatus(player);
AllSoundEvents.DENY.playOnServer(level, worldPosition);
if (clientSide) {
CreateLang.translate("stock_keeper.no_price_set")
.sendStatus(player);
AllSoundEvents.DENY.playAt(level, worldPosition, 1, 1, false);
}
return InteractionResult.SUCCESS;
}
@ -187,26 +196,30 @@ public class TableClothBlockEntity extends SmartBlockEntity {
int stockLevel = getStockLevelForTrade(ShoppingListItem.getList(prevListItem));
if (tickerID == null) {
CreateLang.translate("stock_keeper.keeper_missing")
.style(ChatFormatting.RED)
.sendStatus(player);
AllSoundEvents.DENY.playOnServer(level, worldPosition);
if (clientSide) {
CreateLang.translate("stock_keeper.keeper_missing")
.style(ChatFormatting.RED)
.sendStatus(player);
AllSoundEvents.DENY.playAt(level, worldPosition, 1, 1, false);
}
return InteractionResult.SUCCESS;
}
if (stockLevel == 0) {
CreateLang.translate("stock_keeper.out_of_stock")
.style(ChatFormatting.RED)
.sendStatus(player);
AllSoundEvents.DENY.playOnServer(level, worldPosition);
if (!prevListItem.isEmpty()) {
if (player.getItemInHand(InteractionHand.MAIN_HAND)
.isEmpty())
player.setItemInHand(InteractionHand.MAIN_HAND, prevListItem);
else
player.getInventory()
.placeItemBackInInventory(prevListItem);
if (clientSide) {
CreateLang.translate("stock_keeper.out_of_stock")
.style(ChatFormatting.RED)
.sendStatus(player);
AllSoundEvents.DENY.playAt(level, worldPosition, 1, 1, false);
} else {
if (!prevListItem.isEmpty()) {
if (player.getItemInHand(InteractionHand.MAIN_HAND)
.isEmpty())
player.setItemInHand(InteractionHand.MAIN_HAND, prevListItem);
else
player.getInventory()
.placeItemBackInInventory(prevListItem);
}
}
return InteractionResult.SUCCESS;
@ -222,13 +235,22 @@ public class TableClothBlockEntity extends SmartBlockEntity {
addOntoList = false;
}
if (list.getPurchases(worldPosition) == stockLevel) {
CreateLang.translate("stock_keeper.limited_stock")
.style(ChatFormatting.RED)
.sendStatus(player);
AllSoundEvents.DENY.playOnServer(level, worldPosition);
if (list.getPurchases(worldPosition) >= stockLevel) {
for (IntAttached<BlockPos> entry : list.purchases())
if (worldPosition.equals(entry.getValue()))
entry.setFirst(Math.min(stockLevel, entry.getFirst()));
if (clientSide)
CreateLang.translate("stock_keeper.limited_stock")
.style(ChatFormatting.RED)
.sendStatus(player);
} else {
if (clientSide) {
AllSoundEvents.CONFIRM_2.playAt(level, worldPosition, 0.5f, 1, false);
return InteractionResult.SUCCESS;
}
list.addPurchases(worldPosition, 1);
if (!addOntoList)
CreateLang.translate("stock_keeper.use_list_to_add_purchases")
@ -236,9 +258,11 @@ public class TableClothBlockEntity extends SmartBlockEntity {
.sendStatus(player);
if (!addOntoList)
level.playSound(null, worldPosition, SoundEvents.BOOK_PAGE_TURN, SoundSource.BLOCKS, 1, 1.5f);
AllSoundEvents.CONFIRM.playOnServer(level, worldPosition);
}
if (clientSide)
return InteractionResult.SUCCESS;
ItemStack newListItem =
ShoppingListItem.saveList(AllItems.SHOPPING_LIST.asStack(), list, requestData.encodedTargetAdress);

View file

@ -238,7 +238,7 @@ public enum AllGuiTextures implements ScreenElement, TextureSheetSegment {
TRAIN_PROMPT_R("widgets", 11, 209, 3, 16),
TRAIN_PROMPT("widgets", 0, 230, 256, 16),
TRADE_OVERLAY("widgets", 136, 97, 98, 48),
TRADE_OVERLAY("widgets", 128, 98, 96, 46),
// PlacementIndicator
PLACEMENT_INDICATOR_SHEET("placement_indicator", 0, 0, 16, 256),

View file

@ -347,7 +347,7 @@
"create.stock_keeper.no_price_set": "Shop owner must set a price first",
"create.stock_keeper.keeper_missing": "Stock keeper missing",
"create.stock_keeper.out_of_stock": "Out of Stock",
"create.stock_keeper.limited_stock": "Limited stock available",
"create.stock_keeper.limited_stock": "Stock limit reached",
"create.stock_keeper.use_list_to_add_purchases": "Use this list to add more to your purchase",
"create.stock_keeper.locked": "Interact using a Shopping list, direct access has been locked",
"create.stock_keeper.stock_level_too_low": "Purchase cancelled: Stock levels lower than expected",

Binary file not shown.