Skip to content

Commit

Permalink
修复配方问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Mar 13, 2024
1 parent c69007f commit a44d568
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import com.google.gson.GsonBuilder;
import com.mojang.logging.LogUtils;
import dev.dubhe.anvilcraft.api.event.EventManager;
import dev.dubhe.anvilcraft.api.log.Logger;
import dev.dubhe.anvilcraft.api.network.Networking;
import dev.dubhe.anvilcraft.init.*;
import dev.dubhe.anvilcraft.init.ModBlockEntities;
import dev.dubhe.anvilcraft.config.AnvilCraftConfig;
import dev.dubhe.anvilcraft.api.log.Logger;
import dev.dubhe.anvilcraft.init.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -18,7 +17,6 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;

public class AnvilCraft implements ModInitializer {
public static final String MOD_ID = "anvilcraft";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private boolean dropItem(Direction direction, Level level, @NotNull BlockPos pos
Container outContainer = HopperBlockEntity.getContainerAt(level, pos.relative(direction));
if (null == outContainer) {
BlockPos out = pos.relative(direction);
Vec3 vec3 = out.getCenter().relative(direction, -0.5);
Vec3 vec3 = out.getCenter().relative(direction, -0.375);
Vec3 move = out.getCenter().subtract(vec3);
ItemEntity entity = new ItemEntity(level, vec3.x, vec3.y, vec3.z, item, move.x, move.y, move.z);
return level.addFreshEntity(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ public static void buildRecipes(Consumer<FinishedRecipe> exporter) {
.unlockedBy(MyRecipesGenerator.hasItem(ModItems.MAGNET_INGOT), FabricRecipeProvider.has(ModItems.MAGNET_INGOT))
.unlockedBy(MyRecipesGenerator.hasItem(Items.IRON_INGOT), FabricRecipeProvider.has(Items.IRON_INGOT))
.save(exporter);
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ModItems.MAGNET_BLOCK)
.pattern("AAA")
.pattern("AAA")
.pattern("AAA")
.define('A', ModItems.MAGNET_INGOT)
.unlockedBy(MyRecipesGenerator.hasItem(ModItems.MAGNET_INGOT), FabricRecipeProvider.has(ModItems.MAGNET_INGOT))
.save(exporter);
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ModItems.HOLLOW_MAGNET_BLOCK)
.pattern("AAA")
.pattern("A A")
.pattern("AAA")
.define('A', ModItems.MAGNET_INGOT)
.unlockedBy(MyRecipesGenerator.hasItem(ModItems.MAGNET_INGOT), FabricRecipeProvider.has(ModItems.MAGNET_INGOT))
.save(exporter);
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ModItems.MAGNET)
.pattern(" A ")
.pattern("BCB")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.function.BooleanSupplier;

@Mixin(MinecraftServer.class)
@Mixin(value = MinecraftServer.class)
public abstract class MinecraftServerMixin {
@Shadow
private MinecraftServer.ReloadableResources resources;
Expand Down Expand Up @@ -61,7 +61,7 @@ private void afterShutdownServer(CallbackInfo info) {
AnvilCraft.EVENT_BUS.post(new ServerStoppedEvent(server));
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;tickChildren(Ljava/util/function/BooleanSupplier;)V"), method = "tickServer")
@Inject(method = "tickServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;tickChildren(Ljava/util/function/BooleanSupplier;)V"))
private void onStartTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) {
AnvilCraft.EVENT_BUS.post(new ServerStartTickEvent(server));
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dev.dubhe.anvilcraft.data.generator.AnvilCraftDataGenerator"
]
},
"accessWidener" : "anvilcraft.accesswidener",
"mixins": [
"anvilcraft.mixins.json"
],
Expand Down

0 comments on commit a44d568

Please sign in to comment.