mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-08 12:44:44 +00:00
Merge pull request #9 from repo-alt/1.7-final
Infused seeds harvest fix by @Barokko
This commit is contained in:
3 files changed
+53
-21
No files matched your search
+2
-11
@@ -3,29 +3,20 @@ buildscript {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
url = "https://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
maven {
|
||||
url 'https://plugins.gradle.org/m2/'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
classpath 'com.gradle:build-scan-plugin:1.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.gradle.build-scan'
|
||||
apply plugin: 'forge'
|
||||
|
||||
buildScan {
|
||||
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
|
||||
licenseAgree = 'yes'
|
||||
}
|
||||
apply plugin: 'idea'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
#Mon Feb 10 03:20:59 MSK 2020
|
||||
#Wed Sep 02 15:08:51 MSK 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -39,6 +39,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
public static final int BREEDING_CHANCE = 10;
|
||||
private IIcon[][] icons;
|
||||
private TileInfusedGrain tileEntity;
|
||||
|
||||
//Returns 0-5 for primal aspects, or 6 if compound aspect
|
||||
public static int getNumberFromAspectForTexture(Aspect aspect) {
|
||||
@@ -115,9 +116,11 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileInfusedGrain) {
|
||||
tileEntity = (TileInfusedGrain)tile;
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,9 +131,12 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
Random rand = new Random();
|
||||
int count = 1;
|
||||
for (int i = 0; i < count; i++) {
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
ItemStack seedStack = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class));
|
||||
ItemInfusedSeeds.setAspect(seedStack, getAspectDropped(world, x, y, z, metadata));
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, ((TileInfusedGrain) world.getTileEntity(x, y, z)).primalTendencies);
|
||||
if (tileGrain != null) {
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, tileGrain.primalTendencies);
|
||||
}
|
||||
while (rand.nextInt(10000) < Math.pow(getPrimalTendencyCount(world, x, y, z, Aspect.ENTROPY), 2)) {
|
||||
seedStack.stackSize++;
|
||||
}
|
||||
@@ -139,24 +145,28 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
ItemStack retItem=AspectCropLootManager.getLootForAspect(getAspect(world, x, y, z));
|
||||
Aspect aspect = getAspectSafe(world, x, y, z);
|
||||
ItemStack retItem=AspectCropLootManager.getLootForAspect(aspect);
|
||||
if(retItem!=null)
|
||||
ret.add(retItem);
|
||||
|
||||
} while (world.rand.nextInt(75) < getPrimalTendencyCount(world, x, y, z, Aspect.ORDER));
|
||||
}
|
||||
tileEntity = null;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getPrimalTendencyCount(World world, int x, int y, int z, Aspect aspect) {
|
||||
return world.getTileEntity(x, y, z) instanceof TileInfusedGrain ? ((TileInfusedGrain) world.getTileEntity(x, y, z)).primalTendencies.getAmount(aspect) : 0;
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
return tileGrain != null ? tileGrain.primalTendencies.getAmount(aspect) : 0;
|
||||
}
|
||||
|
||||
private void fertilizeSoil(World world, int x, int y, int z, int metadata) {
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList.add(currentAspect, 1);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).reduceSaturatedAspects();
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
@@ -173,7 +183,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
public Aspect getAspectDropped(World world, int x, int y, int z, int metadata) {
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
if (metadata >= 7 && currentAspect != null) {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
AspectList farmlandAspectList = ((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList;
|
||||
@@ -240,4 +250,35 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return null;
|
||||
}
|
||||
|
||||
private TileInfusedGrain getTileEntitySafe(World world, int x, int y, int z)
|
||||
{
|
||||
if (tileEntity != null) {
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain)
|
||||
{
|
||||
return (TileInfusedGrain)tile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Aspect getAspectSafe(World world, int x, int y, int z) {
|
||||
if (tileEntity != null) {
|
||||
return tileEntity.aspect;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain)
|
||||
{
|
||||
return ((TileInfusedGrain)tile).aspect;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user