Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.14-SNAPSHOT'
id 'fabric-loom' version '1.16-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -12,8 +12,6 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.

maven { url 'https://jitpack.io' }
}

dependencies {
Expand All @@ -24,9 +22,6 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "com.github.Chocohead:Fabric-ASM:v2.3"
include "com.github.Chocohead:Fabric-ASM:v2.3"
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/develop
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.18.4
loader_version=0.19.2

# Mod Properties
mod_version = 0.6.0-preview.1+1.21.5
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.errorcraft.itematic.client.gui.screen.recipebook;

import net.errorcraft.itematic.client.recipebook.ItematicSearchRecipeBookTypes;
import net.errorcraft.itematic.mixin.client.gui.screen.recipebook.GhostRecipeAccessor;
import net.errorcraft.itematic.recipe.book.ItematicRecipeBookCategories;
import net.errorcraft.itematic.recipe.display.BrewingRecipeDisplay;
Expand All @@ -9,6 +8,7 @@
import net.minecraft.client.gui.screen.recipebook.GhostRecipe;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.gui.screen.recipebook.RecipeResultCollection;
import net.minecraft.client.recipebook.RecipeBookType;
import net.minecraft.item.Items;
import net.minecraft.recipe.RecipeFinder;
import net.minecraft.recipe.display.RecipeDisplay;
Expand All @@ -28,7 +28,7 @@ public class BrewingRecipeBookWidget extends RecipeBookWidget<BrewingStandMenuDe
);
private static final Text TOGGLE_BREWABLE_TEXT = Text.translatable("gui.recipebook.toggleRecipes.brewable");
private static final List<Tab> TABS = List.of(
new Tab(ItematicSearchRecipeBookTypes.BREWING),
new Tab(RecipeBookType.ITEMATIC_BREWING),
// Item references are intended as key conversion is handled by a mixin
new Tab(Items.NETHER_WART, Items.MAGMA_CREAM, ItematicRecipeBookCategories.BREWING_MODIFY),
new Tab(Items.SPLASH_POTION, Items.LINGERING_POTION, ItematicRecipeBookCategories.BREWING_AMPLIFY)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

public class GameModeSwitcherScreenExtender {
@Mixin(GameModeSwitcherScreen.ButtonWidget.class)
Expand Down Expand Up @@ -62,7 +64,11 @@ public static class GameModeSelectionExtender implements GameModeSwitcherScreenA
@Unique
private RegistryKey<Item> icon;

static {
@Inject(
method = "<clinit>",
at = @At("TAIL")
)
private static void setIcons(CallbackInfo info) {
CREATIVE.itematic$setIcon(ItemKeys.GRASS_BLOCK);
SURVIVAL.itematic$setIcon(ItemKeys.IRON_SWORD);
ADVENTURE.itematic$setIcon(ItemKeys.MAP);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.errorcraft.itematic.mixin.client.recipebook;

import net.errorcraft.itematic.recipe.book.ItematicRecipeBookCategories;
import net.minecraft.client.recipebook.RecipeBookType;
import net.minecraft.recipe.book.RecipeBookCategory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(RecipeBookType.class)
public enum RecipeBookTypeExtender {
ITEMATIC_BREWING(ItematicRecipeBookCategories.BREWING_MODIFY, ItematicRecipeBookCategories.BREWING_AMPLIFY);

@Shadow
RecipeBookTypeExtender(RecipeBookCategory... categories) {}
}
1 change: 1 addition & 0 deletions src/client/resources/itematic.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"option.HotbarStorageEntryExtender",
"particle.CrackParticleExtender$SlimeballFactoryExtender",
"particle.CrackParticleExtender$SnowballFactoryExtender",
"recipebook.RecipeBookTypeExtender",
"recipebook.RecipeBookWidgetExtender$TabExtender",
"render.block.entity.DecoratedPotBlockEntityRendererExtender",
"render.entity.AbstractSkeletonEntityRendererExtender",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public class SignTestSuite {
@GameTest(structure = "itematic:item.sign.platform")
public void placingSignOpensSignMenu(TestContext context) {
ServerWorld world = context.getWorld();
ItemStack oakSign = world.itematic$createStack(ItemKeys.OAK_SIGN);
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, oakSign);
player.setPitch(90.0f);
player.setStackInHand(Hand.MAIN_HAND, world.itematic$createStack(ItemKeys.OAK_SIGN));
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, oakSign, GROUND_POSITION, Direction.UP);
TestUtil.useBlock(context, GROUND_POSITION, player, Direction.UP);
context.addFinalTask(() -> {
Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.OAK_SIGN);
Expand All @@ -49,12 +49,13 @@ public void placingSignOpensSignMenu(TestContext context) {
@SuppressWarnings("DataFlowIssue")
public void placingSignWithBlockEntityDataDoesNotOpenSignMenu(TestContext context) {
ServerWorld world = context.getWorld();
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setPitch(90.0f);
ItemStack oakSign = world.itematic$createStack(ItemKeys.OAK_SIGN);
NbtComponent.set(DataComponentTypes.BLOCK_ENTITY_DATA, oakSign, nbt -> nbt.putString(Entity.ID_KEY, Registries.BLOCK_ENTITY_TYPE.getId(BlockEntityType.SIGN).toString()));
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, oakSign);
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, oakSign, GROUND_POSITION, Direction.UP);
TestUtil.useBlock(context, GROUND_POSITION, player, Direction.UP);
context.addFinalTaskWithDuration(1, () -> {
Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.OAK_SIGN);
Expand All @@ -71,11 +72,11 @@ public void placingSignWithBlockEntityDataDoesNotOpenSignMenu(TestContext contex
@GameTest(structure = "itematic:item.sign.platform.ceiling")
public void placingHangingSignOpensSignMenu(TestContext context) {
ServerWorld world = context.getWorld();
ItemStack oakHangingSign = world.itematic$createStack(ItemKeys.OAK_HANGING_SIGN);
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, oakHangingSign);
player.setPitch(-90.0f);
player.setStackInHand(Hand.MAIN_HAND, world.itematic$createStack(ItemKeys.OAK_HANGING_SIGN));
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, oakHangingSign, ABOVE_PLACED_BLOCK_POSITION, Direction.DOWN);
TestUtil.useBlock(context, ABOVE_PLACED_BLOCK_POSITION, player, Direction.DOWN);
context.addFinalTask(() -> {
Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.OAK_HANGING_SIGN);
Expand All @@ -93,12 +94,13 @@ public void placingHangingSignOpensSignMenu(TestContext context) {
@SuppressWarnings("DataFlowIssue")
public void placingHangingSignWithBlockEntityDataDoesNotOpenSignMenu(TestContext context) {
ServerWorld world = context.getWorld();
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setPitch(-90.0f);
ItemStack oakHangingSign = world.itematic$createStack(ItemKeys.OAK_HANGING_SIGN);
NbtComponent.set(DataComponentTypes.BLOCK_ENTITY_DATA, oakHangingSign, nbt -> nbt.putString(Entity.ID_KEY, Registries.BLOCK_ENTITY_TYPE.getId(BlockEntityType.SIGN).toString()));
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, oakHangingSign);
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, oakHangingSign, ABOVE_PLACED_BLOCK_POSITION, Direction.DOWN);
TestUtil.useBlock(context, ABOVE_PLACED_BLOCK_POSITION, player, Direction.DOWN);
context.addFinalTaskWithDuration(1, () -> {
Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.OAK_HANGING_SIGN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ public void usingTallGrassOnGroundWhileBlockedOffDoesNotPlaceTallGrass(TestConte
@GameTest(structure = "itematic:item.component.block.platform")
public void usingSkeletonSkullOnGroundPlacesSkeletonSkull(TestContext context) {
ServerWorld world = context.getWorld();
ItemStack skeletonSkull = world.itematic$createStack(ItemKeys.SKELETON_SKULL);
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, skeletonSkull);
player.setPitch(90.0f);
player.setStackInHand(Hand.MAIN_HAND, world.itematic$createStack(ItemKeys.SKELETON_SKULL));
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, skeletonSkull, GROUND_POSITION, Direction.UP);
TestUtil.useBlock(context, GROUND_POSITION, player, Direction.UP);
context.addFinalTask(() -> Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.SKELETON_SKULL));
}
Expand All @@ -132,11 +132,11 @@ public void usingSkeletonSkullOnWallPlacesSkeletonWallSkull(TestContext context)
@GameTest(structure = "itematic:item.component.block.platform.ceiling")
public void usingOakHangingSignOnCeilingPlacesOakHangingSign(TestContext context) {
ServerWorld world = context.getWorld();
ItemStack oakHangingSign = world.itematic$createStack(ItemKeys.OAK_HANGING_SIGN);
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
player.setStackInHand(Hand.MAIN_HAND, oakHangingSign);
player.setPitch(-90.0f);
player.setStackInHand(Hand.MAIN_HAND, world.itematic$createStack(ItemKeys.OAK_HANGING_SIGN));
world.spawnEntity(player);
TestUtil.useStackOnBlockInside(context, player, oakHangingSign, ABOVE_PLACED_BLOCK_POSITION, Direction.DOWN);
TestUtil.useBlock(context, ABOVE_PLACED_BLOCK_POSITION, player, Direction.DOWN);
context.addFinalTask(() -> Assert.blockState(context, PLACED_BLOCK_POSITION)
.is(Blocks.OAK_HANGING_SIGN));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ public class UseableOnFluidItemComponentTestSuite {

@GameTest(structure = "itematic:item.component.useable_on_fluid.water_hole")
public void usingLilyPadWhileLookingAtWaterPlacesLilyPad(TestContext context) {
PlayerEntity player = context.createMockPlayer(GameMode.SURVIVAL);
TestUtil.setEntityPos(context, player, SPAWN_POSITION_ON_LAND);
player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, Vec3d.ofBottomCenter(context.getAbsolutePos(LOOK_AT_WATER_POSITION_ON_LAND)));
PlayerEntity player = TestUtil.createMockPlayer(context, GameMode.SURVIVAL, SPAWN_POSITION_ON_LAND);
player.lookAt(
EntityAnchorArgumentType.EntityAnchor.EYES,
Vec3d.ofBottomCenter(context.getAbsolutePos(LOOK_AT_WATER_POSITION_ON_LAND))
);
ServerWorld world = context.getWorld();
ItemStack lilyPad = world.itematic$createStack(ItemKeys.LILY_PAD);
player.setStackInHand(Hand.MAIN_HAND, lilyPad);
Expand Down
25 changes: 22 additions & 3 deletions src/gametest/java/net/errorcraft/itematic/util/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,18 @@ public static void setEntityPos(TestContext context, Entity entity, BlockPos pos

public static Optional<ItemStack> useStackOnBlockInside(TestContext context, PlayerEntity player, ItemStack stack, BlockPos pos, Direction direction) {
BlockPos absolutePos = context.getAbsolutePos(pos);
BlockHitResult hitResult = new BlockHitResult(Vec3d.ofCenter(absolutePos), direction, absolutePos, true);
ActionResult result = stack.useOnBlock(new ItemUsageContext(player, Hand.MAIN_HAND, hitResult));
ActionResult result = stack.useOnBlock(
new ItemUsageContext(
player,
Hand.MAIN_HAND,
new BlockHitResult(
Vec3d.ofCenter(absolutePos),
direction,
absolutePos,
false
)
)
);
if (result instanceof ActionResult.Success success) {
return Optional.ofNullable(success.getNewHandStack());
}
Expand All @@ -138,7 +148,16 @@ public static Optional<ItemStack> useStackOnBlockInside(TestContext context, Pla

public static void useBlock(TestContext context, BlockPos pos, PlayerEntity player, Direction direction) {
BlockPos absolutePos = context.getAbsolutePos(pos);
context.useBlock(pos, player, new BlockHitResult(Vec3d.ofCenter(absolutePos), direction, absolutePos, true));
context.useBlock(
pos,
player,
new BlockHitResult(
Vec3d.ofCenter(absolutePos),
direction,
absolutePos,
false
)
);
}

@SuppressWarnings("unchecked")
Expand Down
1 change: 0 additions & 1 deletion src/main/generated/data/minecraft/action/light_block.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"action": {
"type": "minecraft:place_block",
"block": "minecraft:fire",
"decrement_count": false,
"position": "interacted"
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/generated/data/minecraft/item/axolotl_bucket.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"behavior": {
"minecraft:bucket": {
"emptying_sound_event": "minecraft:item.bucket.empty_axolotl",
"entity": {
"entity": "minecraft:axolotl",
"require_other_successful_placement": true
},
"fluid": "minecraft:water",
"transforms_into": "minecraft:bucket"
"entity": "minecraft:axolotl",
"modification": {
"type": "minecraft:place_fluid",
"fluid": "minecraft:water",
"place_sound": "minecraft:item.bucket.empty_axolotl",
"transforms_into": "minecraft:bucket"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
4 changes: 3 additions & 1 deletion src/main/generated/data/minecraft/item/bucket.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"behavior": {
"minecraft:bucket": {
"fluid": "minecraft:empty"
"modification": {
"type": "minecraft:drain_fluid"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
14 changes: 7 additions & 7 deletions src/main/generated/data/minecraft/item/cod_bucket.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"behavior": {
"minecraft:bucket": {
"emptying_sound_event": "minecraft:item.bucket.empty_fish",
"entity": {
"entity": "minecraft:cod",
"require_other_successful_placement": true
},
"fluid": "minecraft:water",
"transforms_into": "minecraft:bucket"
"entity": "minecraft:cod",
"modification": {
"type": "minecraft:place_fluid",
"fluid": "minecraft:water",
"place_sound": "minecraft:item.bucket.empty_fish",
"transforms_into": "minecraft:bucket"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
9 changes: 6 additions & 3 deletions src/main/generated/data/minecraft/item/lava_bucket.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"behavior": {
"minecraft:bucket": {
"emptying_sound_event": "minecraft:item.bucket.empty_lava",
"fluid": "minecraft:lava",
"transforms_into": "minecraft:bucket"
"modification": {
"type": "minecraft:place_fluid",
"fluid": "minecraft:lava",
"place_sound": "minecraft:item.bucket.empty_lava",
"transforms_into": "minecraft:bucket"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"behavior": {
"minecraft:bucket": {
"block": "minecraft:powder_snow",
"emptying_sound_event": "minecraft:item.bucket.empty_powder_snow",
"transforms_into": "minecraft:bucket"
"modification": {
"type": "minecraft:place_block",
"block": "minecraft:powder_snow",
"place_sound": "minecraft:item.bucket.empty_powder_snow",
"transforms_into": "minecraft:bucket"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
14 changes: 7 additions & 7 deletions src/main/generated/data/minecraft/item/pufferfish_bucket.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"behavior": {
"minecraft:bucket": {
"emptying_sound_event": "minecraft:item.bucket.empty_fish",
"entity": {
"entity": "minecraft:pufferfish",
"require_other_successful_placement": true
},
"fluid": "minecraft:water",
"transforms_into": "minecraft:bucket"
"entity": "minecraft:pufferfish",
"modification": {
"type": "minecraft:place_fluid",
"fluid": "minecraft:water",
"place_sound": "minecraft:item.bucket.empty_fish",
"transforms_into": "minecraft:bucket"
}
},
"minecraft:dispensable": {
"behavior": "minecraft:use_bucket"
Expand Down
Loading
Loading