mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Added a Tiny Planet block, will have to work on it later.
This commit is contained in:
1 parent
2bd1294fe7
commit
7a18e1fc7a
7 files changed
+100
-10
No files matched your search
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [May 1, 2014, 3:49:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import vazkii.botania.common.block.tile.TileTinyPlanet;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockTinyPlanet extends BlockModContainer {
|
||||
|
||||
protected BlockTinyPlanet() {
|
||||
super(Material.rock);
|
||||
setHardness(20F);
|
||||
setResistance(100F);
|
||||
setStepSound(soundTypeStone);
|
||||
float size = 3F / 16F;
|
||||
setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size);
|
||||
setBlockName(LibBlockNames.TINY_PLANET);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean registerInCreative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileTinyPlanet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import vazkii.botania.common.block.tile.TilePylon;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.block.tile.TileSpreader;
|
||||
import vazkii.botania.common.block.tile.TileTinyPlanet;
|
||||
import vazkii.botania.common.block.tile.TileTurntable;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
@@ -69,6 +70,7 @@ public final class ModBlocks {
|
||||
public static Block manaDetector;
|
||||
public static Block enchanter;
|
||||
public static Block turntable;
|
||||
public static Block tinyPlanet;
|
||||
|
||||
public static void init() {
|
||||
flower = new BlockModFlower();
|
||||
@@ -88,7 +90,8 @@ public final class ModBlocks {
|
||||
manaDetector = new BlockManaDetector();
|
||||
enchanter = new BlockEnchanter();
|
||||
turntable = new BlockTurntable();
|
||||
|
||||
tinyPlanet = new BlockTinyPlanet();
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i));
|
||||
|
||||
@@ -112,6 +115,7 @@ public final class ModBlocks {
|
||||
GameRegistry.registerTileEntity(TileManaDetector.class, LibBlockNames.MANA_DETECTOR);
|
||||
GameRegistry.registerTileEntity(TileEnchanter.class, LibBlockNames.ENCHANTER);
|
||||
GameRegistry.registerTileEntity(TileTurntable.class, LibBlockNames.TURNTABLE);
|
||||
GameRegistry.registerTileEntity(TileTinyPlanet.class, LibBlockNames.TINY_PLANET);
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
if(redstoneSide > 0)
|
||||
redstone = true;
|
||||
}
|
||||
|
||||
|
||||
if(needsNewBurstSimulation())
|
||||
checkForReceiver();
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [May 1, 2014, 3:49:53 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet;
|
||||
|
||||
public class TileTinyPlanet extends TileMod {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
ItemTinyPlanet.applyEffect(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -39,8 +40,19 @@ public class ItemTinyPlanet extends ItemBauble {
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
super.onWornTick(stack, player);
|
||||
|
||||
double x = player.posX;
|
||||
double y = player.posY + 1.2F;
|
||||
double z = player.posZ;
|
||||
if(player.worldObj.isRemote)
|
||||
y -= 1.62F;
|
||||
|
||||
applyEffect(player.worldObj, x, y, z);
|
||||
}
|
||||
|
||||
public static void applyEffect(World world, double x, double y, double z) {
|
||||
int range = 8;
|
||||
List<Entity> entities = player.worldObj.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range));
|
||||
List<Entity> entities = world.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(x - range, y - range, z - range, x + range, y + range, z + range));
|
||||
for(Entity entity : entities) {
|
||||
IManaBurst burst = (IManaBurst) entity;
|
||||
int orbitTime = getEntityOrbitTime(entity);
|
||||
@@ -50,11 +62,9 @@ public class ItemTinyPlanet extends ItemBauble {
|
||||
float radius = (Math.max(40, orbitTime) - 40) / 40F + 1.5F;
|
||||
int angle = orbitTime % 360;
|
||||
|
||||
float xTarget = (float) (player.posX + Math.cos(angle * 10 * Math.PI / 180F) * radius);
|
||||
float yTarget = (float) player.posY + 1.2F;
|
||||
float zTarget = (float) (player.posZ + Math.sin(angle * 10 * Math.PI / 180F) * radius);
|
||||
if(player.worldObj.isRemote)
|
||||
yTarget -= 1.62F;
|
||||
float xTarget = (float) (x + Math.cos(angle * 10 * Math.PI / 180F) * radius);
|
||||
float yTarget = (float) y;
|
||||
float zTarget = (float) (z + Math.sin(angle * 10 * Math.PI / 180F) * radius);
|
||||
|
||||
Vector3 targetVec = new Vector3(xTarget, yTarget, zTarget);
|
||||
Vector3 currentVec = new Vector3(entity.posX, entity.posY, entity.posZ);
|
||||
@@ -66,14 +76,14 @@ public class ItemTinyPlanet extends ItemBauble {
|
||||
}
|
||||
}
|
||||
|
||||
public int getEntityOrbitTime(Entity entity) {
|
||||
public static int getEntityOrbitTime(Entity entity) {
|
||||
NBTTagCompound cmp = entity.getEntityData();
|
||||
if(cmp.hasKey(TAG_ORBIT))
|
||||
return cmp.getInteger(TAG_ORBIT);
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public void incrementOrbitTime(Entity entity) {
|
||||
public static void incrementOrbitTime(Entity entity) {
|
||||
NBTTagCompound cmp = entity.getEntityData();
|
||||
int time = getEntityOrbitTime(entity);
|
||||
cmp.setInteger(TAG_ORBIT, time + 1);
|
||||
|
||||
@@ -32,6 +32,7 @@ public final class LibBlockNames {
|
||||
public static final String MANA_DETECTOR = LibResources.PREFIX_MOD + "manaDetector";
|
||||
public static final String ENCHANTER = LibResources.PREFIX_MOD + "enchanter";
|
||||
public static final String TURNTABLE = LibResources.PREFIX_MOD + "turntable";
|
||||
public static final String TINY_PLANET = LibResources.PREFIX_MOD + "tinyPlanetBlock";
|
||||
|
||||
public static final String SPECIAL_FLOWER_PREFIX = FLOWER + ".";
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Reference in new issue
Block a user