Skip to content

Commit

Permalink
Merge pull request #4 from PTOM76/1.17.1
Browse files Browse the repository at this point in the history
1.17.1
  • Loading branch information
PTOM76 committed Sep 20, 2021
2 parents c428c6f + ac204c8 commit cb1f2dc
Show file tree
Hide file tree
Showing 66 changed files with 1,091 additions and 106 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ loader_version=0.11.6

fabric_version=0.40.1+1.17

mod_version = 1.0.1
mod_version = 1.1.0
maven_group = ml.pkom
archives_base_name = EnhancedQuarries-1.17.1
2 changes: 2 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Blocks {

public static Filler NORMAL_FILLER = NormalFiller.getFiller();
public static Filler ENHANCED_FILLER = EnhancedFiller.getFiller();
public static Filler ENHANCED_FILLER_WITH_CHEST = EnhancedFillerWithChest.getFiller();

public static Block NORMAL_MARKER = NormalMarker.getBlock();
public static Block FRAME = Frame.getBlock();
Expand All @@ -25,6 +26,7 @@ public static void init() {

Registry.register(Registry.BLOCK, EnhancedQuarries.id("normal_filler"), NORMAL_FILLER);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("enhanced_filler"), ENHANCED_FILLER);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("enhanced_filler_with_chest"), ENHANCED_FILLER_WITH_CHEST);

Registry.register(Registry.BLOCK, EnhancedQuarries.id("normal_marker"), NORMAL_MARKER);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("frame"), FRAME);
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/ml/pkom/enhancedquarries/EnhancedQuarries.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
package ml.pkom.enhancedquarries;

import ml.pkom.enhancedquarries.tile.Tiles;
import ml.pkom.enhancedquarries.tile.base.FillerTile;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;

public class EnhancedQuarries implements ModInitializer {

public static final String MOD_ID = "enhanced_quarries";
public static final String MOD_NAME = "Enhanced Quarries";
public static final String VERSION = "1.0.1";
public static final String VERSION = "1.1.0";
public static EnhancedQuarries instance;
private static final Logger LOGGER = LogManager.getLogger();

Expand All @@ -34,7 +30,9 @@ public void onInitialize() {
Blocks.init();
Tiles.init();
ScreenHandlers.init();
FillerModules.init();
FillerCraftingPatterns.init();

}

public static void log(Level level, String message){
Expand Down
50 changes: 42 additions & 8 deletions src/main/java/ml/pkom/enhancedquarries/FillerCraftingPatterns.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,51 @@
public class FillerCraftingPatterns {

public static ItemStack BRICKS = create(net.minecraft.item.Items.BRICKS);
public static ItemStack SLAB_BRICKS = create(net.minecraft.item.Items.BRICK_SLAB);
public static ItemStack GLASS = create(net.minecraft.item.Items.GLASS);
public static ItemStack WATER_BUCKET = create(net.minecraft.item.Items.WATER_BUCKET);
public static ItemStack EMPTY = ItemStack.EMPTY;

private static List<FillerCraftingPattern> patterns = new ArrayList<>();

public static List<FillerCraftingPattern> getPatterns() {
return patterns;
}

public static void addPattern(FillerCraftingPattern pattern) {
getPatterns().add(pattern);
}

public static void removePattern(FillerCraftingPattern pattern) {
getPatterns().remove(pattern);
}

public static FillerCraftingPattern getPattern(Item module) {
for (FillerCraftingPattern pattern : getPatterns()) {
if (pattern.getOutput().getItem() == module) {
return pattern;
}
}
return null;
}

public static List<FillerCraftingPattern> patterns = new ArrayList<>();
public static void init() {
patterns.add(FillerCraftingPattern.createFillPattern(create(Items.fillerALL_FILL), BRICKS));
patterns.add(FillerCraftingPattern.createFillPattern(create(Items.fillerALL_REMOVE), GLASS));
patterns.add(FillerCraftingPattern.createDonutPattern(create(Items.fillerALL_DELETE), GLASS));
patterns.add(new FillerCraftingPattern(create(Items.fillerLEVELING), ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, GLASS, GLASS, GLASS, BRICKS, BRICKS, BRICKS));
patterns.add(new FillerCraftingPattern(create(Items.fillerWALL), BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS));
patterns.add(new FillerCraftingPattern(create(Items.fillerBOX), BRICKS, BRICKS, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, BRICKS, BRICKS));
patterns.add(new FillerCraftingPattern(create(Items.fillerTORCH), BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS));
addPattern(FillerCraftingPattern.createFillPattern(create(Items.fillerALL_FILL), BRICKS));
addPattern(FillerCraftingPattern.createFillPattern(create(Items.fillerALL_REMOVE), GLASS));
addPattern(FillerCraftingPattern.createDonutPattern(create(Items.fillerALL_DELETE), GLASS));
addPattern(new FillerCraftingPattern(create(Items.fillerLEVELING), ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, GLASS, GLASS, GLASS, BRICKS, BRICKS, BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerWALL), BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS));
addPattern(FillerCraftingPattern.createDonutPattern(create(Items.fillerBOX), BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerTORCH), BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS, ItemStack.EMPTY, BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerDELETE_FLUID), ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, GLASS, GLASS, GLASS, WATER_BUCKET, WATER_BUCKET, WATER_BUCKET));
addPattern(new FillerCraftingPattern(create(Items.fillerFLOOR_REPLACE), ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, BRICKS, BRICKS, BRICKS, GLASS, GLASS, GLASS));
addPattern(new FillerCraftingPattern(create(Items.fillerTOWER), ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS, BRICKS, ItemStack.EMPTY, BRICKS, BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerVERTICAL_LAYER), SLAB_BRICKS, EMPTY, SLAB_BRICKS, SLAB_BRICKS, EMPTY, SLAB_BRICKS, SLAB_BRICKS, EMPTY, SLAB_BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerHORIZONTAL_LAYER), SLAB_BRICKS, SLAB_BRICKS, SLAB_BRICKS, EMPTY, EMPTY, EMPTY, SLAB_BRICKS, SLAB_BRICKS, SLAB_BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerSTAIRS), EMPTY, EMPTY, BRICKS, EMPTY, BRICKS, BRICKS, BRICKS, BRICKS, BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerPYRAMID), EMPTY, EMPTY, EMPTY, EMPTY, BRICKS, EMPTY, BRICKS, BRICKS, BRICKS));
addPattern(new FillerCraftingPattern(create(Items.fillerCUT_STAIRS), EMPTY, EMPTY, GLASS, EMPTY, GLASS, GLASS, GLASS, GLASS, GLASS));
addPattern(new FillerCraftingPattern(create(Items.fillerCUT_PYRAMID), EMPTY, EMPTY, EMPTY, EMPTY, GLASS, EMPTY, GLASS, GLASS, GLASS));
}

