Fixed many machines not keeping energy/fluid/state when broken.

This commit is contained in:
Flanks255 2024-11-06 16:31:32 -06:00
parent 07c59fb37a
commit f05b284e2e
23 changed files with 350 additions and 24 deletions

View file

@ -1,5 +1,6 @@
# 1.3.10+mc1.21.1
* Fixed some machines not holding power when broken, The following machines now keep their stored energy when broken:
* Fixed Fluid placer not being harvestable.
* The following machines will now retain energy when broken:
* Coal Generator
* Oil Generator
* Leaf eating generator
@ -7,6 +8,22 @@
* Display Stand
* Powered Furnace
* Atomic Reconstructor
* Coffee Machine
* Farmer
* The following machines will retain fluids when broken:
* Oil Generator
* Coffee Machine
* Fluid Placer
* Fluid Collector
* Canola Press
* Fermenting Barrel
* The following machines will retain redstone state when broken:
* Atomic Reconstrutor
* Fluid Placer
* Fluid Collector
* Breaker
* Placer
* Dropper
# 1.3.9+mc1.21.1
* Change laser rendering to be compatible with Iris

View file

@ -1,4 +1,4 @@
// 1.21.1 2024-11-05T20:37:45.5911624 Loot Tables
// 1.21.1 2024-11-06T16:28:35.7516904 Loot Tables
ef11aa79a2f96a47250f46811f8491fd34d627f9 data/actuallyadditions/loot_table/blocks/atomic_reconstructor.json
e15c868b26b669c30365bfb93e7d9274e07df16d data/actuallyadditions/loot_table/blocks/battery_box.json
745d64af3b0203a138f9eca7de21ed4988b35c95 data/actuallyadditions/loot_table/blocks/bio_reactor.json
@ -15,23 +15,23 @@ c49b30e8d893f67866d0a47cf8682502468e9864 data/actuallyadditions/loot_table/block
38ae78b75ed66ec8e2df8f292ada90ac352e8f88 data/actuallyadditions/loot_table/blocks/black_quartz_slab.json
e4f42700948abba5991c961ee5b2c0ab6839d437 data/actuallyadditions/loot_table/blocks/black_quartz_stair.json
0d7396ec2071fcdd2df045b20c9b5a5a2692cc80 data/actuallyadditions/loot_table/blocks/black_quartz_wall.json
eca894a5b2e0c19418d95ffb072e51359a60fe3e data/actuallyadditions/loot_table/blocks/breaker.json
721df65869084716c4e8dded76f9a691dbf6f165 data/actuallyadditions/loot_table/blocks/breaker.json
6543b2f46d8c4e81c3b3efb8aff3cb3216c4acda data/actuallyadditions/loot_table/blocks/canola.json
1e482a0dec0dffade2a63d57fd58e1b154a513dd data/actuallyadditions/loot_table/blocks/canola_press.json
363f70b76c9ceea3bfbe62656523acc52178803c data/actuallyadditions/loot_table/blocks/canola_press.json
37edff6a4dd2975276e73be28cf2490bd91700a9 data/actuallyadditions/loot_table/blocks/chiseled_black_quartz_block.json
967afd8eaa3169037502ac72985ddba7b3670087 data/actuallyadditions/loot_table/blocks/chiseled_black_quartz_slab.json
b598ece027ef00e9ed0457a7f9542ebe8b89538c data/actuallyadditions/loot_table/blocks/chiseled_black_quartz_stair.json
584c40d2867ad0376823c1a4f37f1d901721ae4f data/actuallyadditions/loot_table/blocks/chiseled_black_quartz_wall.json
7d23a0c906af2f6b3fecaba91f776385db5a50bc data/actuallyadditions/loot_table/blocks/coal_generator.json
afab93747299dba6783292e5949ea7e0cd5d5b13 data/actuallyadditions/loot_table/blocks/coffee.json
ef604b6cc4ac21ee792ab7df41b77578b4d213db data/actuallyadditions/loot_table/blocks/coffee_machine.json
3d8c1c296df957964e41065f4d2c0814eee29282 data/actuallyadditions/loot_table/blocks/coffee_machine.json
fa895b25a0816ca506f7031ec3861cfd4de04f28 data/actuallyadditions/loot_table/blocks/crate_small.json
7c7a4028f6fe02446d1557f72ad494ab363a8409 data/actuallyadditions/loot_table/blocks/crusher.json
cbd5456165eaf299685aab50dc3bce38d99a1cf8 data/actuallyadditions/loot_table/blocks/crusher_double.json
25b7a44418e2858552dd5150d67bffe1f30269a8 data/actuallyadditions/loot_table/blocks/diamatine_crystal_block.json
ba64f685c7b3c7f998e61d9a3905e627784fb017 data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json
33bc6704cd8545a60049b9f168bc8aa391937e48 data/actuallyadditions/loot_table/blocks/display_stand.json
3f9aa8b99fad7066fd3a6118a499e3237920cc7e data/actuallyadditions/loot_table/blocks/dropper.json
20caefe08dc9153c3e26e48e0b26ee479519fbd6 data/actuallyadditions/loot_table/blocks/dropper.json
a8183cf6b77bbac91f09ea485f5eaadf70aa8fb0 data/actuallyadditions/loot_table/blocks/emeradic_crystal_block.json
25d55ab81ed1fc53387b4bc3712d4f26b188270f data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json
4811fb48ac8e17ed71d0e42016ccfd7f244026d4 data/actuallyadditions/loot_table/blocks/empowered_diamatine_crystal_block.json
@ -54,13 +54,13 @@ aca50008d47da6a89a41421752329fc108b74caa data/actuallyadditions/loot_table/block
d4eeacb9036343a75ba390acb912c294db3bbdb6 data/actuallyadditions/loot_table/blocks/ethetic_white_slab.json
358bf32510a08de204f61e668588ee58460e1321 data/actuallyadditions/loot_table/blocks/ethetic_white_stairs.json
0b05b4ba5b76e887bfba59740383f63287adc78d data/actuallyadditions/loot_table/blocks/ethetic_white_wall.json
6b88e7795b82affdb3f24b4b9c62e99458836f77 data/actuallyadditions/loot_table/blocks/farmer.json
6be43c72d5c70b8aa648df94843895e141642924 data/actuallyadditions/loot_table/blocks/farmer.json
4f60395b41acdd21a5e8e8592fb6141a230ffdde data/actuallyadditions/loot_table/blocks/feeder.json
18f0f3130da03f20277f843f3b8c4e4282efb65c data/actuallyadditions/loot_table/blocks/fermenting_barrel.json
25ef94eb9b94c7707d8ae5df2b4e9f52378ee6f7 data/actuallyadditions/loot_table/blocks/fermenting_barrel.json
c02726c670fccfa57d403272b9c96e3ad9cf4cc9 data/actuallyadditions/loot_table/blocks/firework_box.json
4bd34fdd919b12992acbfe81b6aa79cadb7f2774 data/actuallyadditions/loot_table/blocks/flax.json
ad1acc54d462b7bd1355fda6b05a9cc6ffa26418 data/actuallyadditions/loot_table/blocks/fluid_collector.json
4e3bec1c890dbeb36175c0905a7e6a5a6108ec45 data/actuallyadditions/loot_table/blocks/fluid_placer.json
306b4cb3da4065ba83240b24e0e6c3a067b99d73 data/actuallyadditions/loot_table/blocks/fluid_collector.json
1216c21d9f3805de5988ba3c65997b3b78d70abc data/actuallyadditions/loot_table/blocks/fluid_placer.json
8f15a45992ecb1be2ce326702c204c190a0aad14 data/actuallyadditions/loot_table/blocks/greenhouse_glass.json
4f3d2255de5aff7857911d138eb334bb9d9753ba data/actuallyadditions/loot_table/blocks/heat_collector.json
ed7443ee9e9956b1fc8ac87728201d88ccea755e data/actuallyadditions/loot_table/blocks/hopping_item_interface.json
@ -93,7 +93,7 @@ af0cb5ad3473b274da2873d3e08da0f4085e6699 data/actuallyadditions/loot_table/block
f8a03e56a032e858126f1b1861ea0b759a3e517d data/actuallyadditions/loot_table/blocks/lava_factory_controller.json
b5acba2bc0fc0ba58b60b1c929bb67a1a8fe96cb data/actuallyadditions/loot_table/blocks/leaf_generator.json
27ba42bb0f2dca72e29393944b61e566d758a2dc data/actuallyadditions/loot_table/blocks/long_range_breaker.json
43113c67b268280ce09b9c90df83f33c15bf2f06 data/actuallyadditions/loot_table/blocks/oil_generator.json
5a11a7789254b8191b2dd974cd21010cc67b6b5d data/actuallyadditions/loot_table/blocks/oil_generator.json
f0905fdc46775bb0d7382375b0a1109d125175e7 data/actuallyadditions/loot_table/blocks/palis_crystal_block.json
5162668136335d22fef342550e3a14f8c0347e92 data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json
dadc9a4648ff9cfa77840405384be4937cea991b data/actuallyadditions/loot_table/blocks/phantom_booster.json
@ -103,7 +103,7 @@ c020a9e28f95800f7eb064fc557afe3cd78ee77a data/actuallyadditions/loot_table/block
8be6d5b0ebb76e4122b1a91893cf8e1a2c34fc59 data/actuallyadditions/loot_table/blocks/phantom_liquiface.json
75eb64c44741c6d010ed2b226ebc8edec30ee151 data/actuallyadditions/loot_table/blocks/phantom_placer.json
999e9a1cf6a2c5409ac719ee9d9497954cff5921 data/actuallyadditions/loot_table/blocks/phantom_redstoneface.json
10649f4e8c6315e1c28877dd2d74519b374c2aef data/actuallyadditions/loot_table/blocks/placer.json
e521852bac68253288bb55fc57dfd6ecf765b767 data/actuallyadditions/loot_table/blocks/placer.json
f0a5b8a9ef9e878baa8e1792605ecb6371bf6262 data/actuallyadditions/loot_table/blocks/player_interface.json
e030d31981f02c0ed25d08fcaf8d8e7c89016247 data/actuallyadditions/loot_table/blocks/powered_furnace.json
8f51bc016a6797bfdf81973a21509e14bd47f245 data/actuallyadditions/loot_table/blocks/ranged_collector.json

