Skip to content

Commit

Permalink
wip: Continue port to Minecraft 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Nov 1, 2024
1 parent 811736a commit 962ced7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#excompressum:mineable/hammer"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ToolMaterial;
import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.state.BlockState;

import java.util.List;

Expand All @@ -38,7 +36,7 @@ public class ChickenStickItem extends DiggerItem {
ModItemTags.CHICKEN_STICK_TOOL_MATERIALS);

public ChickenStickItem(Item.Properties properties) {
super(CHICKEN_STICK_TIER, ModBlockTags.MINEABLE_WITH_HAMMER, 6f, -3.2f, properties.fireResistant());
super(CHICKEN_STICK_TIER, ModBlockTags.MINEABLE_WITH_CHICKEN_STICK, 6f, -3.2f, properties.fireResistant());
}

@Override
Expand All @@ -54,27 +52,6 @@ public InteractionResult use(Level level, Player player, InteractionHand hand) {
return InteractionResult.SUCCESS;
}

@Override
public boolean isCorrectToolForDrops(ItemStack itemStack, BlockState state) {
// TODO no more recipe manager on client, might need to introduce a tag and manage it alongside the recipes
// RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null);
// return ExRegistries.getChickenStickRegistry().isHammerable(recipeManager, new ItemStack(state.getBlock()));
return true;
}

@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
// TODO no more recipe manager on client, might need to introduce a tag and manage it alongside the recipes
// RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null);
// if ((ExRegistries.getChickenStickRegistry().isHammerable(recipeManager, new ItemStack(state.getBlock())))) {
// if (isAngry(stack)) {
// return CHICKEN_STICK_TIER.speed() * 1.5f;
// }
// return CHICKEN_STICK_TIER.speed();
// }
return 0.8f;
}

public void tryPlayChickenSound(LevelAccessor level, BlockPos pos) {
if (level.getRandom().nextFloat() <= ExCompressumConfig.getActive().tools.chickenStickSoundChance) {
ResourceLocation location = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
public class ModBlockTags {
public static final TagKey<Block> MINEABLE_WITH_CROOK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/crook"));
public static final TagKey<Block> MINEABLE_WITH_HAMMER = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/hammer"));
public static final TagKey<Block> MINEABLE_WITH_CHICKEN_STICK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/chicken_stick"));
public static final TagKey<Block> INCORRECT_FOR_CHICKEN_STICK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "incorrect_for_chicken_stick"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ protected void addTags(HolderLookup.Provider arg) {
ModBlocks.compressedBlocks[CompressedBlockType.GRAVEL.ordinal()],
ModBlocks.compressedBlocks[CompressedBlockType.NETHERRACK.ordinal()],
ModBlocks.compressedBlocks[CompressedBlockType.SAND.ordinal()]);

getOrCreateTagBuilder(ModBlockTags.MINEABLE_WITH_CHICKEN_STICK).addTag(ModBlockTags.MINEABLE_WITH_HAMMER);

getOrCreateTagBuilder(ModBlockTags.INCORRECT_FOR_CHICKEN_STICK);
}

}

0 comments on commit 962ced7

Please sign in to comment.