mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 17:14:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f691d8e588 | ||
|
|
274dd90030 | ||
|
|
3cef725be3 | ||
|
|
47a7aa82b1 | ||
|
|
1e206e4f81 | ||
|
|
10b7c54b02 | ||
|
|
7549707704 | ||
|
|
37a3de11b6 |
No files matched your search
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
dependencies {
|
||||
api('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha51:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha52:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.5-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.6.2:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.multiblock.AlvearyController;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
@@ -36,8 +36,13 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
harmEntities(genome, housing);
|
||||
if (isMobGriefingEnabled(housing)) destroyEnvironment(genome, housing);
|
||||
|
||||
return destroyEnvironment(genome, storedData, housing);
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private boolean isMobGriefingEnabled(IBeeHousing housing) {
|
||||
return housing.getWorld().getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
}
|
||||
|
||||
private void harmEntities(IBeeGenome genome, IBeeHousing housing) {
|
||||
@@ -56,7 +61,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
}
|
||||
}
|
||||
|
||||
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
private static void destroyEnvironment(IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
Random rand = world.rand;
|
||||
|
||||
@@ -65,43 +70,69 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
Vect offset = area.multiply(-1 / 2.0f);
|
||||
Vect posHousing = new Vect(housing.getCoordinates());
|
||||
|
||||
boolean isAlveary = housing instanceof AlvearyController;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(rand, area);
|
||||
Vect posBlock = randomPos.add(posHousing);
|
||||
posBlock = posBlock.add(offset);
|
||||
Vect posBlock = randomPos.add(posHousing).add(offset);
|
||||
|
||||
if (posBlock.y <= 1 || posBlock.y >= housing.getWorld().getActualHeight()) {
|
||||
// Don't destroy blocks in the protected 3x3x4 area if housing is an Alveary.
|
||||
// Stops the bee destroying itself. Silly behaviour.
|
||||
if (isAlveary && isInAlvearyProtectedArea(posHousing, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't destroy ourselves or blocks below us.
|
||||
if (posBlock.x == posHousing.x && posBlock.z == posHousing.z && posBlock.y <= posHousing.y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (world.isAirBlock(posBlock.x, posBlock.y, posBlock.z)) {
|
||||
continue;
|
||||
// Don't destroy the block directly below the bee.
|
||||
if (isAlveary) {
|
||||
if (posBlock.y == posHousing.y - 3) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (posBlock.y == posHousing.y - 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = world.getBlock(posBlock.x, posBlock.y, posBlock.z);
|
||||
|
||||
if (block instanceof BlockAlveary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Never delete a tile entity. Allows far too much griefing and abuse otherwise.
|
||||
TileEntity tile = world.getTileEntity(posBlock.x, posBlock.y, posBlock.z);
|
||||
if (tile instanceof IBeeHousing) {
|
||||
if (tile != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't let us delete blocks that are not supposed to be breakable by players.
|
||||
if (block.getBlockHardness(world, posBlock.x, posBlock.y, posBlock.z) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some mods might use this logic? Idk, just a safety check. Might stop griefing.
|
||||
if (!world.canMineBlock(
|
||||
housing.getWorld().func_152378_a(housing.getOwner().getId()),
|
||||
posHousing.x,
|
||||
posHousing.y,
|
||||
posHousing.z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.setBlockToAir(posBlock.x, posBlock.y, posBlock.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
private static boolean isInAlvearyProtectedArea(Vect posHousing, Vect posBlock) {
|
||||
// Alveary protection area is a 3x3x4 area centered on the top middle, down one block.
|
||||
int startX = posHousing.x - 1;
|
||||
int endX = posHousing.x + 1;
|
||||
int startZ = posHousing.z - 1;
|
||||
int endZ = posHousing.z + 1;
|
||||
int startY = posHousing.y - 2;
|
||||
int endY = posHousing.y + 1;
|
||||
|
||||
return posBlock.x >= startX && posBlock.x <= endX
|
||||
&& posBlock.z >= startZ
|
||||
&& posBlock.z <= endZ
|
||||
&& posBlock.y >= startY
|
||||
&& posBlock.y <= endY;
|
||||
}
|
||||
}
|
||||
@@ -73,9 +73,9 @@ public class Vect implements IVect {
|
||||
}
|
||||
|
||||
public static Vect getRandomPositionInArea(Random random, IVect area) {
|
||||
int x = random.nextInt(area.getX());
|
||||
int y = random.nextInt(area.getY());
|
||||
int z = random.nextInt(area.getZ());
|
||||
int x = random.nextInt(area.getX() + 1);
|
||||
int y = random.nextInt(area.getY() + 1);
|
||||
int z = random.nextInt(area.getZ() + 1);
|
||||
return new Vect(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user