View file

@ -1,4 +1,4 @@
// 1.21.1 2024-10-31T19:57:10.5378083 Block Tags
// 1.21.1 2024-11-06T14:57:14.1896533 Block Tags
8665de82dd3d3a1351ce58f78108214f359104b0 data/actuallyadditions/tags/block/mineable/aio.json
f7dc293929a2176bc6e428c765f6bf49fbeccdb5 data/actuallyadditions/tags/block/mineable/drill.json
3ce233e27b4d7db10e2d4832602ef5b2a57f9a65 data/c/tags/block/ores.json
@ -18,7 +18,7 @@ fb95ac8041521e1d2879f6fcb652266dcd9e0fb1 data/c/tags/block/storage_blocks/empowe
b9aa28a54d47054ba5653bec2f20e0a675ab5120 data/c/tags/block/storage_blocks/restonia_crystal.json
fb4f349bc6fd89f26ef2ba72a9236f05eefd8ea2 data/c/tags/block/storage_blocks/void_crystal.json
8dbaf9b7bd6774bc7c01a47a72b8a7fdaee51f87 data/minecraft/tags/block/mineable/axe.json
0f159793ba45fc4aee456d9b70fab9c0003899e8 data/minecraft/tags/block/mineable/pickaxe.json
32191fe399bac5ad4136ff1a0b3c0b4699b30b1c data/minecraft/tags/block/mineable/pickaxe.json
fab721a4fe7ece1d0e019ce36c4d2862f70ee53b data/minecraft/tags/block/needs_stone_tool.json
51d50547b5f031f4fa6e62189af06059a407c009 data/minecraft/tags/block/slabs.json
a60870f29ca48ea0d55ac32620ff5b4bb2f2f62e data/minecraft/tags/block/stairs.json