public static ItemStack create(Item item) {
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/FillerModules.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ml.pkom.enhancedquarries;

import ml.pkom.enhancedquarries.registry.Registry;

public class FillerModules {
public static void init() {
Registry.register(EnhancedQuarries.id("vertical_layer"), Items.fillerVERTICAL_LAYER);
Registry.register(EnhancedQuarries.id("horizontal_layer"), Items.fillerHORIZONTAL_LAYER);
Registry.register(EnhancedQuarries.id("tower"), Items.fillerTOWER);
Registry.register(EnhancedQuarries.id("delete_fluid"), Items.fillerDELETE_FLUID);
Registry.register(EnhancedQuarries.id("floor_replace"), Items.fillerFLOOR_REPLACE);
Registry.register(EnhancedQuarries.id("stairs"), Items.fillerSTAIRS);
Registry.register(EnhancedQuarries.id("pyramid"), Items.fillerPYRAMID);
Registry.register(EnhancedQuarries.id("cut_stairs"), Items.fillerCUT_STAIRS);
Registry.register(EnhancedQuarries.id("cut_pyramid"), Items.fillerCUT_PYRAMID);
}
}
77 changes: 0 additions & 77 deletions src/main/java/ml/pkom/enhancedquarries/IInventory.java

This file was deleted.

36 changes: 36 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import ml.pkom.enhancedquarries.item.*;
import ml.pkom.enhancedquarries.item.base.FillerModule;
import ml.pkom.enhancedquarries.item.base.FillerModuleItem;
import ml.pkom.enhancedquarries.item.fillermodule.*;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
Expand All @@ -15,6 +17,7 @@ public class Items {

public static Item NORMAL_FILLER = new BlockItem(Blocks.NORMAL_FILLER, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item ENHANCED_FILLER = new BlockItem(Blocks.ENHANCED_FILLER, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item ENHANCED_FILLER_WITH_CHEST = new BlockItem(Blocks.ENHANCED_FILLER_WITH_CHEST, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));

public static Item NORMAL_MARKER = new BlockItem(Blocks.NORMAL_MARKER, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item FRAME = new BlockItem(Blocks.FRAME, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
Expand All @@ -38,6 +41,27 @@ public class Items {
public static Item fillerWALL = new FillerModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 松明
public static Item fillerTORCH = new FillerModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 垂直レイヤー
public static FillerModuleItem fillerVERTICAL_LAYER = new VerticalLayerModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 平行レイヤー
public static FillerModuleItem fillerHORIZONTAL_LAYER = new HorizontalLayerModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 積み上げ
public static FillerModuleItem fillerTOWER = new TowerModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 液体除去(未実装)
public static FillerModuleItem fillerDELETE_FLUID = new DeleteFluidModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 床張り替え
public static FillerModuleItem fillerFLOOR_REPLACE = new FloorReplaceModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 階段
public static FillerModuleItem fillerSTAIRS = new CreateStairsModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 四角錐
public static FillerModuleItem fillerPYRAMID = new CreatePyramidModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 階段撤去
public static FillerModuleItem fillerCUT_STAIRS = new CutStairsModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
// 四角錐撤去
public static FillerModuleItem fillerCUT_PYRAMID = new CutPyramidModule(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));

// 赤石ハンマー
public static Item REDSTONE_HAMMER = new RedstoneHammer(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));

// 素材
public static Item REFINED_GEAR = new Item(new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
Expand All @@ -53,6 +77,7 @@ public static void init() {

Registry.register(Registry.ITEM, EnhancedQuarries.id("normal_filler"), NORMAL_FILLER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_filler"), ENHANCED_FILLER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_filler_with_chest"), ENHANCED_FILLER_WITH_CHEST);

Registry.register(Registry.ITEM, EnhancedQuarries.id("normal_marker"), NORMAL_MARKER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("frame"), FRAME);
Expand All @@ -70,6 +95,17 @@ public static void init() {
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_create_box"), fillerBOX);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_create_wall"), fillerWALL);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_place_torch"), fillerTORCH);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_vertical_layer"), fillerVERTICAL_LAYER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_horizontal_layer"), fillerHORIZONTAL_LAYER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_tower"), fillerTOWER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_delete_fluid"), fillerDELETE_FLUID);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_floor_replace"), fillerFLOOR_REPLACE);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_create_stairs"), fillerSTAIRS);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_create_pyramid"), fillerPYRAMID);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_cut_stairs"), fillerCUT_STAIRS);
Registry.register(Registry.ITEM, EnhancedQuarries.id("filler_cut_pyramid"), fillerCUT_PYRAMID);

