Skip to content

Commit 9be0057

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 4b641ff + feb052a commit 9be0057

34 files changed

Lines changed: 326 additions & 166 deletions

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ neomoddev_version=1.0.20
2121
mod_id=ifw
2222
mod_name=Infinity Way
2323
mod_license=MIT
24-
mod_version=0.0-d
24+
mod_version=0.0-f
2525
mod_group_id=huix.infinity
2626
mod_authors=huix, limingzxc, xy_lose, YF_101
2727
mod_description=Minecraft is too easy Remastered Version

src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.21.1 2025-01-31T16:27:56.4315567 Recipes
1+
// 1.21.1 2025-02-02T18:16:58.8508873 Recipes
22
8095e32c2e0106f3ba40a10c204f6043d8dabfeb data/ifw/advancement/recipes/building_blocks/adamantium_bars.json
33
9d5e5fb6ff22512e12565ce8c70ec8434a2d5448 data/ifw/advancement/recipes/building_blocks/adamantium_door.json
44
c3ed1abdd1c9e856def620a4c7679b2fbc4b8e83 data/ifw/advancement/recipes/building_blocks/ancient_metal_bars.json
@@ -366,7 +366,7 @@ cca5022f1a16210e8c643bd9dfbc8573354b42d6 data/ifw/recipe/silver_shears.json
366366
18d5231ee8d0b7af5899008f6e32d851d38d119f data/ifw/recipe/silver_shovel.json
367367
ea4cb4518d2d36e26ebb3b306df7803635553105 data/ifw/recipe/silver_sword.json
368368
c6547a67b1dc8f968a49ae0fcd709a448ac3a199 data/ifw/recipe/silver_war_hammer.json
369-
c00077ccb0a010a14eaabe4bfcf3fd4744b2fcf3 data/ifw/recipe/sinew.json
369+
7ba0fda18fa3ffa0ba91c7de0487fb4aada129ea data/ifw/recipe/sinew.json
370370
132aa576722691b4a8bd63f75d8f410436c14c44 data/ifw/recipe/sorbet.json
371371
806daab1b386cb67af0732a470ef527b8d61b0c5 data/ifw/recipe/stone_furnace.json
372372
1016bfd66eebeaef180b44303130c1be878a2a2f data/ifw/recipe/vegetable_soup.json
@@ -384,6 +384,7 @@ a9b8907bfd52945202a8d3f6852ce350bf5f7d7e data/minecraft/advancement/recipes/buil
384384
6e523eee1ea699f772907f902f16f4f7cb3e4362 data/minecraft/advancement/recipes/building_blocks/mithril_block_from_ingot.json
385385
51603388ac82e19164c89315304f203f68e8dfb5 data/minecraft/advancement/recipes/building_blocks/nether_bricks.json
386386
4cb8ccef0ee5434856163cacc8ef7f8ff1888ea0 data/minecraft/advancement/recipes/building_blocks/obsidian.json
387+
7c7417e8dfdb46c3f5978a8b85a0ac503c1ba958 data/minecraft/advancement/recipes/building_blocks/pumpkin_seeds.json
387388
c810440c84781edd602de771fdfe5e023fe9904b data/minecraft/advancement/recipes/building_blocks/saddle.json
388389
f712991b7ae1c41a6294325b4874595d0cc90aec data/minecraft/advancement/recipes/building_blocks/silver_block_from_ingot.json
389390
454c0618a4ab72b2cf547e67b2a5496268a798e6 data/minecraft/advancement/recipes/building_blocks/smooth_basalt.json
@@ -524,6 +525,7 @@ ce85de452d95391cf4e86ae2b0b4af09a02938bf data/minecraft/recipe/obsidian.json
524525
9bbe6976bfb7418f9730f5c2b9f594f972ddaa62 data/minecraft/recipe/pink_glazed_terracotta.json
525526
0f1a9c606e681079272c71bbcb163a57ed1bea82 data/minecraft/recipe/popped_chorus_fruit.json
526527
6a55553eacd395fccaaf4637e9d2f305f3ac5a78 data/minecraft/recipe/pumpkin_pie.json
528+
943b84918dd5d69e10a77d6c370b2bc84e98064f data/minecraft/recipe/pumpkin_seeds.json
527529
41295b55747a473712d00d8aa7ac18e1eafeb965 data/minecraft/recipe/purple_glazed_terracotta.json
528530
a840a03d1b3631ad522b7ff315ed00b8ee0d4226 data/minecraft/recipe/quartz.json
529531
89377842d98832bdda3c10876c38019c8d8f2425 data/minecraft/recipe/raw_adamantium_smelting.json