View file

@ -14,6 +14,15 @@
"name": "actuallyadditions:breaker"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:pulse_mode"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,22 @@
"name": "actuallyadditions:canola_press"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:energy"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,29 @@
"name": "actuallyadditions:coffee_machine"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:energy"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:misc_int"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,15 @@
"name": "actuallyadditions:dropper"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:pulse_mode"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,15 @@
"name": "actuallyadditions:farmer"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:energy"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,22 @@
"name": "actuallyadditions:fermenting_barrel"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid_b"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,22 @@
"name": "actuallyadditions:fluid_collector"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:pulse_mode"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -14,6 +14,22 @@
"name": "actuallyadditions:fluid_placer"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:pulse_mode"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -21,6 +21,13 @@
"actuallyadditions:energy"
],
"source": "block_entity"
},
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:fluid"
],
"source": "block_entity"
}
],
"rolls": 1.0

View file

@ -14,6 +14,15 @@
"name": "actuallyadditions:placer"
}
],
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"actuallyadditions:pulse_mode"
],
"source": "block_entity"
}
],
"rolls": 1.0
}
],

View file

@ -69,20 +69,34 @@ public class LootTableGenerator extends LootTableProvider {
.include(ActuallyComponents.ENERGY_STORAGE.get());
CopyComponentsFunction.Builder copyPulseMode = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.PULSE_MODE.get());
CopyComponentsFunction.Builder copyFluid_A = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.FLUID_A.get());
CopyComponentsFunction.Builder copyFluid_B = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.FLUID_B.get());
CopyComponentsFunction.Builder copyMiscInt = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.MISC_INT.get());
//Special Drops
dropComponents(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, $ -> $.apply(copyEnergy).apply(copyPulseMode));
dropKeepEnergy(ActuallyBlocks.DISPLAY_STAND);
dropKeepEnergy(ActuallyBlocks.COAL_GENERATOR);
dropKeepEnergy(ActuallyBlocks.OIL_GENERATOR);
dropComponents(ActuallyBlocks.OIL_GENERATOR, $ -> $.apply(copyEnergy).apply(copyFluid_A));
dropKeepEnergy(ActuallyBlocks.LEAF_GENERATOR);
dropKeepEnergy(ActuallyBlocks.CRUSHER);
dropKeepEnergy(ActuallyBlocks.CRUSHER_DOUBLE);
dropKeepEnergy(ActuallyBlocks.POWERED_FURNACE);
dropComponents(ActuallyBlocks.COFFEE_MACHINE, $ -> $.apply(copyEnergy).apply(copyFluid_A).apply(copyMiscInt));
dropComponents(ActuallyBlocks.FLUID_COLLECTOR, $ -> $.apply(copyFluid_A).apply(copyPulseMode));
dropComponents(ActuallyBlocks.FLUID_PLACER, $ -> $.apply(copyFluid_A).apply(copyPulseMode));
dropKeepPulseMode(ActuallyBlocks.BREAKER);
dropKeepPulseMode(ActuallyBlocks.PLACER);
dropKeepPulseMode(ActuallyBlocks.DROPPER);
dropComponents(ActuallyBlocks.CANOLA_PRESS, $ -> $.apply(copyEnergy).apply(copyFluid_A));
dropComponents(ActuallyBlocks.FERMENTING_BARREL, $ -> $.apply(copyFluid_A).apply(copyFluid_B));
dropKeepEnergy(ActuallyBlocks.FARMER);
this.dropSelf(ActuallyBlocks.BATTERY_BOX.get());
this.dropSelf(ActuallyBlocks.ITEM_INTERFACE_HOPPING.get());
this.dropSelf(ActuallyBlocks.FARMER.get());
this.dropSelf(ActuallyBlocks.BIOREACTOR.get());
this.dropSelf(ActuallyBlocks.EMPOWERER.get());
this.dropSelf(ActuallyBlocks.TINY_TORCH.get());
@ -94,24 +108,16 @@ public class LootTableGenerator extends LootTableProvider {
this.dropSelf(ActuallyBlocks.ENERGIZER.get());
this.dropSelf(ActuallyBlocks.ENERVATOR.get());
this.dropSelf(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get());
this.dropSelf(ActuallyBlocks.CANOLA_PRESS.get());
this.dropSelf(ActuallyBlocks.PHANTOM_ITEMFACE.get());
this.dropSelf(ActuallyBlocks.PHANTOM_PLACER.get());
this.dropSelf(ActuallyBlocks.PHANTOM_LIQUIFACE.get());
this.dropSelf(ActuallyBlocks.PHANTOM_ENERGYFACE.get());
this.dropSelf(ActuallyBlocks.PHANTOM_REDSTONEFACE.get());
this.dropSelf(ActuallyBlocks.PHANTOM_BREAKER.get());
this.dropSelf(ActuallyBlocks.FERMENTING_BARREL.get());
this.dropSelf(ActuallyBlocks.FEEDER.get());
this.dropSelf(ActuallyBlocks.HEAT_COLLECTOR.get());
this.dropSelf(ActuallyBlocks.GREENHOUSE_GLASS.get());
this.dropSelf(ActuallyBlocks.BREAKER.get());
this.dropSelf(ActuallyBlocks.PLACER.get());
this.dropSelf(ActuallyBlocks.DROPPER.get());
this.dropSelf(ActuallyBlocks.CRATE_SMALL.get());
this.dropSelf(ActuallyBlocks.FLUID_PLACER.get());
this.dropSelf(ActuallyBlocks.FLUID_COLLECTOR.get());
this.dropSelf(ActuallyBlocks.COFFEE_MACHINE.get());
this.dropSelf(ActuallyBlocks.PHANTOM_BOOSTER.get());
this.dropSelf(ActuallyBlocks.RANGED_COLLECTOR.get());
this.dropSelf(ActuallyBlocks.LONG_RANGE_BREAKER.get());
@ -214,6 +220,10 @@ public class LootTableGenerator extends LootTableProvider {
add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool)));
}
private void dropKeepPulseMode(Supplier<? extends Block> blockSupplier) {
dropComponents(blockSupplier, $ -> $.apply(CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.PULSE_MODE.get())));
}
private void dropKeepEnergy(Supplier<? extends Block> blockSupplier) {
dropComponents(blockSupplier, $ -> $.apply(CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.ENERGY_STORAGE.get())));

