Skip to content

Commit 3f94fa0

Browse files
committed
🐺🔧
1 parent 72ad8ce commit 3f94fa0

15 files changed

Lines changed: 58 additions & 27 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 NeoForged project
3+
Copyright (c) 2025 Future Food Dev
44

55
This license applies to the template files as supplied by github.com/NeoForged/MDK
66

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ loader_version_range=[1,)
1616
mod_id=futurefood
1717
mod_name=Future Food
1818
mod_license=MIT
19-
mod_version=1.0.0
19+
mod_version=1.0.1
2020
mod_group_id=top.ctnstudio.futurefood
2121
mod_authors=
2222
mod_description=
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.21.1 2025-10-14T16:04:38.8847166 Languages: zh_cn for mod: futurefood
2-
8ff65a004410c27cbcb2cf6a2d19ffcd7405fd44 assets/futurefood/lang/zh_cn.json
1+
// 1.21.1 2025-10-17T22:26:22.6712916 Languages: zh_cn for mod: futurefood
2+
c92837c5b0cbe8c7590655d80419e35c0bb01521 assets/futurefood/lang/zh_cn.json

src/generated/resources/assets/futurefood/lang/zh_cn.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"block.futurefood.particle_collider": "粒子对撞器",
66
"block.futurefood.quantum_energy_diffuser": "量子能源扩散器",
77
"block.futurefood.quantum_energy_receiver": "量子能源接收器",
8+
"effect.futurefood.radiation": "辐射",
89
"food.futurefood.antimatter_snack.info": "非常美味的小吃,能量密度极高。如果你一口没有吃饱,那么可能会在你的胃里膨胀。",
910
"food.futurefood.atom_cola.info": "BONK!",
1011
"food.futurefood.black_hole_cake.info": "有东西想把你吸进去。",

src/main/java/top/ctnstudio/futurefood/common/block/BatteryEntityBlock.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ public BatteryEntityBlock(boolean isInfinite) {
4848
.strength(0.4f)
4949
.lightLevel(state -> {
5050
if (state.getBlock() instanceof BatteryEntityBlock battery && battery.isInfinite) {
51-
return 7;
51+
return 15;
52+
} else {
53+
return 12;
5254
}
53-
return 0;
5455
})
5556
, isInfinite);
5657
}

