Fixed issue #3 (hopefully)

This commit is contained in:
avlad171 2022-05-29 23:31:21 +03:00
parent 8f13b28ebf
commit 930c3185eb
4 changed files with 31 additions and 18 deletions

@ -2,7 +2,6 @@ buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url = "https://files.minecraftforge.net/maven" } maven { url = "https://files.minecraftforge.net/maven" }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
@ -22,7 +21,7 @@ compileJava {
} }
minecraft { minecraft {
version = "1.12.2-14.23.5.2824" version = "1.12.2-14.23.5.2847"
runDir = "run" runDir = "run"
// the mappings can be changed at any time, and must be in the following format. // the mappings can be changed at any time, and must be in the following format.

@ -1,4 +1,3 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process. # This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

@ -43,23 +43,23 @@ public class InitBlocks {
private static void init_upgrades() private static void init_upgrades()
{ {
upgradeVoid = new UpgradeBlock("upgradevoid", 1); upgradeVoid = new UpgradeBlock("upgradevoid", 1);
ForgeRegistries.BLOCKS.register(upgradeVoid); //ForgeRegistries.BLOCKS.register(upgradeVoid);
upgradeSilk = new UpgradeBlock("upgradesilk", 2); upgradeSilk = new UpgradeBlock("upgradesilk", 2);
ForgeRegistries.BLOCKS.register(upgradeSilk); //ForgeRegistries.BLOCKS.register(upgradeSilk);
upgradeFortune1 = new UpgradeBlock("upgradefortunei", 3); upgradeFortune1 = new UpgradeBlock("upgradefortunei", 3);
ForgeRegistries.BLOCKS.register(upgradeFortune1); //ForgeRegistries.BLOCKS.register(upgradeFortune1);
upgradeFortune2 = new UpgradeBlock("upgradefortuneii", 4); upgradeFortune2 = new UpgradeBlock("upgradefortuneii", 4);
ForgeRegistries.BLOCKS.register(upgradeFortune2); //ForgeRegistries.BLOCKS.register(upgradeFortune2);
upgradeFortune3 = new UpgradeBlock("upgradefortuneiii", 5); upgradeFortune3 = new UpgradeBlock("upgradefortuneiii", 5);
ForgeRegistries.BLOCKS.register(upgradeFortune3); //ForgeRegistries.BLOCKS.register(upgradeFortune3);
upgradeSpeed1 = new UpgradeBlock("upgradespeedi", 6); upgradeSpeed1 = new UpgradeBlock("upgradespeedi", 6);
ForgeRegistries.BLOCKS.register(upgradeSpeed1); //ForgeRegistries.BLOCKS.register(upgradeSpeed1);
upgradeSpeed2 = new UpgradeBlock("upgradespeedii", 7); upgradeSpeed2 = new UpgradeBlock("upgradespeedii", 7);
ForgeRegistries.BLOCKS.register(upgradeSpeed2); //ForgeRegistries.BLOCKS.register(upgradeSpeed2);
upgradeSpeed3 = new UpgradeBlock("upgradespeediii", 8); upgradeSpeed3 = new UpgradeBlock("upgradespeediii", 8);
ForgeRegistries.BLOCKS.register(upgradeSpeed3); //ForgeRegistries.BLOCKS.register(upgradeSpeed3);
upgradePump = new UpgradeBlock("upgradepump", 9); upgradePump = new UpgradeBlock("upgradepump", 9);
ForgeRegistries.BLOCKS.register(upgradePump); //ForgeRegistries.BLOCKS.register(upgradePump);
itemUpgradeVoid = new ItemBlock(upgradeVoid); itemUpgradeVoid = new ItemBlock(upgradeVoid);
itemUpgradeVoid.setRegistryName(upgradeVoid.getRegistryName()); itemUpgradeVoid.setRegistryName(upgradeVoid.getRegistryName());
@ -102,7 +102,6 @@ public class InitBlocks {
@SubscribeEvent @SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) public static void registerBlocks(RegistryEvent.Register<Block> event)
{ {
//event.getRegistry().registerAll(tutorialBlock);
ForgeRegistries.BLOCKS.register(enderQuarry); ForgeRegistries.BLOCKS.register(enderQuarry);
ForgeRegistries.BLOCKS.register(enderMarker); ForgeRegistries.BLOCKS.register(enderMarker);
ForgeRegistries.BLOCKS.register(upgradeVoid); ForgeRegistries.BLOCKS.register(upgradeVoid);
@ -119,7 +118,6 @@ public class InitBlocks {
@SubscribeEvent @SubscribeEvent
public static void registerItemBlocks(RegistryEvent.Register<Item> event) public static void registerItemBlocks(RegistryEvent.Register<Item> event)
{ {
//event.getRegistry().registerAll(new ItemBlock(tutorialBlock).setRegistryName(tutorialBlock.getRegistryName()));
ForgeRegistries.ITEMS.register(itemEnderQuarry); ForgeRegistries.ITEMS.register(itemEnderQuarry);
ForgeRegistries.ITEMS.register(itemEnderMarker); ForgeRegistries.ITEMS.register(itemEnderMarker);
ForgeRegistries.ITEMS.register(itemUpgradeVoid); ForgeRegistries.ITEMS.register(itemUpgradeVoid);

@ -449,6 +449,9 @@ public class TileEnderQuarry
if(toBeMined == Blocks.BEDROCK) if(toBeMined == Blocks.BEDROCK)
return true; return true;
if (replaceWithDirt && toBeMined == Blocks.DIRT)
return true;
if (replaceWithDirt && (toBeMined.isLeaves(toBeMinedState, this.world, miningPos) || toBeMined.isFoliage(this.world, miningPos) || toBeMined.isWood(this.world, miningPos) || (toBeMined instanceof IPlantable) || (toBeMined instanceof IGrowable))) if (replaceWithDirt && (toBeMined.isLeaves(toBeMinedState, this.world, miningPos) || toBeMined.isFoliage(this.world, miningPos) || toBeMined.isWood(this.world, miningPos) || (toBeMined instanceof IPlantable) || (toBeMined instanceof IGrowable)))
{ {
return true; return true;
@ -493,17 +496,31 @@ public class TileEnderQuarry
try try
{ {
boolean flag; boolean flag;
Object i = new ArrayList();
//check if item has inventory storage capability //check if item has inventory storage capability
//if so, extract items //if so, extract items
TileEntity tile = this.world.getTileEntity(miningPos); TileEntity tile = this.world.getTileEntity(miningPos);
System.out.println("Tile at " + miningPos + ": " + tile); if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP))
{ {
System.out.println("Found inventory containing tile at " + miningPos); System.out.println("Found inventory containing tile at " + miningPos);
//list inventory entries
IItemHandler inv = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
for (int j = 0; j < inv.getSlots(); ++j)
{
if (inv.getStackInSlot(j).isEmpty())
continue;
System.out.println("[Ender quarry] Extracting from inventory slot " + j + " " + inv.getStackInSlot(j));
int cnt = inv.getStackInSlot(j).getCount();
//add the items in inventory to the quarry
((ArrayList)i).add(inv.extractItem(j, cnt, false));
}
} }
Object i = new ArrayList();
if ((digType.isSilkTouch()) && (toBeMined.canSilkHarvest(this.world, miningPos, toBeMinedState, fakePlayer))) if ((digType.isSilkTouch()) && (toBeMined.canSilkHarvest(this.world, miningPos, toBeMinedState, fakePlayer)))
{ {
int j = 0; int j = 0;