mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Added Primus Loci.
This commit is contained in:
1 parent
78609232de
commit
31c42e9703
12 files changed
+135
-5
No files matched your search
@@ -464,10 +464,12 @@ public final class ModBlocks {
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
|
||||
|
||||
registerSubTileWithDecor(LibBlockNames.SUBTILE_DAYBLOOM, SubTileDaybloom.class, SubTileDecor.Daybloom.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAYBLOOM_PRIME, SubTileDaybloom.Prime.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ENDOFLAME, SubTileEndoflame.class);
|
||||
registerSubTileWithDecor(LibBlockNames.SUBTILE_HYDROANGEAS, SubTileHydroangeas.class, SubTileDecor.Hydroangeas.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_THERMALILY, SubTileThermalily.class);
|
||||
registerSubTileWithDecor(LibBlockNames.SUBTILE_NIGHTSHADE, SubTileNightshade.class, SubTileDecor.Nightshade.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NIGHTSHADE_PRIME, SubTileNightshade.Prime.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ARCANE_ROSE, SubTileArcaneRose.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MUNCHDEW, SubTileMunchdew.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ENTROPINNYUM, SubTileEntropinnyum.class);
|
||||
|
||||
@@ -11,22 +11,58 @@
|
||||
package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
|
||||
private static final String TAG_PRIME_POSITION_X = "primePositionX";
|
||||
private static final String TAG_PRIME_POSITION_Y = "primePositionY";
|
||||
private static final String TAG_PRIME_POSITION_Z = "primePositionZ";
|
||||
private static final String TAG_SAVED_POSITION = "savedPosition";
|
||||
|
||||
int primePositionX, primePositionY, primePositionZ;
|
||||
boolean savedPosition;
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0xFFFF00;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(isPrime() && (!savedPosition || primePositionX != supertile.xCoord || primePositionY != supertile.yCoord || primePositionZ != supertile.zCoord))
|
||||
supertile.getWorldObj().setBlockToAir(supertile.xCoord, supertile.yCoord, supertile.zCoord);
|
||||
}
|
||||
|
||||
public void setPrimusPosition() {
|
||||
primePositionX = supertile.xCoord;
|
||||
primePositionY = supertile.yCoord;
|
||||
primePositionZ = supertile.zCoord;
|
||||
|
||||
savedPosition = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(ArrayList<ItemStack> list) {
|
||||
if(isPrime())
|
||||
list.clear();
|
||||
|
||||
return super.getDrops(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGeneratePassively() {
|
||||
boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering());
|
||||
@@ -35,7 +71,7 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
@Override
|
||||
public int getDelayBetweenPassiveGeneration() {
|
||||
return 25 + (int) (getSurroundingFlowers() * 7.5);
|
||||
return isPrime() ? 22 : (25 + (int) (getSurroundingFlowers() * 7.5));
|
||||
}
|
||||
|
||||
public int getSurroundingFlowers() {
|
||||
@@ -61,15 +97,62 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
return flowers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
if(isPrime()) {
|
||||
cmp.setInteger(TAG_PRIME_POSITION_X, primePositionX);
|
||||
cmp.setInteger(TAG_PRIME_POSITION_Y, primePositionY);
|
||||
cmp.setInteger(TAG_PRIME_POSITION_Z, primePositionZ);
|
||||
cmp.setBoolean(TAG_SAVED_POSITION, savedPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
|
||||
if(isPrime()) {
|
||||
primePositionX = cmp.getInteger(TAG_PRIME_POSITION_X);
|
||||
primePositionY = cmp.getInteger(TAG_PRIME_POSITION_Y);
|
||||
primePositionZ = cmp.getInteger(TAG_PRIME_POSITION_Z);
|
||||
savedPosition = cmp.getBoolean(TAG_SAVED_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSyncPassiveGeneration() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassiveFlower() {
|
||||
return !isPrime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry() {
|
||||
return LexiconData.daybloom;
|
||||
}
|
||||
|
||||
public boolean isPrime() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Prime extends SubTileDaybloom {
|
||||
|
||||
@Override
|
||||
public boolean isPrime() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry() {
|
||||
return LexiconData.primusLoci;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,5 +34,19 @@ public class SubTileNightshade extends SubTileDaybloom {
|
||||
public LexiconEntry getEntry() {
|
||||
return LexiconData.nightshade;
|
||||
}
|
||||
|
||||
public static class Prime extends SubTileNightshade {
|
||||
|
||||
@Override
|
||||
public boolean isPrime() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry() {
|
||||
return LexiconData.primusLoci;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,9 @@ import vazkii.botania.api.item.IFlowerlessBiome;
|
||||
import vazkii.botania.api.item.IFlowerlessWorld;
|
||||
import vazkii.botania.common.block.BlockModFlower;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -42,15 +45,25 @@ public class BiomeDecorationHandler {
|
||||
int y = event.world.getTopSolidOrLiquidBlock(x, z);
|
||||
|
||||
int color = event.rand.nextInt(16);
|
||||
boolean primus = event.rand.nextInt(500) == 0;
|
||||
|
||||
for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) {
|
||||
int x1 = x + event.rand.nextInt(dist * 2) - dist;
|
||||
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
|
||||
int z1 = z + event.rand.nextInt(dist * 2) - dist;
|
||||
|
||||
if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) {
|
||||
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
|
||||
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
|
||||
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
|
||||
if(primus) {
|
||||
event.world.setBlock(x1, y1, z1, ModBlocks.specialFlower, 0, 2);
|
||||
TileSpecialFlower flower = (TileSpecialFlower) event.world.getTileEntity(x1, y1, z1);
|
||||
flower.setSubTile(event.rand.nextBoolean() ? LibBlockNames.SUBTILE_NIGHTSHADE_PRIME : LibBlockNames.SUBTILE_DAYBLOOM_PRIME);
|
||||
SubTileDaybloom subtile = (SubTileDaybloom) flower.getSubTile();
|
||||
subtile.setPrimusPosition();
|
||||
} else {
|
||||
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
|
||||
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
|
||||
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ public final class LexiconData {
|
||||
|
||||
public static LexiconEntry generatingIntro;
|
||||
public static LexiconEntry passiveGen;
|
||||
public static LexiconEntry primusLoci;
|
||||
public static LexiconEntry daybloom;
|
||||
public static LexiconEntry nightshade;
|
||||
public static LexiconEntry endoflame;
|
||||
@@ -531,6 +532,10 @@ public final class LexiconData {
|
||||
passiveGen = new BLexiconEntry(LibLexicon.GFLOWER_PASSIVE_GENERATION, categoryGenerationFlowers);
|
||||
passiveGen.setPriority().setLexiconPages(new PageText("0"), new PageText("1")).setIcon(new ItemStack(Blocks.deadbush));
|
||||
|
||||
primusLoci = new BLexiconEntry(LibLexicon.GFLOWER_PRIMUS_LOCI, categoryGenerationFlowers);
|
||||
primusLoci.setPriority().setLexiconPages(new PageText("0"), new PageText("1"));
|
||||
primusLoci.setIcon(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_DAYBLOOM_PRIME));
|
||||
|
||||
daybloom = new BLexiconEntry(LibLexicon.GFLOWER_DAYBLOOM, categoryGenerationFlowers);
|
||||
daybloom.setPriority().setLexiconPages(new PageText("0"), new PageText(ConfigHandler.hardcorePassiveGeneration > 0 ? "1a" : "1"), new PageImage("3", LibResources.ENTRY_DIMINISHING_RETURNS), new PagePetalRecipe("2", ModPetalRecipes.daybloomRecipe), new PageText("4"), new PageText("5"));
|
||||
|
||||
|
||||
@@ -109,10 +109,12 @@ public final class LibBlockNames {
|
||||
public static final String SUBTILE_MANASTAR = "manastar";
|
||||
|
||||
public static final String SUBTILE_DAYBLOOM = "daybloom";
|
||||
public static final String SUBTILE_DAYBLOOM_PRIME = "daybloomPrime";
|
||||
public static final String SUBTILE_ENDOFLAME = "endoflame";
|
||||
public static final String SUBTILE_HYDROANGEAS = "hydroangeas";
|
||||
public static final String SUBTILE_THERMALILY = "thermalily";
|
||||
public static final String SUBTILE_NIGHTSHADE = "nightshade";
|
||||
public static final String SUBTILE_NIGHTSHADE_PRIME = "nightshadePrime";
|
||||
public static final String SUBTILE_ARCANE_ROSE = "arcanerose";
|
||||
public static final String SUBTILE_MUNCHDEW = "munchdew";
|
||||
public static final String SUBTILE_ENTROPINNYUM = "entropinnyum";
|
||||
|
||||
@@ -93,6 +93,7 @@ public final class LibLexicon {
|
||||
|
||||
public static final String GFLOWER_INTRO = "gIntro";
|
||||
public static final String GFLOWER_PASSIVE_GENERATION = "passiveGen";
|
||||
public static final String GFLOWER_PRIMUS_LOCI = "primusLoci";
|
||||
public static final String GFLOWER_DAYBLOOM = "daybloom";
|
||||
public static final String GFLOWER_NIGHTSHADE = "nightshade";
|
||||
public static final String GFLOWER_ENDOFLAME = "endoflame";
|
||||
|
||||
Reference in new issue
Block a user