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 {
jcenter()
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
@ -22,7 +21,7 @@ compileJava {
}
minecraft {
version = "1.12.2-14.23.5.2824"
version = "1.12.2-14.23.5.2847"
runDir = "run"
// 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.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

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

@ -449,6 +449,9 @@ public class TileEnderQuarry
if(toBeMined == Blocks.BEDROCK)
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)))
{
return true;
@ -493,17 +496,31 @@ public class TileEnderQuarry
try
{
boolean flag;
Object i = new ArrayList();
//check if item has inventory storage capability
//if so, extract items
TileEntity tile = this.world.getTileEntity(miningPos);
System.out.println("Tile at " + miningPos + ": " + tile);
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP))
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))
{
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)))
{
int j = 0;