src/generated/resources/.cache/c80c7a8ccd90f729100f93f300ddc4b41c2f09db

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.21.1 2025-02-01T19:49:51.7669731 Tags for minecraft:block mod id ifw
1+
// 1.21.1 2025-02-02T18:20:35.6842981 Tags for minecraft:block mod id ifw
22
135c338d4e90db4d3d07e2f281bb46d37795d1d3 data/minecraft/tags/block/anvil.json
33
acf4e3ca7c3b0e94b6ea6bbf061ea843d1250c97 data/minecraft/tags/block/doors.json
44
b147fcff5c0b4d72df1cb7809b063b2562180832 data/minecraft/tags/block/harvest_level_0_tool.json
@@ -13,4 +13,5 @@ ccb9467ef80c45c0c5c56759a5a78b3177be8d19 data/minecraft/tags/block/incorrect_for
1313
eabbbe1f65f580f77513deceab7ccbd9afc1aed7 data/minecraft/tags/block/incorrect_for_level_3_tool.json
1414
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/minecraft/tags/block/incorrect_for_level_4_tool.json
1515
431a024b6cd1c8210fd861dbe3b73bf72d744e29 data/minecraft/tags/block/mineable/pickaxe.json
16+
856f3ec346a8e680ef42769e7466c83a465ec43c data/minecraft/tags/block/mineable/shovel.json
1617
a6266b90aa3c43c4e5fff8e080ba2ee2fe7b1280 data/minecraft/tags/block/portable_block.json

src/generated/resources/data/ifw/recipe/sinew.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
],
99
"result": {
10-
"count": 2,
10+
"count": 4,
1111
"id": "ifw:sinew"
1212
}
1313
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"parent": "minecraft:recipes/root",
3+
"criteria": {
4+
"has_pumpkin": {
5+
"conditions": {
6+
"items": [
7+
{
8+
"items": "minecraft:pumpkin"
9+
}
10+
]
11+
},
12+
"trigger": "minecraft:inventory_changed"
13+
},
14+
"has_the_recipe": {
15+
"conditions": {
16+
"recipe": "minecraft:pumpkin_seeds"
17+
},
18+
"trigger": "minecraft:recipe_unlocked"
19+
}
20+
},
21+
"requirements": [
22+
[
23+
"has_the_recipe",
24+
"has_pumpkin"
25+
]
26+
],
27+
"rewards": {
28+
"recipes": [
29+
"minecraft:pumpkin_seeds"
30+
]
31+
}
32+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "minecraft:crafting_shapeless",
3+
"category": "building",
4+
"ingredients": [
5+
{
6+
"item": "minecraft:pumpkin"
7+
}
8+
],
9+
"result": {
10+
"count": 1,
11+
"id": "minecraft:pumpkin_seeds"
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"values": [
3+
"minecraft:clay",
4+
"minecraft:dirt",
5+
"minecraft:coarse_dirt",
6+
"minecraft:podzol",
7+
"minecraft:farmland",
8+
"minecraft:grass_block",
9+
"minecraft:gravel",
10+
"minecraft:mycelium",
11+
"minecraft:sand",
12+
"minecraft:red_sand",
13+
"minecraft:soul_sand",
14+
"minecraft:dirt_path",
15+
"minecraft:soul_soil",
16+
"minecraft:rooted_dirt",
17+
"minecraft:muddy_mangrove_roots",
18+
"minecraft:mud",
19+
"minecraft:suspicious_sand",
20+
"minecraft:suspicious_gravel",
21+
"#minecraft:concrete_powder"
22+
]
23+
}

src/main/java/huix/infinity/attachment/IFWAttachment.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ public class IFWAttachment {
4242
"is_panic", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()
4343
);
4444

45+
public static final Supplier<AttachmentType<Integer>> anvil_damage = ATTACHMENT_TYPES.register(
46+
"anvil_damage", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()
47+
);
48+
4549
}

src/main/java/huix/infinity/common/world/block/IFWAnvilBlock.java

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package huix.infinity.common.world.block;
22

3+
import huix.infinity.attachment.IFWAttachment;
34
import huix.infinity.common.world.block.entity.AnvilBlockEntity;
4-
import huix.infinity.common.world.block.entity.IFWFurnaceBlockEntity;
5-
import huix.infinity.common.world.inventory.IFWAnvilMenu;
65
import huix.infinity.common.world.inventory.IFWCopperAnvilMenu;
76
import huix.infinity.common.world.item.tier.IFWTiers;
87
import huix.infinity.util.DurabilityHelper;
@@ -17,10 +16,11 @@
1716
import net.minecraft.world.entity.item.FallingBlockEntity;
1817
import net.minecraft.world.inventory.ContainerLevelAccess;
1918
import net.minecraft.world.item.ItemStack;
19+
import net.minecraft.world.item.alchemy.PotionContents;
20+
import net.minecraft.world.item.alchemy.Potions;
2021
import net.minecraft.world.level.Level;
2122
import net.minecraft.world.level.block.AnvilBlock;
2223
import net.minecraft.world.level.block.EntityBlock;
23-
import net.minecraft.world.level.block.FallingBlock;
2424
import net.minecraft.world.level.block.entity.BlockEntity;
2525
import net.minecraft.world.level.block.state.BlockState;
2626