Registry.register(Registry.ITEM, EnhancedQuarries.id("redstone_hammer"), REDSTONE_HAMMER);

Registry.register(Registry.ITEM, EnhancedQuarries.id("refined_gear"), REFINED_GEAR);
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_refined_gear"), ENHANCED_REFINED_GEAR);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/ScreenHandlers.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package ml.pkom.enhancedquarries;

import ml.pkom.enhancedquarries.screen.FillerScreenHandler;
import ml.pkom.enhancedquarries.screen.FillerWithChestScreenHandler;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.minecraft.screen.ScreenHandlerType;

public class ScreenHandlers {
public static ScreenHandlerType<FillerScreenHandler> FILLER_SCREEN_HANDLER_TYPE;
public static ScreenHandlerType<FillerWithChestScreenHandler> FILLER_WITH_CHEST_SCREEN_HANDLER_TYPE;

public static void init() {
FILLER_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(EnhancedQuarries.id("filler"), FillerScreenHandler::new);
FILLER_WITH_CHEST_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(EnhancedQuarries.id("filler_with_chest"), FillerWithChestScreenHandler::new);
}
}
2 changes: 2 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Screens.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ml.pkom.enhancedquarries;

import ml.pkom.enhancedquarries.screen.FillerScreen;
import ml.pkom.enhancedquarries.screen.FillerWithChestScreen;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
Expand All @@ -9,5 +10,6 @@ public class Screens {
@Environment(EnvType.CLIENT)
public static void init() {
ScreenRegistry.register(ScreenHandlers.FILLER_SCREEN_HANDLER_TYPE, FillerScreen::new);
ScreenRegistry.register(ScreenHandlers.FILLER_WITH_CHEST_SCREEN_HANDLER_TYPE, FillerWithChestScreen::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package ml.pkom.enhancedquarries.block;

import ml.pkom.enhancedquarries.block.base.Filler;
import ml.pkom.enhancedquarries.event.TileCreateEvent;
import ml.pkom.enhancedquarries.screen.FillerWithChestScreenHandler;
import ml.pkom.enhancedquarries.tile.EnhancedFillerWithChestTile;
import ml.pkom.enhancedquarries.tile.base.FillerTile;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.SimpleNamedScreenHandlerFactory;
import net.minecraft.text.LiteralText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

public class EnhancedFillerWithChest extends Filler {

public EnhancedFillerWithChest() {
super();
}

@Override
public BlockEntity createBlockEntity(TileCreateEvent event) {
return new EnhancedFillerWithChestTile(event);
}

// instance
public static Filler INSTANCE = new EnhancedFillerWithChest();

public static Filler getInstance() {
return INSTANCE;
}

public static Filler getFiller() {
return getInstance();
}
// ----

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hitResult) {
if (world.isClient())
return ActionResult.SUCCESS;
NamedScreenHandlerFactory namedScreenHandlerFactory = createScreenHandlerFactory(state, world, pos);
if (namedScreenHandlerFactory != null) {
player.openHandledScreen(namedScreenHandlerFactory);
}

return ActionResult.CONSUME;
}

@Nullable
@Override
public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) {
FillerTile fillerTile = (FillerTile) world.getBlockEntity(pos);
return new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> new FillerWithChestScreenHandler(i, playerInventory, fillerTile.getInventory(), fillerTile.getCraftingInventory()), new LiteralText(""));
}
}
Loading

0 comments on commit cb1f2dc

Please sign in to comment.