mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 14:34:36 +00:00
Misc cleanups and fixes. All magic flowers compile now!
This commit is contained in:
1 parent
9ea899bad5
commit
f58440b79a
21 files changed
+117
-123
No files matched your search
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -26,13 +27,11 @@ public class RecipePureDaisy {
|
||||
private static final Map<String, List<ItemStack>> oreMap = new HashMap();
|
||||
|
||||
Object input;
|
||||
Block output;
|
||||
int outputMeta;
|
||||
IBlockState outputState;
|
||||
|
||||
public RecipePureDaisy(Object input, Block output, int outputMeta) {
|
||||
public RecipePureDaisy(Object input, IBlockState state) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.outputMeta = outputMeta;
|
||||
this.outputState = state;
|
||||
|
||||
if(input != null && !(input instanceof String || input instanceof Block))
|
||||
throw new IllegalArgumentException("input must be an oredict String or a Block.");
|
||||
@@ -41,11 +40,11 @@ public class RecipePureDaisy {
|
||||
/**
|
||||
* This gets called every tick, please be careful with your checks.
|
||||
*/
|
||||
public boolean matches(World world, int x, int y, int z, SubTileEntity pureDaisy, Block block, int meta) {
|
||||
public boolean matches(World world, BlockPos pos, SubTileEntity pureDaisy, IBlockState state) {
|
||||
if(input instanceof Block)
|
||||
return block == input;
|
||||
return state.getBlock() == input;
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, meta);
|
||||
ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
String oredict = (String) input;
|
||||
return isOreDict(stack, oredict);
|
||||
}
|
||||
@@ -81,7 +80,7 @@ public class RecipePureDaisy {
|
||||
*/
|
||||
public boolean set(World world, BlockPos pos, SubTileEntity pureDaisy) {
|
||||
if(!world.isRemote)
|
||||
world.setBlockState(pos, output.getStateFromMeta(outputMeta), 1 | 2); // todo 1.8 - should this remain meta?
|
||||
world.setBlockState(pos, outputState, 1 | 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,12 +88,8 @@ public class RecipePureDaisy {
|
||||
return input;
|
||||
}
|
||||
|
||||
public Block getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public int getOutputMeta() {
|
||||
return outputMeta;
|
||||
public IBlockState getOutputState() {
|
||||
return outputState;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class BlockAltGrass extends BlockMod {
|
||||
setStepSound(soundTypeGrass);
|
||||
setUnlocalizedName(LibBlockNames.ALT_GRASS);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY));
|
||||
setTickRandomly(true)
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,7 +108,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||
String name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
return ItemBlockSpecialFlower.ofType(new ItemStack(state.getBlock(), state.getBlock().getMetaFromState(state), name);
|
||||
return ItemBlockSpecialFlower.ofType(new ItemStack(state.getBlock()), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.corporea.BlockCorporeaCrystalCube;
|
||||
@@ -398,8 +399,8 @@ public final class ModBlocks {
|
||||
OreDictionary.registerOre("chestWood", Blocks.chest);
|
||||
OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table);
|
||||
|
||||
BotaniaAPI.registerPaintableBlock(unstableBlock);
|
||||
BotaniaAPI.registerPaintableBlock(manaBeacon);
|
||||
BotaniaAPI.registerPaintableBlock(unstableBlock, BotaniaStateProps.COLOR);
|
||||
BotaniaAPI.registerPaintableBlock(manaBeacon, BotaniaStateProps.COLOR);
|
||||
|
||||
initTileEntities();
|
||||
}
|
||||
|
||||
@@ -54,11 +54,6 @@ public class BlockModPane extends BlockPane {
|
||||
return 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package vazkii.botania.common.block.decor.slabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -17,10 +16,4 @@ public abstract class BlockLivingSlab extends BlockModSlab {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return source.getIcon(par1, meta);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,22 +12,26 @@ package vazkii.botania.common.block.mana;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.IPoolOverlayProvider;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockAlchemyCatalyst extends BlockMod implements ILexiconable, IPoolOverlayProvider {
|
||||
|
||||
TextureAtlasSprite overlay;
|
||||
|
||||
public BlockAlchemyCatalyst() {
|
||||
this(LibBlockNames.ALCHEMY_CATALYST);
|
||||
}
|
||||
@@ -38,6 +42,12 @@ public class BlockAlchemyCatalyst extends BlockMod implements ILexiconable, IPoo
|
||||
setResistance(10.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setUnlocalizedName(name);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
overlay = IconHelper.forBlock(evt.map, this, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +57,7 @@ public class BlockAlchemyCatalyst extends BlockMod implements ILexiconable, IPoo
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getIcon(World world, BlockPos pos) {
|
||||
return icons[3];
|
||||
return overlay;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,8 +24,10 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -77,8 +78,9 @@ public class BlockPrism extends BlockModContainer implements IManaTrigger, ILexi
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumWorldBlockLayer getBlockLayer() {
|
||||
return EnumWorldBlockLayer.CUTOUT_MIPPED; // todo 1.8
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -123,11 +123,6 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
super.breakBlock(par1World, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[Math.min(2, par1)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileRuneAltar();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.block.subtile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -55,11 +56,10 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
BlockPos coords = supertile.getPos().add(acoords);
|
||||
World world = supertile.getWorld();
|
||||
if(!world.isAirBlock(coords)) {
|
||||
Block block = world.getBlockState(coords).getBlock();
|
||||
int meta = world.getBlockMetadata(coords.posX, coords.posY, coords.posZ);
|
||||
IBlockState state = world.getBlockState(coords);
|
||||
RecipePureDaisy recipe = null;
|
||||
for(RecipePureDaisy recipe_ : BotaniaAPI.pureDaisyRecipes)
|
||||
if(recipe_.matches(world, coords.posX, coords.posY, coords.posZ, this, block, meta)) {
|
||||
if(recipe_.matches(world, coords, this, state)) {
|
||||
recipe = recipe_;
|
||||
break;
|
||||
}
|
||||
@@ -68,21 +68,21 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
if(recipe != null) {
|
||||
ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1;
|
||||
|
||||
Botania.proxy.sparkleFX(supertile.getWorld(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
|
||||
Botania.proxy.sparkleFX(supertile.getWorld(), coords.getX() + Math.random(), coords.getY() + Math.random(), coords.getZ() + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
|
||||
|
||||
if(ticksRemaining[positionAt] <= 0) {
|
||||
ticksRemaining[positionAt] = 200;
|
||||
|
||||
if(recipe.set(world,coords.posX, coords.posY, coords.posZ, this)) {
|
||||
if(recipe.set(world,coords, this)) {
|
||||
for(int i = 0; i < 25; i++) {
|
||||
double x = coords.posX + Math.random();
|
||||
double y = coords.posY + Math.random() + 0.5;
|
||||
double z = coords.posZ + Math.random();
|
||||
double x = coords.getX() + Math.random();
|
||||
double y = coords.getY() + Math.random() + 0.5;
|
||||
double z = coords.getZ() + Math.random();
|
||||
|
||||
Botania.proxy.wispFX(supertile.getWorld(), x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F);
|
||||
}
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(recipe.getOutput()) + (recipe.getOutputMeta() << 12));
|
||||
supertile.getWorld().playAuxSFX(2001, coords, Block.getStateId(recipe.getOutputState()));
|
||||
}
|
||||
}
|
||||
} else ticksRemaining[positionAt] = 200;
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
+7
-3
@@ -12,8 +12,11 @@ package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
@@ -42,11 +45,12 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
|
||||
for(int i = 0; i < RANGE * 2; i++) {
|
||||
Block blockAbove = supertile.getWorld().getBlockState(pos.up()).getBlock();
|
||||
if((supertile.getWorld().isAirBlock(pos.up()) || blockAbove.isReplaceable(supertile.getWorld(), pos.up())) && blockAbove.getMaterial() != Material.water && ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), pos.up())) {
|
||||
int color = supertile.getWorld().rand.nextInt(16);
|
||||
EnumDyeColor color = EnumDyeColor.byMetadata(supertile.getWorld().rand.nextInt(16));
|
||||
if(ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), pos.up())) {
|
||||
IBlockState state = ModBlocks.flower.getDefaultState().withProperty(BotaniaStateProps.COLOR, color);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, pos.up(), Block.getIdFromBlock(ModBlocks.flower) + (color << 12));
|
||||
supertile.getWorld().setBlockState(pos.up(), ModBlocks.flower, color, 1 | 2);
|
||||
supertile.getWorld().playAuxSFX(2001, pos.up(), Block.getStateId(state));
|
||||
supertile.getWorld().setBlockState(pos.up(), state, 1 | 2);
|
||||
}
|
||||
|
||||
mana -= COST;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class SubTilePollidisiac extends SubTileFunctional {
|
||||
mana -= manaCost;
|
||||
|
||||
ReflectionHelper.setPrivateValue(EntityAnimal.class, animal, 1200, LibObfuscation.IN_LOVE);
|
||||
animal.setTarget(null);
|
||||
// todo 1.8 new AI animal.setTarget(null);
|
||||
supertile.getWorld().setEntityState(animal, (byte)18);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
+16
-21
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
@@ -85,20 +86,17 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
}
|
||||
}
|
||||
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
BlockPos pos = supertile.getPos();
|
||||
|
||||
for(int[] change : changes) {
|
||||
int px = x - RANGE + change[0];
|
||||
int pz = z - RANGE + change[1];
|
||||
BlockPos pos_ = pos.add(-RANGE + change[0], 0, -RANGE + change[1]);
|
||||
int val = change[2];
|
||||
if(val != -2 && wipe)
|
||||
val = -1;
|
||||
|
||||
int old = change[3];
|
||||
|
||||
setBlockForGeneration(px, y, pz, val, old);
|
||||
setBlockForGeneration(pos_, val, old);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,22 +104,19 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
int diam = RANGE * 2 + 1;
|
||||
int[][] table = new int[diam][diam];
|
||||
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
BlockPos pos = supertile.getPos();
|
||||
|
||||
for(int i = 0; i < diam; i++)
|
||||
for(int j = 0; j < diam; j++) {
|
||||
int px = x - RANGE + i;
|
||||
int pz = z - RANGE + j;
|
||||
table[i][j] = getCellGeneration(px, y, pz);
|
||||
BlockPos pos_ = pos.add(-RANGE + i, 0, -RANGE + j);
|
||||
table[i][j] = getCellGeneration(pos_);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
int getCellGeneration(int x, int y, int z) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(x, y, z);
|
||||
int getCellGeneration(BlockPos pos) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(pos);
|
||||
if(tile instanceof TileCell)
|
||||
return ((TileCell) tile).isSameFlower(supertile) ? ((TileCell) tile).getGeneration() : 0;
|
||||
|
||||
@@ -162,21 +157,21 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
return x < 0 || z < 0 || x >= table.length || z >= table[0].length;
|
||||
}
|
||||
|
||||
void setBlockForGeneration(int x, int y, int z, int gen, int prevGen) {
|
||||
void setBlockForGeneration(BlockPos pos, int gen, int prevGen) {
|
||||
World world = supertile.getWorld();
|
||||
Block blockAt = world.getBlock(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
Block blockAt = world.getBlockState(pos).getBlock();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(gen == -2) {
|
||||
int val = prevGen * MANA_PER_GEN;
|
||||
mana = Math.min(getMaxMana(), mana + val);
|
||||
//world.setBlockToAir(x, y, z);
|
||||
} else if(blockAt == ModBlocks.cellBlock) {
|
||||
if(gen < 0 || gen > MAX_GENERATIONS)
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
else ((TileCell) tile).setGeneration(supertile, gen);
|
||||
} else if(gen >= 0 && blockAt.isAir(supertile.getWorld(), x, y, z)) {
|
||||
world.setBlock(x, y, z, ModBlocks.cellBlock);
|
||||
tile = world.getTileEntity(x, y, z);
|
||||
} else if(gen >= 0 && blockAt.isAir(supertile.getWorld(), pos)) {
|
||||
world.setBlockState(pos, ModBlocks.cellBlock.getDefaultState());
|
||||
tile = world.getTileEntity(pos);
|
||||
((TileCell) tile).setGeneration(supertile, gen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -32,7 +32,6 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
private static final String TAG_PRIME_POSITION_Z = "primePositionZ";
|
||||
private static final String TAG_SAVED_POSITION = "savedPosition";
|
||||
|
||||
int primePositionX, primePositionY, primePositionZ;
|
||||
BlockPos primePosition;
|
||||
boolean savedPosition;
|
||||
|
||||
@@ -45,14 +44,12 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(isPrime() && (!savedPosition || primePositionX != supertile.xCoord || primePositionY != supertile.yCoord || primePositionZ != supertile.zCoord))
|
||||
supertile.getWorld().setBlockToAir(supertile.xCoord, supertile.yCoord, supertile.zCoord);
|
||||
if(isPrime() && (!savedPosition || !supertile.getPos().equals(primePosition)))
|
||||
supertile.getWorld().setBlockToAir(supertile.getPos());
|
||||
}
|
||||
|
||||
public void setPrimusPosition() {
|
||||
primePositionX = supertile.xCoord;
|
||||
primePositionY = supertile.yCoord;
|
||||
primePositionZ = supertile.zCoord;
|
||||
primePosition = supertile.getPos();
|
||||
|
||||
savedPosition = true;
|
||||
}
|
||||
@@ -67,8 +64,8 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
@Override
|
||||
public boolean canGeneratePassively() {
|
||||
boolean rain = supertile.getWorld().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
|
||||
return supertile.getWorld().isDaytime() && !rain && supertile.getWorld().canBlockSeeTheSky(supertile.xCoord, supertile.yCoord + 1, supertile.zCoord);
|
||||
boolean rain = supertile.getWorld().getBiomeGenForCoords(supertile.getPos()).getIntRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
|
||||
return supertile.getWorld().isDaytime() && !rain && supertile.getWorld().canBlockSeeSky(supertile.getPos().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,8 +75,8 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
public int getSurroundingFlowers() {
|
||||
int flowers = 0;
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(supertile.xCoord + dir.offsetX, supertile.yCoord, supertile.zCoord + dir.offsetZ);
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(supertile.getPos().offset(dir));
|
||||
if(tile != null && tile instanceof ISubTileContainer) {
|
||||
ISubTileContainer flower = (ISubTileContainer) tile;
|
||||
if(flower.getSubTile() != null && flower.getSubTile().getClass() == getClass()) {
|
||||
@@ -92,7 +89,7 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
|
||||
float m = 0.045F;
|
||||
if(ticksExisted % 10 == 0)
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.xCoord + 0.5, supertile.yCoord + 0.05, supertile.zCoord + 0.5, r, g, b, 0.1F, dir.offsetX * m, dir.offsetY * m, dir.offsetZ * m);
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.getPos().getX() + 0.5, supertile.getPos().getY() + 0.05, supertile.getPos().getZ() + 0.5, r, g, b, 0.1F, dir.getFrontOffsetX() * m, dir.getFrontOffsetY() * m, dir.getFrontOffsetZ() * m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,9 +102,9 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
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.setInteger(TAG_PRIME_POSITION_X, primePosition.getX());
|
||||
cmp.setInteger(TAG_PRIME_POSITION_Y, primePosition.getY());
|
||||
cmp.setInteger(TAG_PRIME_POSITION_Z, primePosition.getZ());
|
||||
cmp.setBoolean(TAG_SAVED_POSITION, savedPosition);
|
||||
}
|
||||
}
|
||||
@@ -117,9 +114,11 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
|
||||
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);
|
||||
primePosition = new BlockPos(
|
||||
cmp.getInteger(TAG_PRIME_POSITION_X),
|
||||
cmp.getInteger(TAG_PRIME_POSITION_Y),
|
||||
cmp.getInteger(TAG_PRIME_POSITION_Z)
|
||||
);
|
||||
savedPosition = cmp.getBoolean(TAG_SAVED_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SubTileEndoflame extends SubTileGenerating {
|
||||
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(EntityItem item : items) {
|
||||
if(item.age >= 59 && !item.isDead) {
|
||||
if(item.getAge() >= 59 && !item.isDead) {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(stack.getItem().hasContainerItem(stack))
|
||||
continue;
|
||||
|
||||
+21
-21
@@ -16,13 +16,16 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
@@ -36,7 +39,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
private static final String TAG_BURN_TIME = "burnTime";
|
||||
private static final String TAG_COOLDOWN = "cooldown";
|
||||
|
||||
private static final int[][] OFFSETS = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 }, { -1, 1 }, { -1, -1 }, { 1, 1 }, { 1, -1 } };
|
||||
private static final BlockPos[] OFFSETS = { new BlockPos(0, 0, 1), new BlockPos(0, 0, -1), new BlockPos(1, 0, 0), new BlockPos(-1, 0, 0), new BlockPos(-1, 0, 1), new BlockPos(-1, 0, -1), new BlockPos(1, 0, 1), new BlockPos(1, 0, -1) };
|
||||
|
||||
int burnTime, cooldown;
|
||||
|
||||
@@ -47,33 +50,30 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
if(cooldown > 0) {
|
||||
cooldown--;
|
||||
for(int i = 0; i < 3; i++)
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.xCoord + 0.5 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.5 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5 + Math.random() * 0.2 - 0.1, 0.1F, 0.1F, 0.1F, (float) Math.random() / 6, (float) -Math.random() / 30);
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.getPos().getX() + 0.5 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.5 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5 + Math.random() * 0.2 - 0.1, 0.1F, 0.1F, 0.1F, (float) Math.random() / 6, (float) -Math.random() / 30);
|
||||
return;
|
||||
}
|
||||
|
||||
if(burnTime == 0) {
|
||||
if(mana < getMaxMana() && !supertile.getWorld().isRemote) {
|
||||
List<int[]> offsets = Arrays.asList(OFFSETS);
|
||||
List<BlockPos> offsets = Arrays.asList(OFFSETS);
|
||||
Collections.shuffle(offsets);
|
||||
|
||||
for(int[] offsetArray : offsets) {
|
||||
int[] positions = {
|
||||
supertile.xCoord + offsetArray[0],
|
||||
supertile.zCoord + offsetArray[1]
|
||||
};
|
||||
for(BlockPos offset : offsets) {
|
||||
BlockPos pos = supertile.getPos().add(offset);
|
||||
|
||||
Material search = getMaterialToSearchFor();
|
||||
if(supertile.getWorld().getBlock(positions[0], supertile.yCoord, positions[1]).getMaterial() == search && (getBlockToSearchBelow() == null || supertile.getWorld().getBlock(positions[0], supertile.yCoord - 1, positions[1]) == getBlockToSearchBelow()) && supertile.getWorld().getBlockMetadata(positions[0], supertile.yCoord, positions[1]) == 0) {
|
||||
if(supertile.getWorld().getBlockState(pos).getBlock().getMaterial() == search && (getBlockToSearchBelow() == null || supertile.getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow()) && ((Integer) supertile.getWorld().getBlockState(pos).getValue(BlockLiquid.LEVEL))/* todo 1.8 may crash */ == 0) {
|
||||
if(search != Material.water)
|
||||
supertile.getWorld().setBlockToAir(positions[0], supertile.yCoord, positions[1]);
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
else {
|
||||
int waterAround = 0;
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
if(supertile.getWorld().getBlock(positions[0] + dir.offsetX, supertile.yCoord, positions[1] + dir.offsetZ).getMaterial() == search)
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
if(supertile.getWorld().getBlockState(pos.offset(dir)).getBlock().getMaterial() == search)
|
||||
waterAround++;
|
||||
|
||||
if(waterAround < 2)
|
||||
supertile.getWorld().setBlockToAir(positions[0], supertile.yCoord, positions[1]);
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
}
|
||||
|
||||
burnTime += getBurnTime();
|
||||
@@ -96,8 +96,8 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
|
||||
public int getSurroundingFlowers() {
|
||||
int flowers = 0;
|
||||
for(int[] offsetArray : OFFSETS) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(supertile.xCoord + offsetArray[0], supertile.yCoord, supertile.zCoord + offsetArray[1]);
|
||||
for(BlockPos offset : OFFSETS) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(supertile.getPos().add(offset));
|
||||
if(tile != null && tile instanceof ISubTileContainer) {
|
||||
ISubTileContainer flower = (ISubTileContainer) tile;
|
||||
if(flower.getSubTile() != null && flower.getSubTile().getClass() == getClass()) {
|
||||
@@ -110,7 +110,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
|
||||
float m = 0.045F;
|
||||
if(ticksExisted % 10 == 0)
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.xCoord + 0.5, supertile.yCoord + 0.05, supertile.zCoord + 0.5, r, g, b, 0.1F, offsetArray[0] * m, 0, offsetArray[1] * m);
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.getPos().getX() + 0.5, supertile.getPos().getY() + 0.05, supertile.getPos().getZ() + 0.5, r, g, b, 0.1F, offset.getX() * m, 0, offset.getZ() * m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
}
|
||||
|
||||
public void doBurnParticles() {
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60);
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60);
|
||||
}
|
||||
|
||||
public Material getMaterialToSearchFor() {
|
||||
@@ -131,7 +131,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
}
|
||||
|
||||
public void playSound() {
|
||||
supertile.getWorld().playSoundEffect(supertile.xCoord, supertile.yCoord, supertile.zCoord, "random.drink", 0.01F, 0.5F + (float) Math.random() * 0.5F);
|
||||
supertile.getWorld().playSoundEffect(supertile.getPos().getX(), supertile.getPos().getY(), supertile.getPos().getZ(), "random.drink", 0.01F, 0.5F + (float) Math.random() * 0.5F);
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
@@ -186,8 +186,8 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
cooldown = ItemNBTHelper.getInt(stack, TAG_COOLDOWN, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ public class SubTileMunchdew extends SubTileGenerating {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
cooldown = ItemNBTHelper.getInt(stack, TAG_COOLDOWN, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.subtile.generating;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -65,10 +66,11 @@ public class SubTileRafflowsia extends SubTileGenerating {
|
||||
|
||||
float mod = 1F / lastFlowerTimes;
|
||||
|
||||
int meta = supertile.getWorld().getBlockMetadata(x, y, z) + 1;
|
||||
// todo 1.8 why is meta +1 'ed ?? int meta = supertile.getWorld().getBlockMetadata(x, y, z) + 1;
|
||||
IBlockState state = supertile.getWorld().getBlockState(pos);
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
|
||||
supertile.getWorld().playAuxSFX(2001, pos, Block.getIdFromBlock(block) + (meta << 12));
|
||||
supertile.getWorld().playAuxSFX(2001, pos, Block.getStateId(state));
|
||||
this.mana += mana * mod;
|
||||
sync();
|
||||
return;
|
||||
@@ -104,8 +106,8 @@ public class SubTileRafflowsia extends SubTileGenerating {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
|
||||
lastFlower = ItemNBTHelper.getString(stack, TAG_LAST_FLOWER, "");
|
||||
lastFlowerTimes = ItemNBTHelper.getInt(stack, TAG_LAST_FLOWER_TIMES, 0);
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
||||
Reference in new issue
Block a user