mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 12:42:50 +00:00
Corporea index and cube item model
This commit is contained in:
1 parent
5d80b7d9ce
commit
3eb67e3fea
7 files changed
+123
-7
No files matched your search
@@ -20,6 +20,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
@@ -43,6 +44,7 @@ import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.core.proxy.ClientProxy;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
import vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
|
||||
@@ -88,6 +90,8 @@ import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.item.ItemManaGun;
|
||||
import vazkii.botania.common.item.ItemSpawnerMover;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
@@ -136,6 +140,7 @@ public final class ModelHandler {
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
registerTESRItems();
|
||||
registerManaResources();
|
||||
registerRunes();
|
||||
registerBows();
|
||||
@@ -563,6 +568,14 @@ public final class ModelHandler {
|
||||
registerItemModelMetas(grassHorn, LibItemNames.GRASS_HORN, 3);
|
||||
}
|
||||
|
||||
// Only for models that absolutely can't be converted to JSON. Use VERY sparingly
|
||||
private static void registerTESRItems() {
|
||||
registerItemModel(ModBlocks.corporeaCrystalCube);
|
||||
registerItemModel(ModBlocks.corporeaIndex);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaCrystalCube), 0, TileCorporeaCrystalCube.class);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaIndex), 0, TileCorporeaIndex.class);
|
||||
}
|
||||
|
||||
private static void registerManaResources() {
|
||||
Item item = manaResource;
|
||||
for (int i = 0; i < LibItemNames.MANA_RESOURCE_NAMES.length; i++) {
|
||||
|
||||
@@ -42,15 +42,18 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f, int digProgress) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) tileentity;
|
||||
|
||||
if(entity == null)
|
||||
entity = new EntityItem(cube.getWorld(), cube.getPos().getX(), cube.getPos().getY(), cube.getPos().getZ(), new ItemStack(Blocks.stone));
|
||||
ItemStack stack = null;
|
||||
if (cube != null) {
|
||||
if(entity == null)
|
||||
entity = new EntityItem(cube.getWorld(), cube.getPos().getX(), cube.getPos().getY(), cube.getPos().getZ(), new ItemStack(Blocks.stone));
|
||||
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, entity, ClientTickHandler.ticksInGame, LibObfuscation.AGE);
|
||||
ItemStack stack = cube.getRequestTarget();
|
||||
entity.setEntityItemStack(stack);
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, entity, ClientTickHandler.ticksInGame, LibObfuscation.AGE);
|
||||
stack = cube.getRequestTarget();
|
||||
entity.setEntityItemStack(stack);
|
||||
}
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + f;
|
||||
double worldTicks = tileentity.getWorld() == null ? 0 : time;
|
||||
double worldTicks = tileentity == null || tileentity.getWorld() == null ? 0 : time;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -32,6 +32,7 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partticks, int digProgress) {
|
||||
TileCorporeaIndex index = (TileCorporeaIndex) tile;
|
||||
move = index != null;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x + 0.5, y, z + 0.5);
|
||||
@@ -44,7 +45,7 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer {
|
||||
crystal.render(null, 0F, rotation, translation, 0F, 0F, 1F / 16F);
|
||||
GlStateManager.scale(1F / scale, 1F / scale, 1F / scale);
|
||||
|
||||
if(index.closeby > 0F) {
|
||||
if(index != null && index.closeby > 0F) {
|
||||
float starScale = 0.02F;
|
||||
float starRadius = (float) TileCorporeaIndex.RADIUS * index.closeby + (index.closeby == 1F ? 0F : index.hasCloseby ? partticks : -partticks) * 0.2F;
|
||||
double rads = (index.ticksWithCloseby + partticks) * 2 * Math.PI / 180;
|
||||
|
||||
@@ -10,15 +10,26 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
|
||||
@@ -91,4 +102,40 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).compValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles )
|
||||
{
|
||||
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
|
||||
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
|
||||
if (d0 > 2.5D) {
|
||||
d0 = 2.5D;
|
||||
}
|
||||
int i = (int)(150.0D * d0);
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
EntityDiggingFX.Factory factory = new EntityDiggingFX.Factory();
|
||||
for (int j = 0; j < i; ++j) {
|
||||
for (int k = 0; k < i; ++k) {
|
||||
for (int l = 0; l < i; ++l) {
|
||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,13 +10,23 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
|
||||
@@ -57,4 +67,40 @@ public class BlockCorporeaIndex extends BlockCorporeaBase implements ILexiconabl
|
||||
return LexiconData.corporeaIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles )
|
||||
{
|
||||
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
|
||||
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
|
||||
if (d0 > 2.5D) {
|
||||
d0 = 2.5D;
|
||||
}
|
||||
int i = (int)(150.0D * d0);
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
EntityDiggingFX.Factory factory = new EntityDiggingFX.Factory();
|
||||
for (int j = 0; j < i; ++j) {
|
||||
for (int k = 0; k < i; ++k) {
|
||||
for (int l = 0; l < i; ++l) {
|
||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user