@@ -44,12 +44,12 @@ public IFWAnvilBlock(Properties properties, IFWTiers tier, int stage) {
4444
@Override
4545
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
4646
if (canPlace(state, level, pos, oldState)) {
47-
ServerLevel worldIn = (ServerLevel) level;
48-
int durability = ((AnvilBlockEntity)worldIn.getBlockEntity(pos)).durability();
49-
if (durability < this.maxDurability()) {
47+
AnvilBlockEntity blockEntity = (AnvilBlockEntity) level.getBlockEntity(pos);
48+
int damage = blockEntity.getData(IFWAttachment.anvil_damage.get());
49+
if (damage < this.maxDurability()) {
5050
ItemStack result = new ItemStack(this.asItem());
51-
result.set(DataComponents.DAMAGE, durability);
52-
popResource(worldIn, pos, result);
51+
result.set(DataComponents.DAMAGE, damage);
52+
popResource(level, pos, result);
5353
}
5454
}
5555
super.onPlace(state, level, pos, oldState, isMoving);
@@ -60,14 +60,19 @@ private boolean canPlace(BlockState state, Level level, BlockPos pos, BlockState
6060
&& !(state.getBlock() instanceof AnvilBlock);
6161
}
6262

63+
@Override
64+
public ItemStack ifw_defaultInstance() {
65+
ItemStack itemstack = super.ifw_defaultInstance();
66+
itemstack.set(DataComponents.MAX_DAMAGE, this.maxDurability());
67+
itemstack.set(DataComponents.DAMAGE, this.initalDurability());
68+
return itemstack;
69+
}
70+
6371
@Override
6472
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
6573
if (isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinBuildHeight()) {
66-
CompoundTag nbtCompound = new CompoundTag();
67-
nbtCompound.putInt("Durability", ((AnvilBlockEntity)level.getBlockEntity(pos)).durability());
68-
FallingBlockEntity fallingblockentity = FallingBlockEntity.fall(level, pos, state);
69-
fallingblockentity.blockData = nbtCompound;
70-
this.configureFallingBlockEntity(fallingblockentity);
74+
AnvilBlockEntity blockEntity = (AnvilBlockEntity) level.getBlockEntity(pos);
75+
blockEntity.setData(IFWAttachment.anvil_damage.get(), blockEntity.damage());
7176
}
7277

7378
super.tick(state, level, pos, random);
@@ -78,10 +83,10 @@ protected void configureFallingBlockEntity(FallingBlockEntity entity) {
7883
}
7984

8085
@Nullable
81-
public BlockState damage(int value, BlockEntity tileEntityAnvil) {
86+
public BlockState ifw_damage(int value, BlockEntity tileEntityAnvil) {
8287
if (tileEntityAnvil instanceof AnvilBlockEntity anvilBlockEntity) {
83-
anvilBlockEntity.durability(anvilBlockEntity.durability() + value);
84-
return this.getBrokeState(anvilBlockEntity.durability());
88+
anvilBlockEntity.damage(anvilBlockEntity.damage() + value);
89+
return this.getBrokeState(anvilBlockEntity.damage());
8590
} else {
8691
return null;
8792
}
@@ -91,9 +96,9 @@ public BlockState damage(int value, BlockEntity tileEntityAnvil) {
9196
public BlockState getBrokeState(int currentDamage) {
9297
if (currentDamage > this.maxDurability())
9398
throw new IllegalArgumentException("IFWAnvilBlock.GetBrokeState error");
94-
95-
if (currentDamage <= this.maxDurability() * 0.5F) return this.getDamagedState();
96-
else if (currentDamage >= this.maxDurability() * 0.8F) return this.defaultBlockState();
99+
int currentDurability = this.maxDurability() - currentDamage;
100+
if (currentDurability <= this.maxDurability() * 0.5F) return this.getDamagedState();
101+
else if (currentDurability >= this.maxDurability() * 0.8F) return this.defaultBlockState();
97102
else return this.getChippedState();
98103
}
99104

src/main/java/huix/infinity/common/world/block/entity/AnvilBlockEntity.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import net.minecraft.world.level.block.state.BlockState;
99

1010
public class AnvilBlockEntity extends BlockEntity {
11-
private int durability;
11+
private int damage;
1212

1313
public AnvilBlockEntity(BlockPos pos, BlockState blockState) {
1414
super(IFWBlockEntityTypes.ifw_anvil.get(), pos, blockState);
@@ -17,20 +17,20 @@ public AnvilBlockEntity(BlockPos pos, BlockState blockState) {
1717
@Override
1818
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
1919
super.loadAdditional(tag, registries);
20-
if (tag.contains("Durability")) this.durability = tag.getInt("Durability");
20+
if (tag.contains("Damage")) this.damage = tag.getInt("Damage");
2121
}
2222

2323
@Override
2424
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
2525
super.saveAdditional(tag, registries);
26-
if (this.durability != 0) tag.putInt("Durability", this.durability);
26+
if (this.damage != 0) tag.putInt("Damage", this.damage);
2727
}
2828

29-
public void durability(int durability) {
30-
this.durability = durability;
29+
public void damage(int durability) {
30+
this.damage = durability;
3131
}
3232

33-
public int durability() {
34-
return this.durability;
33+
public int damage() {
34+
return this.damage;
3535
}
3636
}

0 commit comments

Comments
 (0)