Skip to content

Commit

Permalink
Merge pull request #13 from PTOM76/1.16.5
Browse files Browse the repository at this point in the history
EnhancedQuarry 1.2.0-RC2-2
  • Loading branch information
PTOM76 authored Sep 27, 2021
2 parents 694051c + 6497aaa commit f2f8d63
Show file tree
Hide file tree
Showing 31 changed files with 356 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class Blocks {
public static Quarry ENHANCED_QUARRY = EnhancedQuarry.getQuarry();
public static Quarry FLUID_QUARRY = FluidQuarry.getQuarry();
public static Quarry OPTIMUM_QUARRY = OptimumQuarry.getQuarry();
public static Quarry ENHANCED_OPTIMUM_QUARRY = EnhancedOptimumQuarry.getQuarry();
public static Quarry FLUID_OPTIMUM_QUARRY = FluidOptimumQuarry.getQuarry();

public static Filler NORMAL_FILLER = NormalFiller.getFiller();
public static Filler ENHANCED_FILLER = EnhancedFiller.getFiller();
Expand All @@ -29,6 +31,8 @@ public static void init() {
Registry.register(Registry.BLOCK, EnhancedQuarries.id("enhanced_quarry"), ENHANCED_QUARRY);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("fluid_quarry"), FLUID_QUARRY);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("optimum_quarry"), OPTIMUM_QUARRY);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("enhanced_optimum_quarry"), ENHANCED_OPTIMUM_QUARRY);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("fluid_optimum_quarry"), FLUID_OPTIMUM_QUARRY);

Registry.register(Registry.BLOCK, EnhancedQuarries.id("normal_filler"), NORMAL_FILLER);
Registry.register(Registry.BLOCK, EnhancedQuarries.id("enhanced_filler"), ENHANCED_FILLER);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Items {
public static Item ENHANCED_QUARRY = new BlockItem(Blocks.ENHANCED_QUARRY, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item FLUID_QUARRY = new BlockItem(Blocks.FLUID_QUARRY, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item OPTIMUM_QUARRY = new BlockItem(Blocks.OPTIMUM_QUARRY, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item ENHANCED_OPTIMUM_QUARRY = new BlockItem(Blocks.ENHANCED_OPTIMUM_QUARRY, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));
public static Item FLUID_OPTIMUM_QUARRY = new BlockItem(Blocks.FLUID_OPTIMUM_QUARRY, new FabricItemSettings().group(EnhancedQuarries.FILLER_PLUS_GROUP));

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));
Expand Down Expand Up @@ -80,6 +82,8 @@ public static void init() {
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_quarry"), ENHANCED_QUARRY);
Registry.register(Registry.ITEM, EnhancedQuarries.id("fluid_quarry"), FLUID_QUARRY);
Registry.register(Registry.ITEM, EnhancedQuarries.id("optimum_quarry"), OPTIMUM_QUARRY);
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_optimum_quarry"), ENHANCED_OPTIMUM_QUARRY);
Registry.register(Registry.ITEM, EnhancedQuarries.id("fluid_optimum_quarry"), FLUID_OPTIMUM_QUARRY);

Registry.register(Registry.ITEM, EnhancedQuarries.id("normal_filler"), NORMAL_FILLER);
Registry.register(Registry.ITEM, EnhancedQuarries.id("enhanced_filler"), ENHANCED_FILLER);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/ml/pkom/enhancedquarries/Tiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class Tiles {
public static BlockEntityType<EnhancedQuarryTile> ENHANCED_QUARRY_TILE;
public static BlockEntityType<FluidQuarryTile> FLUID_QUARRY_TILE;
public static BlockEntityType<OptimumQuarryTile> OPTIMUM_QUARRY_TILE;
public static BlockEntityType<EnhancedOptimumQuarryTile> ENHANCED_OPTIMUM_QUARRY_TILE;
public static BlockEntityType<FluidOptimumQuarryTile> FLUID_OPTIMUM_QUARRY_TILE;

public static BlockEntityType<NormalFillerTile> NORMAL_FILLER_TILE;
public static BlockEntityType<EnhancedFillerTile> ENHANCED_FILLER_TILE;
Expand All @@ -26,7 +28,11 @@ public static void init() {
NORMAL_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("normal_quarry_tile"), create(NormalQuarryTile::new, Blocks.NORMAL_QUARRY));
ENHANCED_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("enhanced_quarry_tile"), create(EnhancedQuarryTile::new, Blocks.ENHANCED_QUARRY));
FLUID_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("fluid_quarry_tile"), create(FluidQuarryTile::new, Blocks.FLUID_QUARRY));

OPTIMUM_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("optimum_quarry_tile"), create(OptimumQuarryTile::new, Blocks.OPTIMUM_QUARRY));
ENHANCED_OPTIMUM_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("enhanced_optimum_quarry_tile"), create(EnhancedOptimumQuarryTile::new, Blocks.ENHANCED_OPTIMUM_QUARRY));
FLUID_OPTIMUM_QUARRY_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("fluid_optimum_quarry_tile"), create(FluidOptimumQuarryTile::new, Blocks.FLUID_OPTIMUM_QUARRY));