src/main/java/top/ctnstudio/futurefood/common/block/QedEntityBlock.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ public QedEntityBlock(Properties properties) {
5858
.isViewBlocking(ModBlock.never() )
5959
.strength(0.4f)
6060
.lightLevel(state -> {
61-
Light light = state.getValue(LIGHT);
62-
return switch (light) {
61+
Activate activate = state.getValue(ACTIVATE);
62+
return switch (activate) {
6363
case DEFAULT -> 0;
64-
case WORK -> 7;
65-
case ABNORMAL -> 14;
64+
case WORK -> 14;
65+
case FLASH -> 7;
66+
case FLASH1 -> 9;
6667
};
6768
})
6869
, ModTileEntity.QED);

src/main/java/top/ctnstudio/futurefood/common/block/QerEntityBlock.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import net.minecraft.world.phys.shapes.VoxelShape;
2727
import org.jetbrains.annotations.NotNull;
2828
import top.ctnstudio.futurefood.api.block.IEntityStorageBlock;
29-
import top.ctnstudio.futurefood.common.block.QedEntityBlock.Light;
3029
import top.ctnstudio.futurefood.common.block.tile.ModBlockEntity;
3130
import top.ctnstudio.futurefood.common.block.tile.QerBlockEntity;
3231
import top.ctnstudio.futurefood.core.init.ModBlock;
@@ -52,11 +51,10 @@ public QerEntityBlock(Properties properties) {
5251
.isViewBlocking(ModBlock.never())
5352
.strength(0.4f)
5453
.lightLevel(state -> {
55-
Light light = state.getValue(LIGHT);
56-
return switch (light) {
54+
Activate activate = state.getValue(ACTIVATE);
55+
return switch (activate) {
5756
case DEFAULT -> 0;
58-
case WORK -> 7;
59-
case ABNORMAL -> 14;
57+
case WORK -> 12;
6058
};
6159
}) , ModTileEntity.QER);
6260
this.registerDefaultState(this.stateDefinition.any()

src/main/java/top/ctnstudio/futurefood/common/block/tile/BaseEnergyStorageBlockEntity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ public Component getDisplayName() {
173173
return getBlockState().getBlock().getName();
174174
}
175175

176+
public void controlBlockEnergy(Level world, BlockPos pos, BlockState state) {
177+
final var capability = getSurroundingEnergyStorage(world, pos, state);
178+
if (Objects.isNull(capability)) {
179+
return;
180+
}
181+
182+
EnergyUtil.controlEnergy(capability, this.energyStorage);
183+
}
184+
185+
176186
/**
177187
* 操控能源物品槽的能量
178188
*/

src/main/java/top/ctnstudio/futurefood/common/block/tile/GluttonyBlockEntity.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.minecraft.core.HolderLookup;
55
import net.minecraft.core.component.DataComponents;
66
import net.minecraft.nbt.CompoundTag;
7+
import net.minecraft.util.Mth;
78
import net.minecraft.world.entity.player.Inventory;
89
import net.minecraft.world.entity.player.Player;
910
import net.minecraft.world.food.FoodProperties;
@@ -137,12 +138,15 @@ private void working(@NotNull Level level, @NotNull BlockPos pos) {
137138
itemHandler.insertItem(2, outputItem, false);
138139

139140
// 避免满了还继续修改
140-
if (!energyStorage.canReceive() || energyStorage.getEnergyStored() >= energyStorage.getMaxEnergyStored() ||
141-
energyStorage.receiveEnergy(outputEnergy, true) <= 0) {
141+
if (energyStorage.getEnergyStored() >= energyStorage.getMaxEnergyStored()) {
142142
return;
143143
}
144144

145-
energyStorage.receiveEnergy(outputEnergy, false);
145+
final var energy = Mth.clamp(energyStorage.getEnergyStored() + outputEnergy,
146+
0,
147+
energyStorage.getMaxEnergyStored());
148+
149+
energyStorage.setEnergy(energy);
146150
outputEnergy(level, pos);
147151
}
148152

@@ -181,8 +185,9 @@ protected void produceProducts(ItemStack item) {
181185
resetProgress();
182186
return;
183187
}
184-
if (cacheRecipeEntry != null && ItemStack.isSameItem(item, cacheRecipeEntry.inputItem) &&
185-
item.get(DataComponents.FOOD).equals(cacheRecipeEntry.inputItem.get(DataComponents.FOOD))) {
188+
if (cacheRecipeEntry != null
189+
&& ItemStack.isSameItem(item, cacheRecipeEntry.inputItem)
190+
&& item.get(DataComponents.FOOD).equals(cacheRecipeEntry.inputItem.get(DataComponents.FOOD))) {
186191
return;
187192
}
188193

src/main/java/top/ctnstudio/futurefood/common/block/tile/ParticleColliderBlockEntity.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.minecraft.core.HolderLookup;
66
import net.minecraft.nbt.CompoundTag;
77
import net.minecraft.server.level.ServerLevel;
8+
import net.minecraft.util.Mth;
89
import net.minecraft.world.entity.player.Inventory;
910
import net.minecraft.world.entity.player.Player;
1011
import net.minecraft.world.inventory.ContainerData;
@@ -23,9 +24,9 @@
2324
import top.ctnstudio.futurefood.api.adapter.ModItemStackHandler;
2425
import top.ctnstudio.futurefood.api.block.IUnlimitedEntityReceive;
2526
import top.ctnstudio.futurefood.api.recipe.ParticleColliderRecipe;
26-
import top.ctnstudio.futurefood.core.ParticleColliderRecipeManager;
2727
import top.ctnstudio.futurefood.common.block.ParticleColliderEntityBlock;
2828
import top.ctnstudio.futurefood.common.menu.ParticleColliderMenu;
29+
import top.ctnstudio.futurefood.core.ParticleColliderRecipeManager;
2930
import top.ctnstudio.futurefood.core.init.ModTileEntity;
3031

3132
import java.util.Optional;
@@ -168,7 +169,12 @@ private void processRecipe() {
168169

169170
setBlockState();
170171

171-
energyStorage.extractEnergy(energyPerTick, false);
172+
final var energy = Mth.clamp(energyStorage.getEnergyStored() - energyPerTick,
173+
0,
174+
energyStorage.getMaxEnergyStored());
175+
176+
energyStorage.setEnergy(energy);
177+
172178
progressTick++;
173179
if (this.progressTick >= this.maxWorkTick) {
174180
craftItem(currentRecipe);
@@ -181,11 +187,12 @@ private void setBlockState() {
181187
if (!(level instanceof ServerLevel)) {
182188
return;
183189
}
184-
BlockState blockState = getBlockState();
185-
BlockState newBlockState = getBlockState();
186-
newBlockState = newBlockState.setValue(ParticleColliderEntityBlock.ACTIVATE, progressTick > 0);
187-
if (!blockState.equals(newBlockState)) {
188-
level.setBlockAndUpdate(getBlockPos(), newBlockState);
190+
191+
final BlockState state = getBlockState();
192+
final boolean flag = progressTick > 0;
193+
if (state.getValue(ParticleColliderEntityBlock.ACTIVATE) != flag) {
194+
level.setBlockAndUpdate(getBlockPos(),
195+
state.setValue(ParticleColliderEntityBlock.ACTIVATE, flag));
189196
}
190197
}
191198

0 commit comments

Comments
 (0)