Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master—' into master—
Browse files Browse the repository at this point in the history
  • Loading branch information
Lithewings committed Jul 25, 2024
1 parent 27fff45 commit 16a290e
Show file tree
Hide file tree
Showing 121 changed files with 4,058 additions and 203 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 1.21 2024-07-21T05:39:39.9208483 MITEequilibrium/Language (zh_cn)
582122e265b4c630127b356fab100a52fa8e8686 assets\miteequilibrium\lang\zh_cn.json
40 changes: 0 additions & 40 deletions src/main/generated/.cache/8ce55c2d46c78681d7eebf7cad72e9c2de67a045

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/com/equilibrium/ITimeCraftPlayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.equilibrium;

import net.minecraft.item.ItemStack;

public interface ITimeCraftPlayer {

void craftTime$setCrafting(boolean is_crafting);

boolean craftTime$isCrafting();

void craftTime$setCraftTime(float craft_time);

float craftTime$getCraftTime();

void craftTime$setCraftPeriod(float craft_period);

float craftTime$getCraftPeriod();

void craftTime$stopCraft();

void craftTime$startCraftWithNewPeriod(float craft_period);

boolean craftTime$tick(ItemStack resultStack);

}
46 changes: 46 additions & 0 deletions src/main/java/com/equilibrium/MITEequilibrium.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,29 @@
import com.equilibrium.item.Tools;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.equilibrium.config.Config;
import com.equilibrium.register.BlockEnityRegistry;
import com.equilibrium.register.BlockInit;
import com.equilibrium.register.UseBlock;
import com.equilibrium.sound.SoundEventRegistry;
import com.equilibrium.util.CreativeGroup;
import com.equilibrium.worklevel.CraftingIngredients;
import com.equilibrium.worklevel.FurnaceIngredients;










import static com.equilibrium.entity.ModEntities.registerModEntities;
import static com.equilibrium.util.LootTableModifier.modifierLootTables;

Expand All @@ -24,6 +44,7 @@ public class MITEequilibrium implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);


public static Config config;



Expand Down Expand Up @@ -62,6 +83,31 @@ public void onInitialize() {
//注册事件
PlayerBlockBreakEvents.AFTER.register(new BreakBlockEvent());



config = new Config();
config.load();

BlockInit.registerBlocks();
BlockInit.registerBlockItems();
BlockInit.registerFuels();

BlockEnityRegistry.init();
CraftingIngredients.init();
FurnaceIngredients.initFuel();
FurnaceIngredients.initItem();

CreativeGroup.addGroup();
UseBlock.init();
Registry.register(Registries.SOUND_EVENT, SoundEventRegistry.finishSoundID, SoundEventRegistry.finishSound);








LOGGER.info("Hello Fabric world!");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.equilibrium;

import com.equilibrium.gen.ModLanguageTranslatorZhCn;
import com.equilibrium.gen.ModModelProvider;
import com.equilibrium.gen.ModRecipeGenerator;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.data.DataGenerator;

public class MITEequilibriumDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator){
FabricDataGenerator.Pack pack=fabricDataGenerator.createPack();
// pack.addProvider(ModRecipeGenerator::new);
pack.addProvider(ModModelProvider::new);

// pack.addProvider(ModModelProvider::new);
pack.addProvider(ModLanguageTranslatorZhCn::new);
}
}
57 changes: 57 additions & 0 deletions src/main/java/com/equilibrium/block/TheCraftingTableBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.equilibrium.block;


import com.equilibrium.register.BlockInit;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CraftingTableBlock;
import net.minecraft.screen.CraftingScreenHandler;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.SimpleNamedScreenHandlerFactory;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class TheCraftingTableBlock extends CraftingTableBlock {
public static Text TITLE = Text.translatable("container.crafting");
public static Text TITLE1 = Text.translatable("container.flint_crafting");
public static Text TITLE2 = Text.translatable("container.copper_crafting");
public static Text TITLE3 = Text.translatable("container.iron_crafting");
public static Text TITLE4 = Text.translatable("container.diamond_crafting");
public static Text TITLE5 = Text.translatable("container.netherite_crafting");

public TheCraftingTableBlock(Settings settings) {
super(settings);
}

public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) {
Block block = state.getBlock();
if(block == BlockInit.FLINT_CRAFTING_TABLE){
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE1);

}else if(block == BlockInit.COPPER_CRAFTING_TABLE){
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE2);
}else if(block == BlockInit.IRON_CRAFTING_TABLE){
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE3);
}else if(block == BlockInit.DIAMOND_CRAFTING_TABLE){
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE4);
}else if(block == BlockInit.NETHERITE_CRAFTING_TABLE){
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE5);
}else {
return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> {
return new CraftingScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos));
}, TITLE);
}
}
}
Loading

0 comments on commit 16a290e

Please sign in to comment.