This commit is contained in:
叁玖领域 2024-09-25 18:04:13 +08:00
parent 5f089de75f
commit 94c0883c34
10 changed files with 139 additions and 35 deletions

View File

@ -167,7 +167,7 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.2-40.1.54'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
implementation files("lib/modernlife.jar")
compileOnly files("lib/modernlife.jar")
// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency

View File

@ -10,7 +10,7 @@ import static com.r3944realms.modernlifepatch.ModernLifePatch.MOD_ID;
public class ModernLifePatch {
public static final String MOD_ID = "modernlifepatch";
public static final Logger logger = LoggerFactory.getLogger(ModernLifePatch.class);
ModernLifePatch() {
public ModernLifePatch() {
logger.info("ModernLifePatch loaded");
}
}

View File

@ -0,0 +1,22 @@
package com.r3944realms.modernlifepatch.datagen;
import com.r3944realms.modernlifepatch.datagen.provider.ModRecipeProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.models.blockstates.BlockStateGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
import static com.r3944realms.modernlifepatch.ModernLifePatch.MOD_ID;
@Mod.EventBusSubscriber(modid = MOD_ID)
public class DataGeneratorHandler {
@SubscribeEvent
public void generatorDataEvent(GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
generator.addProvider(new ModRecipeProvider(generator));
}
}

View File

@ -0,0 +1,26 @@
package com.r3944realms.modernlifepatch.datagen.provider;
import com.dairymoose.modernlife.core.CustomBlocks;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.world.item.Items;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
public class ModRecipeProvider extends RecipeProvider {
public ModRecipeProvider(DataGenerator pGenerator) {
super(pGenerator);
}
@Override
protected void buildCraftingRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
ShapelessRecipeBuilder.shapeless(CustomBlocks.ITEM_BULLET.get(), 4)
.requires(Items.COPPER_INGOT, 1)
.requires(Items.GUNPOWDER, 1)
.unlockedBy("has_gunpowder", has(Items.GUNPOWDER))
.save(consumer);
}
}

View File

@ -8,9 +8,7 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

View File

@ -29,40 +29,27 @@ public abstract class MixinStove extends StandardHorizontalBlock implements Enti
Block.box(0, 8, 15, 16, 10, 16),
Block.box(13, 2, 15, 16, 8, 16),
Block.box(0, 2, 15, 3, 8, 16),
Block.box(2, 9, 16, 2, 10, 17),
Block.box(14, 9, 16, 14, 10, 17),
Block.box(2, 9, 17, 14, 10, 18),
Block.box(3, 2, 16, 13, 8, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(),
Block.box(0, 0, 0, 16, 2, 15),
Block.box(0, 9, 0, 16, 13, 15),
Block.box(0, 13, 0, 16, 16, 2),
Block.box(0, 10, 15, 16, 13, 16),
Block.box(3, 2, 0, 13, 9, 3),
Block.box(13, 2, 0, 16, 9, 15),
Block.box(0, 2, 0, 3, 9, 15),
Block.box(3, 6, 3, 13, 6, 14),
Block.box(3, 3, 3, 13, 3, 14)
Block.box(0, 0, 0, 16, 2, 15),
Block.box(0, 9, 0, 16, 13, 15),
Block.box(0, 13, 0, 16, 16, 2),
Block.box(0, 10, 15, 16, 13, 16),
Block.box(3, 2, 0, 13, 9, 3),
Block.box(13, 2, 0, 16, 9, 15),
Block.box(0, 2, 0, 3, 9, 15),
Block.box(3, 6, 3, 13, 6, 14),
Block.box(3, 3, 3, 13, 3, 14)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(), SHAPE_E, SHAPE_S, SHAPE_W,
SHAPE_N_O = Stream.of(
Stream.of(
Block.box(0, 0, 15, 16, 1, 17),
Block.box(0, 0, 23, 16, 1, 25),
Block.box(13, 0, 17, 16, 1, 23),
Block.box(0, 0, 17, 3, 1, 23),
Block.box(2, -1, 24, 2, 0, 25),
Block.box(14, -1, 24, 14, 0, 25),
Block.box(2, -2, 24, 14, -1, 25),
Block.box(3, 0.099, 17, 13, 0.099, 23)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(),
Block.box(0, 0, 0, 16, 2, 15),
Block.box(0, 9, 0, 16, 13, 15),
Block.box(0, 13, 0, 16, 16, 2),
Block.box(0, 10, 15, 16, 13, 16),
Block.box(3, 2, 0, 13, 9, 3),
Block.box(13, 2, 0, 16, 9, 15),
Block.box(0, 2, 0, 3, 9, 15)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(), SHAPE_E_O, SHAPE_S_O, SHAPE_W_O;
Block.box(0, 0, 0, 16, 2, 15),
Block.box(0, 9, 0, 16, 13, 15),
Block.box(0, 13, 0, 16, 16, 2),
Block.box(0, 10, 15, 16, 13, 16),
Block.box(3, 2, 0, 13, 9, 3),
Block.box(13, 2, 0, 16, 9, 15),
Block.box(0, 2, 0, 3, 9, 15)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(), SHAPE_E_O, SHAPE_S_O, SHAPE_W_O;
static {
SHAPE_E = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_N);
SHAPE_S = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_E);

View File

@ -0,0 +1,27 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
}
],
"result": {
"item": "modernlife:bullet_strip",
"count": 1
}
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"###",
"###"
],
"key": {
"#": {
"item": "modernlife:bullet"
}
},
"result": {
"item": "modernlife:extended_gun_magazine",
"count": 1
}
}

View File

@ -0,0 +1,27 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
},
{
"item": "modernlife:bullet"
}
],
"result": {
"item": "modernlife:gun_magazine",
"count": 1
}
}

View File

@ -2,7 +2,7 @@
"required": true,
"package": "com.r3944realms.modernlifepatch.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "imodhelper.refmap.json",
"refmap": "modernlifepatch.refmap.json",
"mixins": [
"block.bathroom.MixinShowerHead",
"block.bathroom.MixinToilet",