mirror of
https://github.com/GTNewHorizons/Advanced-Botany.git
synced 2026-11-24 22:04:43 +00:00
spotless
This commit is contained in:
1 parent
17454c4993
commit
8e0818be4a
150 files changed
+13246
-12429
No files matched your search
@@ -2,88 +2,93 @@ package ab.common.block.subtile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ab.common.lib.register.RecipeListAB;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.EntityAspectOrb;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import ab.common.lib.register.RecipeListAB;
|
||||
|
||||
public class SubTilePureGladiolus extends SubTileFunctional {
|
||||
|
||||
private static final int MAX_MANA = 10000;
|
||||
private static final String COOLDOWN_TAG = "Cooldown";
|
||||
private static final Aspect[] PRIMALS = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE };
|
||||
private static final int MAX_MANA = 10000;
|
||||
private static final String COOLDOWN_TAG = "Cooldown";
|
||||
private static final Aspect[] PRIMALS = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.ENTROPY,
|
||||
Aspect.ORDER, Aspect.FIRE };
|
||||
|
||||
private int cooldown = 180;
|
||||
protected static int manaRequare = 1000;
|
||||
private int cooldown = 180;
|
||||
protected static int manaRequare = 1000;
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
int tick = 1;
|
||||
World world = this.supertile.getWorldObj();
|
||||
int x = this.supertile.xCoord;
|
||||
int y = this.supertile.yCoord;
|
||||
int z = this.supertile.zCoord;
|
||||
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1)).expand(1.9f, 1.2f, 1.9f));
|
||||
if(world.getBlock(x, y + 1, z).getMaterial() != Material.air)
|
||||
return;
|
||||
else if(world.getBlock(x, y - 1, z) == ModBlocks.enchantedSoil)
|
||||
tick = 2;
|
||||
if(players.isEmpty())
|
||||
return;
|
||||
if(cooldown > 0)
|
||||
cooldown -= tick;
|
||||
else if(mana >= manaRequare && cooldown <= 0) {
|
||||
mana -= manaRequare;
|
||||
cooldown = 180;
|
||||
spawnAspectOrbs(world, x + 0.5, y + 1.0, z + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
public RadiusDescriptor getRadius() {
|
||||
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
|
||||
}
|
||||
|
||||
public LexiconEntry getEntry() {
|
||||
return RecipeListAB.gladious;
|
||||
}
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
int tick = 1;
|
||||
World world = this.supertile.getWorldObj();
|
||||
int x = this.supertile.xCoord;
|
||||
int y = this.supertile.yCoord;
|
||||
int z = this.supertile.zCoord;
|
||||
List<EntityPlayer> players = world.getEntitiesWithinAABB(
|
||||
EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1)).expand(1.9f, 1.2f, 1.9f));
|
||||
if (world.getBlock(x, y + 1, z).getMaterial() != Material.air) return;
|
||||
else if (world.getBlock(x, y - 1, z) == ModBlocks.enchantedSoil) tick = 2;
|
||||
if (players.isEmpty()) return;
|
||||
if (cooldown > 0) cooldown -= tick;
|
||||
else if (mana >= manaRequare && cooldown <= 0) {
|
||||
mana -= manaRequare;
|
||||
cooldown = 180;
|
||||
spawnAspectOrbs(world, x + 0.5, y + 1.0, z + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnAspectOrbs(World world, double x, double y, double z) {
|
||||
if(!world.isRemote) {
|
||||
for (int i = 0; i < 3 + world.rand.nextInt(3); i++) {
|
||||
EntityAspectOrb orb = new EntityAspectOrb(world, x, y, z, PRIMALS[world.rand.nextInt(6)], 2 + world.rand.nextInt(3));
|
||||
orb.motionX = 0.05 - Math.random() * 0.1;
|
||||
orb.motionY = 0.07;
|
||||
orb.motionZ = 0.05 - Math.random() * 0.1;
|
||||
world.spawnEntityInWorld(orb);
|
||||
}
|
||||
this.sync();
|
||||
}
|
||||
}
|
||||
public RadiusDescriptor getRadius() {
|
||||
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0xFF00FF;
|
||||
}
|
||||
public LexiconEntry getEntry() {
|
||||
return RecipeListAB.gladious;
|
||||
}
|
||||
|
||||
public int getMaxMana() {
|
||||
return MAX_MANA;
|
||||
}
|
||||
public void spawnAspectOrbs(World world, double x, double y, double z) {
|
||||
if (!world.isRemote) {
|
||||
for (int i = 0; i < 3 + world.rand.nextInt(3); i++) {
|
||||
EntityAspectOrb orb = new EntityAspectOrb(
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
PRIMALS[world.rand.nextInt(6)],
|
||||
2 + world.rand.nextInt(3));
|
||||
orb.motionX = 0.05 - Math.random() * 0.1;
|
||||
orb.motionY = 0.07;
|
||||
orb.motionZ = 0.05 - Math.random() * 0.1;
|
||||
world.spawnEntityInWorld(orb);
|
||||
}
|
||||
this.sync();
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInteger(COOLDOWN_TAG, this.cooldown);
|
||||
}
|
||||
public int getColor() {
|
||||
return 0xFF00FF;
|
||||
}
|
||||
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
this.cooldown = cmp.getInteger(COOLDOWN_TAG);
|
||||
}
|
||||
}
|
||||
public int getMaxMana() {
|
||||
return MAX_MANA;
|
||||
}
|
||||
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInteger(COOLDOWN_TAG, this.cooldown);
|
||||
}
|
||||
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
this.cooldown = cmp.getInteger(COOLDOWN_TAG);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user