View file

@ -7,7 +7,9 @@ import net.minecraft.core.UUIDUtil;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.component.ItemContainerContents;
@ -15,6 +17,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.UUID;
@ -139,7 +142,43 @@ public class ActuallyComponents {
.networkSynchronized(BlockPos.STREAM_CODEC)
.build());
public static final Supplier<DataComponentType<Integer>> MISC_INT = DATA_COMPONENT_TYPES.register("misc_int", () ->
DataComponentType.<Integer>builder()
.persistent(Codec.INT)
.networkSynchronized(ByteBufCodecs.INT)
.build());
public static final Supplier<DataComponentType<FluidContents>> FLUID_A = DATA_COMPONENT_TYPES.register("fluid", () ->
DataComponentType.<FluidContents>builder()
.persistent(FluidContents.CODEC)
.networkSynchronized(FluidContents.STREAM_CODEC)
.build());
public static final Supplier<DataComponentType<FluidContents>> FLUID_B = DATA_COMPONENT_TYPES.register("fluid_b", () ->
DataComponentType.<FluidContents>builder()
.persistent(FluidContents.CODEC)
.networkSynchronized(FluidContents.STREAM_CODEC)
.build());
public record FluidContents(FluidStack inner) {
public static final Codec<FluidContents> CODEC = FluidStack.OPTIONAL_CODEC.xmap(FluidContents::new, FluidContents::inner);
public static final StreamCodec<RegistryFriendlyByteBuf, FluidContents> STREAM_CODEC = FluidStack.OPTIONAL_STREAM_CODEC.map(FluidContents::new, FluidContents::inner);
public static final FluidContents EMPTY = new FluidContents(FluidStack.EMPTY);
public static FluidContents of(FluidStack stack) {
return new FluidContents(stack);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FluidStack other) {
return FluidStack.matches(inner, other);
}
return false;
}
}
/*
* This is a supplier for an attachment type that can be used to attach an energy storage to an item.
* Implementation is based on EnderIO's https://github.com/Team-EnderIO/EnderIO/blob/e1f022df745131ed5fea718bd860880a5785d4c7/src/core/java/com/enderio/core/common/attachment/AttachmentUtil.java#L47-L60

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBreaker;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -18,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
@ -149,4 +151,19 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements MenuPr
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) {
return new ContainerBreaker(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(@Nonnull DataComponentInput input) {
super.applyImplicitComponents(input);
this.isPulseMode = input.getOrDefault(ActuallyComponents.PULSE_MODE, false);
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.PULSE_MODE, isPulseMode);
}
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.OutputOnlyFluidTank;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
@ -21,6 +22,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.MenuProvider;
@ -38,6 +40,7 @@ import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.FluidType;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;
@ -184,4 +187,21 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements Me
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) {
return new ContainerCanolaPress(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(DataComponentInput componentInput) {
super.applyImplicitComponents(componentInput);
storage.setEnergyStored(componentInput.getOrDefault(ActuallyComponents.ENERGY_STORAGE, 0));
tank.setFluid(componentInput.getOrDefault(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.EMPTY).inner());
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.ENERGY_STORAGE, storage.getEnergyStored());
builder.set(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.of(tank.getFluid()));
}
}

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.AATank;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
@ -25,6 +26,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundSource;
@ -256,4 +258,22 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) {
return new ContainerCoffeeMachine(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(DataComponentInput componentInput) {
super.applyImplicitComponents(componentInput);
storage.setEnergyStored(componentInput.getOrDefault(ActuallyComponents.ENERGY_STORAGE, 0));
tank.setFluid(componentInput.getOrDefault(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.EMPTY).inner());
this.coffeeCacheAmount = componentInput.getOrDefault(ActuallyComponents.MISC_INT, 0);
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.ENERGY_STORAGE, storage.getEnergyStored());
builder.set(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.of(tank.getFluid()));
builder.set(ActuallyComponents.MISC_INT, this.coffeeCacheAmount);
}
}

View file

@ -11,11 +11,13 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.MenuProvider;
@ -27,6 +29,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileEntityDropper extends TileEntityInventoryBase implements MenuProvider {
@ -121,4 +124,19 @@ public class TileEntityDropper extends TileEntityInventoryBase implements MenuPr
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) {
return new ContainerDropper(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(@Nonnull DataComponentInput input) {
super.applyImplicitComponents(input);
this.isPulseMode = input.getOrDefault(ActuallyComponents.PULSE_MODE, false);
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.PULSE_MODE, isPulseMode);
}
}

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -24,6 +25,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
@ -38,6 +40,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.neoforged.neoforge.energy.IEnergyStorage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
@ -251,4 +254,18 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player p_createMenu_3_) {
return new ContainerFarmer(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(@Nonnull DataComponentInput input) {
super.applyImplicitComponents(input);
storage.setEnergyStored(input.getOrDefault(ActuallyComponents.ENERGY_STORAGE, 0));
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.ENERGY_STORAGE, storage.getEnergyStored());
}
}

View file

@ -12,11 +12,13 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.MenuProvider;
@ -119,6 +121,22 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
}
}
@Override
protected void applyImplicitComponents(DataComponentInput componentInput) {
super.applyImplicitComponents(componentInput);
tanks.inputTank.setFluid(componentInput.getOrDefault(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.EMPTY).inner());
tanks.outputTank.setFluid(componentInput.getOrDefault(ActuallyComponents.FLUID_B, ActuallyComponents.FluidContents.EMPTY).inner());
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.of(tanks.inputTank.getFluid()));
builder.set(ActuallyComponents.FLUID_B, ActuallyComponents.FluidContents.of(tanks.outputTank.getFluid()));
}
@Override
public int getComparatorStrength() {
float calc = (float) this.tanks.getFluidInTank(1).getAmount() / (float) this.tanks.getTankCapacity(1) * 15F;

View file

@ -11,12 +11,14 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.fluids.AATank;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@ -228,4 +230,20 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) {
return new ContainerFluidCollector(windowId, playerInventory, this);
}
@Override
protected void applyImplicitComponents(@Nonnull DataComponentInput input) {
super.applyImplicitComponents(input);
tank.setFluid(input.getOrDefault(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.EMPTY).inner());
this.isPulseMode = input.getOrDefault(ActuallyComponents.PULSE_MODE, false);
}
@Override
protected void collectImplicitComponents(@Nonnull DataComponentMap.Builder builder) {
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.of(tank.getFluid()));
builder.set(ActuallyComponents.PULSE_MODE, isPulseMode);
}
}

View file

@ -237,6 +237,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
super.applyImplicitComponents(input);
storage.setEnergyStored(input.getOrDefault(ActuallyComponents.ENERGY_STORAGE, 0));
tank.setFluid(input.getOrDefault(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.EMPTY).inner());
}
@Override
@ -244,5 +245,6 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
super.collectImplicitComponents(builder);
builder.set(ActuallyComponents.ENERGY_STORAGE, storage.getEnergyStored());
builder.set(ActuallyComponents.FLUID_A, ActuallyComponents.FluidContents.of(tank.getFluid()));
}
}