NORMAL_FILLER_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("normal_filler_tile"), create(NormalFillerTile::new, Blocks.NORMAL_FILLER));
ENHANCED_FILLER_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("enhanced_filler_tile"), create(EnhancedFillerTile::new, Blocks.ENHANCED_FILLER));
ENHANCED_FILLER_WITH_CHEST_TILE = Registry.register(Registry.BLOCK_ENTITY_TYPE, EnhancedQuarries.id("enhanced_filler_with_chest_tile"), create(EnhancedFillerWithChestTile::new, Blocks.ENHANCED_FILLER_WITH_CHEST));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package ml.pkom.enhancedquarries.block;

import ml.pkom.enhancedquarries.block.base.Quarry;
import ml.pkom.enhancedquarries.event.TileCreateEvent;
import ml.pkom.enhancedquarries.tile.EnhancedOptimumQuarryTile;
import ml.pkom.enhancedquarries.tile.OptimumQuarryTile;
import net.minecraft.block.entity.BlockEntity;

public class EnhancedOptimumQuarry extends Quarry {

public EnhancedOptimumQuarry() {
super();
}

// instance
public static Quarry INSTANCE = new EnhancedOptimumQuarry();

public static Quarry getInstance() {
return INSTANCE;
}

public static Quarry getQuarry() {
return getInstance();
}
// ----

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package ml.pkom.enhancedquarries.block;

import ml.pkom.enhancedquarries.block.base.Quarry;
import ml.pkom.enhancedquarries.event.TileCreateEvent;
import ml.pkom.enhancedquarries.tile.EnhancedOptimumQuarryTile;
import ml.pkom.enhancedquarries.tile.FluidOptimumQuarryTile;
import net.minecraft.block.entity.BlockEntity;

public class FluidOptimumQuarry extends Quarry {

public FluidOptimumQuarry() {
super();
}

// instance
public static Quarry INSTANCE = new FluidOptimumQuarry();

public static Quarry getInstance() {
return INSTANCE;
}

public static Quarry getQuarry() {
return getInstance();
}
// ----

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package ml.pkom.enhancedquarries.tile;

import ml.pkom.enhancedquarries.Tiles;
import ml.pkom.enhancedquarries.event.TileCreateEvent;
import net.minecraft.block.entity.BlockEntityType;

public class EnhancedOptimumQuarryTile extends OptimumQuarryTile {

public EnhancedOptimumQuarryTile() {
super(Tiles.ENHANCED_OPTIMUM_QUARRY_TILE);
}

public EnhancedOptimumQuarryTile(BlockEntityType<?> type) {
super(type);
}

public EnhancedOptimumQuarryTile(TileCreateEvent event) {
this();
}

@Override
public double getBasicSpeed() {
return 10;
}

@Override
public void coolTimeBonus() {
super.coolTimeBonus();
if (getBaseMaxPower() / 1.025 < getEnergy()) {
coolTime = coolTime - getBasicSpeed() * 10;
}
if (getBaseMaxPower() / 1.0125 < getEnergy()) {
coolTime = coolTime - getBasicSpeed() * 25;
}
}

@Override
public double getBaseMaxPower() {
return 10000;
}

@Override
public double getBaseMaxInput() {
return super.getBaseMaxInput() * 3;
}

@Override
public double getSettingCoolTime() {
return 200;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ml.pkom.enhancedquarries.tile;

import ml.pkom.enhancedquarries.Tiles;
import ml.pkom.enhancedquarries.event.TileCreateEvent;
import net.minecraft.block.entity.BlockEntityType;

public class FluidOptimumQuarryTile extends EnhancedOptimumQuarryTile {

public FluidOptimumQuarryTile() {
super(Tiles.FLUID_OPTIMUM_QUARRY_TILE);
}

// 継承のため
public FluidOptimumQuarryTile(BlockEntityType<?> type) {
super(type);
}

public FluidOptimumQuarryTile(TileCreateEvent event) {
this();
}

@Override
public boolean canReplaceFluid() {
return true;
}
}
26 changes: 21 additions & 5 deletions src/main/java/ml/pkom/enhancedquarries/tile/OptimumQuarryTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public OptimumQuarryTile(TileCreateEvent event) {
this();
}

boolean finishedQuarry = false;

Integer procX = null;
Integer procY = null;
Integer procZ = null;
Expand All @@ -39,6 +41,7 @@ private boolean continueQuarrying() {

@Override
public boolean tryQuarrying() {
if (finishedQuarry) return true;
if (getWorld() == null || getWorld().isClient()) return false;
if (getPos1() == null)
setPos1(getRangePos1());
Expand All @@ -51,6 +54,10 @@ public boolean tryQuarrying() {
procY = pos2.getY();
procZ = pos1.getZ();
}
if (procY <= 0) {
finishedQuarry = true;
return false;
}
if (pos1.getY() - 1 >= procY) {
if (procX < pos2.getX() - 1) {
if (procZ > pos2.getZ() + 1) {
Expand Down Expand Up @@ -100,12 +107,14 @@ && getEnergy() > getEuPerTick(getReplaceFluidEnergyCost())) {
return true;
}
} else {
procZ = getPos1().getZ();
procZ = getPos1().getZ() - 1;
procZ++; // continue先でprocZ--されるためここで追加しておく。
procX++;
return continueQuarrying();
}
} else {
procX = getPos1().getX();
procX = getPos1().getX() + 1;
procZ++;
procY--;
return continueQuarrying();
}
Expand Down Expand Up @@ -147,16 +156,21 @@ && getEnergy() > getEuPerTick(getReplaceFluidEnergyCost())) {
}
if (procBlock instanceof Frame) return continueQuarrying();
breakBlock(procPos, false);
procZ--;
return true;
} else {
procZ = getPos1().getZ() + 1;
procZ = getPos1().getZ();
procX++;
procZ++;
return continueQuarrying();
}
} else {
procX = getPos1().getX() - 1;
procX = getPos1().getX();
procZ++;
procY--;
if (pos1.getY() - 1 >= procY) {
procX = pos1.getX() + 1;
procZ = pos1.getZ() - 1;
}
return continueQuarrying();
}
}
Expand All @@ -170,6 +184,7 @@ public NbtCompound writeNbt(NbtCompound tag) {
if (procY != null) procPos.putInt("y", procY);
if (procZ != null) procPos.putInt("z", procZ);
tag.put("procPos", procPos);
tag.putBoolean("finished", finishedQuarry);
return super.writeNbt(tag);
}

Expand All @@ -181,5 +196,6 @@ public void fromTag(BlockState blockState, NbtCompound tag) {
if (procPos.contains("x")) procX = procPos.getInt("x");
if (procPos.contains("y")) procY = procPos.getInt("y");
if (procPos.contains("z")) procZ = procPos.getInt("z");
if (tag.contains("finished")) finishedQuarry = tag.getBoolean("finished");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"variants": {
"facing=north": {"model": "enhanced_quarries:block/enhanced_optimum_quarry", "y": 0},
"facing=east": {"model": "enhanced_quarries:block/enhanced_optimum_quarry", "y": 90},
"facing=south": {"model": "enhanced_quarries:block/enhanced_optimum_quarry", "y": 180},
"facing=west": {"model": "enhanced_quarries:block/enhanced_optimum_quarry", "y": 270}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"variants": {
"facing=north": {"model": "enhanced_quarries:block/fluid_optimum_quarry", "y": 0},
"facing=east": {"model": "enhanced_quarries:block/fluid_optimum_quarry", "y": 90},
"facing=south": {"model": "enhanced_quarries:block/fluid_optimum_quarry", "y": 180},
"facing=west": {"model": "enhanced_quarries:block/fluid_optimum_quarry", "y": 270}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/enhanced_quarries/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"block.enhanced_quarries.enhanced_quarry": "Enhanced Quarry",
"block.enhanced_quarries.fluid_quarry": "Fluid Delete Type Quarry",
"block.enhanced_quarries.optimum_quarry": "Optimum Process Quarry",
"block.enhanced_quarries.enhanced_optimum_quarry": "Enhanced Optimum Process Quarry",
"block.enhanced_quarries.fluid_optimum_quarry": "Fluid Delete Type Optimum Process Quarry",
"block.enhanced_quarries.normal_pump": "Normal Pump",
"block.enhanced_quarries.enhanced_pump": "Enhanced Pump",

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/enhanced_quarries/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"block.enhanced_quarries.enhanced_quarry": "強化型クァーリー",
"block.enhanced_quarries.fluid_quarry": "液体除去型クァーリー",
"block.enhanced_quarries.optimum_quarry": "軽量処理クァーリー",
"block.enhanced_quarries.enhanced_optimum_quarry": "強化型軽量処理クァーリー",
"block.enhanced_quarries.fluid_optimum_quarry": "液体除去型軽量処理クァーリー",
"block.enhanced_quarries.normal_pump": "ノーマル ポンプ",
"block.enhanced_quarries.enhanced_pump": "強化型ポンプ",

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/enhanced_quarries/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"block.enhanced_quarries.enhanced_quarry": "Улучшенный карьер",
"block.enhanced_quarries.fluid_quarry": "Карьер для удаления жидкости",
"block.enhanced_quarries.optimum_quarry": "Optimum Process Quarry",
"block.enhanced_quarries.enhanced_optimum_quarry": "Улучшенный Optimum Process Quarry",
"block.enhanced_quarries.fluid_optimum_quarry": " Карьер для удаления Optimum Process Quarry",
"block.enhanced_quarries.normal_pump": "Обычная помпа",
"block.enhanced_quarries.enhanced_pump": "Улучшенная помпа",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"particle": "enhanced_quarries:block/enhanced_optimum_quarry/side",
"down": "enhanced_quarries:block/enhanced_optimum_quarry/side",
"up": "enhanced_quarries:block/enhanced_optimum_quarry/top",
"north": "enhanced_quarries:block/enhanced_optimum_quarry/front",
"east": "enhanced_quarries:block/enhanced_optimum_quarry/side",
"south": "enhanced_quarries:block/enhanced_optimum_quarry/side",
"west": "enhanced_quarries:block/enhanced_optimum_quarry/side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"particle": "enhanced_quarries:block/fluid_optimum_quarry/side",
"down": "enhanced_quarries:block/fluid_optimum_quarry/side",
"up": "enhanced_quarries:block/fluid_optimum_quarry/top",
"north": "enhanced_quarries:block/fluid_optimum_quarry/front",
"east": "enhanced_quarries:block/fluid_optimum_quarry/side",
"south": "enhanced_quarries:block/fluid_optimum_quarry/side",
"west": "enhanced_quarries:block/fluid_optimum_quarry/side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "enhanced_quarries:block/enhanced_optimum_quarry"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "enhanced_quarries:block/fluid_optimum_quarry"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "enhanced_quarries:enhanced_optimum_quarry"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Loading

0 comments on commit f2f8d63

Please sign in to comment.