Green fanciness.

This commit is contained in:
Vasco Lavos committed 2014-06-10 19:45:09 +01:00
1 parent 80de6f718e
commit 318b84030e
11 files changed
+145 -35

No files matched your search

@@ -52,6 +52,8 @@ public final class LibResources {
public static final String MODEL_INFINITE_POOL = PREFIX_MODEL + "infinitePool.png";
public static final String MODEL_PYLON_OLD = PREFIX_MODEL + "pylonOld.png";
public static final String MODEL_PYLON = PREFIX_MODEL + "pylon.png";
public static final String MODEL_PYLON_GREEN_OLD = PREFIX_MODEL + "pylonOld1.png";
public static final String MODEL_PYLON_GREEN = PREFIX_MODEL + "pylon1.png";
public static final String MODEL_LEXICA = PREFIX_MODEL + "lexica.png";
public static final String MODEL_MANASTEEL_0 = PREFIX_MODEL + "manasteel0.png";
public static final String MODEL_MANASTEEL_1 = PREFIX_MODEL + "manasteel1.png";
@@ -19,6 +19,7 @@ import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTilePylon;
import vazkii.botania.common.block.tile.TilePylon;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@@ -28,6 +29,7 @@ public class RenderPylon implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.7F, -0.5F);
RenderTilePylon.green = metadata == 1;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePylon(), 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
@@ -34,7 +34,11 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
private static final ResourceLocation textureOld = new ResourceLocation(LibResources.MODEL_PYLON_OLD);
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON);
private static final ResourceLocation textureGreenOld = new ResourceLocation(LibResources.MODEL_PYLON_GREEN_OLD);
private static final ResourceLocation textureGreen = new ResourceLocation(LibResources.MODEL_PYLON_GREEN);
IPylonModel model;
public static boolean green = false;
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
@@ -46,7 +50,10 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.oldPylonModel ? textureOld : texture);
if(tileentity.getWorldObj() != null)
green = tileentity.getBlockMetadata() == 1;
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.oldPylonModel ? green ? textureGreenOld : textureOld : green ? textureGreen : texture);
int worldTime = (int) (tileentity.getWorldObj() == null ? 0 : tileentity.getWorldObj().getTotalWorldTime());
if(tileentity != null)
@@ -56,21 +63,24 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5);
GL11.glScalef(1F, -1.5F, -1F);
} else {
GL11.glTranslated(d0 + 0.2, d1 + 0.05, d2 + 0.8);
GL11.glScalef(0.6F, 0.6F, 0.6F);
GL11.glTranslated(d0 + 0.2 + (green ? -0.1 : 0), d1 + 0.05, d2 + 0.8 + (green ? 0.1 : 0));
float scale = green ? 0.8F : 0.6F;
GL11.glScalef(scale, 0.6F, scale);
}
GL11.glPushMatrix();
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
if(!green) {
GL11.glPushMatrix();
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
model.renderRing();
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
model.renderGems();
GL11.glPopMatrix();
model.renderRing();
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
model.renderGems();
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
@@ -11,10 +11,15 @@
*/
package vazkii.botania.common.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@@ -23,8 +28,10 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TilePylon;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockPylon extends BlockModContainer implements ILexiconable {
@@ -37,12 +44,33 @@ public class BlockPylon extends BlockModContainer implements ILexiconable {
float f = 1F / 16F * 2F;
setBlockBounds(f, 0F, f, 1F - f, 1F / 16F * 21F, 1F - f);
}
@Override
protected boolean shouldRegisterInNameSet() {
return false;
}
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
}
@Override
public int damageDropped(int par1) {
return par1;
}
@Override
public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
for(int i = 0; i < 2; i++)
par3.add(new ItemStack(par1, 1, i));
}
@Override
public IIcon getIcon(int par1, int par2) {
return Blocks.diamond_block.getIcon(par1, par2);
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.tile;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import vazkii.botania.api.BotaniaAPI;
@@ -21,7 +22,7 @@ import vazkii.botania.common.block.ModBlocks;
import com.google.common.base.Function;
public class TileAlfPortal extends TileEntity {
public class TileAlfPortal extends TileMod {
private static final int[][] LIVINGWOOD_POSITIONS = {
{ -1, 0, 0}, { 1, 0, 0}, { -2, 1, 0}, { 2, 1, 0}, { -2, 3, 0}, { 2, 3, 0}, { -1, 4, 0}, { 1, 4, 0}
@@ -43,6 +44,8 @@ public class TileAlfPortal extends TileEntity {
{ -1, 1, 0 }, { 0, 1, 0 }, { 1, 1, 0 }, { -1, 2, 0 }, { 0, 2, 0 }, { 1, 2, 0 }, { -1, 3, 0 }, { 0, 3, 0 }, { 1, 3, 0 }
};
private static final String TAG_TICKS_OPEN = "ticksOpen";
public int ticksOpen = 0;
private static final Function<int[], int[]> CONVERTER_X_Z = new Function<int[], int[]>() {
@@ -109,6 +112,16 @@ public class TileAlfPortal extends TileEntity {
return false;
}
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
cmp.setInteger(TAG_TICKS_OPEN, ticksOpen);
}
@Override
public void readCustomNBT(NBTTagCompound cmp) {
ticksOpen = cmp.getInteger(TAG_TICKS_OPEN);
}
private int getValidMetadata() {
if(checkConverter(null))
return 1;
@@ -130,14 +143,36 @@ public class TileAlfPortal extends TileEntity {
return false;
if(!check2DArray(GLIMMERING_LIVINGWOOD_POSITIONS, ModBlocks.livingwood, 5, converters))
return false;
if(!check2DArray(PYLON_POSITIONS, ModBlocks.pylon, 0, converters))
if(!check2DArray(PYLON_POSITIONS, ModBlocks.pylon, 1, converters))
return false;
if(!check2DArray(POOL_POSITIONS, ModBlocks.pool, -1, converters))
return false;
lightPylons(converters);
return true;
}
private void lightPylons(Function<int[], int[]>... converters) {
if(ticksOpen < 50)
return;
for(int[] pos : PYLON_POSITIONS) {
for(Function<int[], int[]> f : converters)
if(f != null)
pos = f.apply(pos);
TileEntity tile = worldObj.getTileEntity(xCoord + pos[0], yCoord + pos[1], zCoord + pos[2]);
if(tile instanceof TilePylon) {
TilePylon pylon = (TilePylon) tile;
pylon.activated = true;
pylon.centerX = xCoord;
pylon.centerY = yCoord;
pylon.centerZ = zCoord;
}
}
}
private boolean check2DArray(int[][] positions, Block block, int meta, Function<int[], int[]>... converters) {
for(int[] pos : positions) {
for(Function<int[], int[]> f : converters)
@@ -11,6 +11,8 @@
*/
package vazkii.botania.common.block.tile;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.tileentity.TileEntity;
@@ -25,33 +27,57 @@ public class TilePylon extends TileEntity {
@Override
public void updateEntity() {
int meta = getBlockMetadata();
if(activated && worldObj.isRemote) {
if(worldObj.getBlock(centerX, centerY, centerZ) != ModBlocks.enchanter) {
if(worldObj.getBlock(centerX, centerY, centerZ) != getBlockForMeta() || (meta != 0 && worldObj.getBlockMetadata(centerX, centerY, centerZ) == 0)) {
activated = false;
return;
}
Vector3 centerBlock = new Vector3(centerX + 0.5, centerY + 0.75 + (Math.random() - 0.5 * 0.25), centerZ + 0.5);
Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
if(block == ModBlocks.flower) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[meta];
if(worldObj.rand.nextInt(4) == 0)
Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F);
if(meta == 1) {
double worldTime = (int) worldObj.getTotalWorldTime();
worldTime += new Random(xCoord ^ yCoord ^ zCoord).nextInt(1000);
worldTime /= 5;
float r = 0.75F + (float) Math.random() * 0.05F;
double x = xCoord + 0.5 + Math.cos(worldTime) * r;
double z = zCoord + 0.5 + Math.sin(worldTime) * r;
Vector3 ourCoords = new Vector3(x, yCoord + 0.25, z);
Vector3 target = centerBlock.sub(new Vector3(0, 0.5, 0));
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
Botania.proxy.wispFX(worldObj, x, yCoord + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
if(worldObj.rand.nextInt(3) == 0)
Botania.proxy.wispFX(worldObj, x, yCoord + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
} else {
Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0);
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
if(block == ModBlocks.flower) {
int fmeta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[fmeta];
if(worldObj.rand.nextInt(4) == 0)
Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
}
if(worldObj.rand.nextBoolean() && worldObj.isRemote)
Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), 0.5F, 0.5F, 1F, (float) Math.random(), 2);
Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), 0.5F, meta == 1 ? 1F : 0.5F, meta == 1 ? 0.5F : 1F, (float) Math.random(), 2);
}
private Block getBlockForMeta() {
return getBlockMetadata() == 0 ? ModBlocks.enchanter : ModBlocks.alfPortal;
}
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
#Sun, 08 Jun 2014 22:42:29 +0100
#Mon, 09 Jun 2014 23:20:18 +0100
version=r1.0
build_number=49
build_number=50
mc_version=1.7.2
mod_name=Botania
dir.repo=./
+2 -1
View File
@@ -138,7 +138,8 @@ tile.botania:unstableBlock14.name=Red Unstable Cube
tile.botania:unstableBlock15.name=Black Unstable Cube
tile.botania:pistonRelay.name=Force Relay
tile.botania:distributor.name=Mana Distributor
tile.botania:pylon.name=Mana Pylon
tile.botania:pylon0.name=Mana Pylon
tile.botania:pylon1.name=Natura Pylon
tile.botania:manaBeacon0.name=White Unstable Beacon
tile.botania:manaBeacon1.name=Orange Unstable Beacon
tile.botania:manaBeacon2.name=Magenta Unstable Beacon
+1 -1
View File
@@ -1 +1 @@
r1.0-48
r1.0-49
+5
View File
@@ -1,3 +1,8 @@
r1.0 49
*Artificially increased the accuracy of the Damaging Lens and Terra Blade.
*Commented the flower quantity and density config options.
*Fixed the Kekimurus eating only from the south east.
*Some behind the scenes work on <a href="http://gfycat.com/DarkUnhealthyEthiopianwolf"><span class="censored">----------</span></a>.
r1.0 48
*Fixed Generating Flowers never outputting any mana whatsoever to spreaders.
*<i>*sigh*</i>
+2 -1
View File
@@ -45,4 +45,5 @@ r1.0-44=1.7.2
r1.0-45=1.7.2
r1.0-46=1.7.2
r1.0-47=1.7.2
r1.0-48=1.7.2
r1.0-48=1.7.2
r1.0-49=1.7.2