POH. TAY. TOES.

This commit is contained in:
Alex Spinks committed 2015-07-14 04:02:09 +01:00
1 parent 3e2661c743
commit 12f82e3cb7
14 files changed
+445 -28

No files matched your search

@@ -1,5 +1,6 @@
package fox.spiteful.avaritia;
import fox.spiteful.avaritia.compat.CompatClient;
import fox.spiteful.avaritia.items.LudicrousItems;
import fox.spiteful.avaritia.render.FancyHaloRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
@@ -12,5 +13,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(LudicrousItems.resource, shiny);
MinecraftForgeClient.registerItemRenderer(LudicrousItems.singularity, shiny);
CompatClient.comprettify();
}
}
@@ -0,0 +1,17 @@
package fox.spiteful.avaritia.compat;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import fox.spiteful.avaritia.compat.tsundere.RenderInfinitato;
import fox.spiteful.avaritia.compat.tsundere.RenderTileInfinitato;
import fox.spiteful.avaritia.compat.tsundere.TileInfinitato;
public class CompatClient {
public static void comprettify() {
if (Compat.botan) {
RenderingRegistry.registerBlockHandler(new RenderInfinitato(RenderingRegistry.getNextAvailableRenderId()));
ClientRegistry.bindTileEntitySpecialRenderer(TileInfinitato.class, new RenderTileInfinitato());
}
}
}
@@ -2,9 +2,12 @@ package fox.spiteful.avaritia.compat;
import cpw.mods.fml.common.registry.GameRegistry;
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
import fox.spiteful.avaritia.compat.tsundere.BlockInfinitato;
import fox.spiteful.avaritia.compat.tsundere.TileInfinitato;
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
import fox.spiteful.avaritia.crafting.Grinder;
import fox.spiteful.avaritia.items.LudicrousItems;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -12,6 +15,8 @@ import vazkii.botania.api.BotaniaAPI;
public class Tsundere {
public static Block infinitato;
public static void baka() throws Compat.ItemNotFoundException {
Item resource = Compat.getItem("Botania", "manaResource");
ItemStack gaia = new ItemStack(resource, 1, 14);
@@ -51,6 +56,10 @@ public class Tsundere {
'N', new ItemStack(LudicrousItems.resource, 1, 4),
'n', new ItemStack(LudicrousItems.resource, 1, 3),
});
infinitato = new BlockInfinitato();
GameRegistry.registerBlock(infinitato, "infinitato");
GameRegistry.registerTileEntity(TileInfinitato.class, "Avaritia_Infinitato");
}
private static ItemStack getFlower(String type) throws Compat.ItemNotFoundException {
@@ -0,0 +1,109 @@
package fox.spiteful.avaritia.compat.tsundere;
import net.minecraft.block.BlockContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
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.IIcon;
import net.minecraft.util.MathHelper;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
public class BlockInfinitato extends BlockContainer implements ILexiconable {
public static LexiconEntry lexiconEntry;
public BlockInfinitato() {
super(Material.cloth);
setHardness(0.25F);
setBlockName("infinitato");
float f = 1F / 16F * 4F;
setBlockBounds(f, 0, f, 1F - f, f*3, 1F - f);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
}
@Override
public IIcon getIcon(int side, int meta) {
return Blocks.hardened_clay.getIcon(0, 11);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
if(tile instanceof TileInfinitato) {
((TileInfinitato) tile).jump();
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
}
return true;
}
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
par1World.setBlockMetadataWithNotify(par2, par3, par4, l1, 2);
if (par6ItemStack.hasDisplayName())
((TileInfinitato) par1World.getTileEntity(par2, par3, par4)).name = par6ItemStack.getDisplayName();
}
@Override
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
if(!par6EntityPlayer.capabilities.isCreativeMode)
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> list = new ArrayList();
TileEntity tile = world.getTileEntity(x, y, z);
if(tile != null) {
ItemStack stack = new ItemStack(this);
String name = ((TileInfinitato) tile).name;
if(!name.isEmpty())
stack.setStackDisplayName(name);
list.add(stack);
}
return list;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return RenderInfinitato.renderID;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileInfinitato();
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return lexiconEntry;
}
}
@@ -0,0 +1,24 @@
package fox.spiteful.avaritia.compat.tsundere;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelInfinitato extends ModelBase {
ModelRenderer potato;
public ModelInfinitato() {
textureWidth = 64;
textureHeight = 32;
potato = new ModelRenderer(this, 0, 0);
potato.addBox(0F, 0F, 0F, 8, 12, 8);
potato.setRotationPoint(-4F, 12F, -4F);
potato.setTextureSize(64, 32);
}
public void render() {
potato.render(1F / 16F);
}
}
@@ -0,0 +1,44 @@
package fox.spiteful.avaritia.compat.tsundere;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderInfinitato implements ISimpleBlockRenderingHandler {
public static int renderID;
public RenderInfinitato(int id) {
renderID = id;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.35F, 0.5F);
GL11.glRotated(90, 0, 1, 0);
RenderTileInfinitato.drawHalo = false;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileInfinitato(), 0.0D, 0.0D, 0.0D, 0.0F);
RenderTileInfinitato.drawHalo = true;
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return renderID;
}
}
@@ -0,0 +1,145 @@
package fox.spiteful.avaritia.compat.tsundere;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderTileInfinitato extends TileEntitySpecialRenderer {
public static boolean drawHalo = true;
private static final ResourceLocation texture = new ResourceLocation("avaritia","textures/blocks/infinitato.png");
public static final ResourceLocation halo = new ResourceLocation("avaritia", "textures/items/halo128.png");
private static final ModelInfinitato model = new ModelInfinitato();
@Override
public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) {
TileInfinitato potato = (TileInfinitato) var1;
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glTranslated(d0, d1, d2);
Minecraft mc = Minecraft.getMinecraft();
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glScalef(1F, -1F, -1F);
int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata();
float rotY = meta * 90F - 180F;
GL11.glRotatef(rotY, 0F, 1F, 0F);
float jump = potato.jumpTicks*0.5f;
if(jump > 0)
jump += var8*0.5f;
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2;
if (drawHalo){
mc.renderEngine.bindTexture(halo);
GL11.glPushMatrix();
double xdiff = potato.xCoord + 0.5 - mc.thePlayer.posX;
double ydiff = potato.yCoord + 0.4 - (mc.thePlayer.posY + mc.thePlayer.eyeHeight);
double zdiff = potato.zCoord + 0.5 - mc.thePlayer.posZ;
double len = Math.sqrt(xdiff*xdiff + ydiff*ydiff + zdiff*zdiff);
xdiff /= len;
ydiff /= len;
zdiff /= len;
GL11.glTranslated(xdiff, ydiff, -zdiff);
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
GL11.glRotatef(-rotY, 0F, 1F, 0F);
GL11.glScalef(1F, -1F, -1F);
GL11.glTranslatef(0F, -1.15F, 0F);
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
//GL11.glTranslatef(0F, 0F, -1F);
float f = 1.6F;
float f1 = 0.016666668F * f;
GL11.glScalef(f1, f1, f1);
GL11.glDisable(GL11.GL_LIGHTING);
//GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
GL11.glDepthMask(false);
//GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
tessellator.startDrawingQuads();
int i=60;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
tessellator.addVertexWithUV(-i, -i, 0.0D, 0,0);
tessellator.addVertexWithUV(-i, i, 0.0D, 1,0);
tessellator.addVertexWithUV(i, i, 0.0D, 1,1);
tessellator.addVertexWithUV(i, -i, 0.0D, 0,1);
tessellator.draw();
GL11.glDepthMask(true);
//GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glColor4f(1F, 1F, 1F, 1F);
//GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
GL11.glPopMatrix();
}
GL11.glTranslatef(0F, up, 0F);
GL11.glRotatef(rotZ, 0F, 0F, 1F);
mc.renderEngine.bindTexture(texture);
model.render();
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
GL11.glRotatef(-rotY, 0F, 1F, 0F);
GL11.glColor3f(1F, 1F, 1F);
GL11.glScalef(1F, -1F, -1F);
if(!potato.name.isEmpty()) {
GL11.glPushMatrix();
GL11.glTranslatef(0F, -0.6F, 0F);
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
float f = 1.6F;
float f1 = 0.016666668F * f;
GL11.glScalef(-f1, -f1, f1);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int i = mc.fontRenderer.getStringWidth(potato.name) / 2;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
tessellator.addVertex(-i - 1, -1.0D, 0.0D);
tessellator.addVertex(-i - 1, 8.0D, 0.0D);
tessellator.addVertex(i + 1, 8.0D, 0.0D);
tessellator.addVertex(i + 1, -1.0D, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
mc.fontRenderer.drawString(potato.name, -mc.fontRenderer.getStringWidth(potato.name) / 2, 0, 0xFFFFFF);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
}
@@ -0,0 +1,41 @@
package fox.spiteful.avaritia.compat.tsundere;
import fox.spiteful.avaritia.tile.TileLudicrous;
import net.minecraft.nbt.NBTTagCompound;
public class TileInfinitato extends TileLudicrous {
private static final String TAG_NAME = "name";
public int jumpTicks = 0;
public String name = "";
public void jump() {
if(jumpTicks == 0)
jumpTicks = 40;
}
@Override
public void updateEntity() {
/*if(worldObj.rand.nextInt(100) == 0)
jump();*/
if(jumpTicks > 0) {
jumpTicks--;
if (jumpTicks == 20 || jumpTicks == 0) {
this.worldObj.createExplosion(null, this.xCoord+0.5, this.yCoord, this.zCoord+0.5, 0.0f, true);
}
}
}
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
cmp.setString(TAG_NAME, name);
}
@Override
public void readCustomNBT(NBTTagCompound cmp) {
name = cmp.getString(TAG_NAME);
}
}
@@ -16,9 +16,9 @@ public class ItemSingularity extends Item {
public static final String[] types = new String[]{"iron", "gold", "lapis", "redstone", "quartz", "copper",
"tin", "lead", "silver"};
public static final int[] colors = new int[]{0xBFBFBF, 0xE8EF23, 0x5a82e2, 0xDF0000, 0xE6E6A3, 0xE47200,
public static final int[] colors = new int[]{0xBFBFBF, 0xE8EF23, 0x5a82e2, 0xDF0000, 0xeeebe6, 0xE47200,
0xA5C7DE, 0x444072, 0xF9F9F9};
public static final int[] colors2 = new int[]{0x7F7F7F, 0xdba213, 0x224baf, 0xB20000, 0xBDBDBD, 0x89511A,
public static final int[] colors2 = new int[]{0x7F7F7F, 0xdba213, 0x224baf, 0x900000, 0x94867d, 0x89511A,
0x9BA9B2, 0x3E3D4E, 0xD5D5D5};
public static IIcon background;
public static IIcon foreground;
@@ -5,17 +5,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityNeutron extends TileEntity implements IInventory {
public class TileEntityNeutron extends TileLudicrous implements IInventory {
private ItemStack neutrons;
private int facing = 2;
private int progress;
@Override
public void updateEntity(){
if(++progress >= 10665){
//if(++progress >= 300){
@@ -35,18 +32,17 @@ public class TileEntityNeutron extends TileEntity implements IInventory {
facing = dir;
}
public void readFromNBT(NBTTagCompound tags)
@Override
public void readCustomNBT(NBTTagCompound tag)
{
super.readFromNBT(tags);
this.neutrons = ItemStack.loadItemStackFromNBT(tags.getCompoundTag("Neutrons"));
this.progress = tags.getInteger("Progress");
this.facing = tags.getShort("Facing");
this.neutrons = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Neutrons"));
this.progress = tag.getInteger("Progress");
this.facing = tag.getShort("Facing");
}
public void writeToNBT(NBTTagCompound tag)
@Override
public void writeCustomNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setInteger("Progress", this.progress);
tag.setShort("Facing", (short) this.facing);
if(neutrons != null) {
@@ -56,19 +52,6 @@ public class TileEntityNeutron extends TileEntity implements IInventory {
}
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeToNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
}
@Override
public int getSizeInventory()
{
@@ -137,6 +120,7 @@ public class TileEntityNeutron extends TileEntity implements IInventory {
/**
* Returns the name of the inventory
*/
@Override
public String getInventoryName()
{
return "container.neutron";
@@ -145,6 +129,7 @@ public class TileEntityNeutron extends TileEntity implements IInventory {
/**
* Returns if the inventory is named
*/
@Override
public boolean hasCustomInventoryName()
{
return false;
@@ -0,0 +1,39 @@
package fox.spiteful.avaritia.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileLudicrous extends TileEntity {
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
writeCustomNBT(tag);
}
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
readCustomNBT(tag);
}
public void writeCustomNBT(NBTTagCompound tag) {}
public void readCustomNBT(NBTTagCompound tag) {}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeCustomNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
super.onDataPacket(net, packet);
readCustomNBT(packet.func_148857_g());
}
}
@@ -27,6 +27,7 @@ tile.block_infinity.name=Infinity Block
tile.block_gaia.name=Gaia Block
tile.dire_crafting.name=Dire Crafting Table
tile.neutron_collector.name=Neutron Collector
tile.infinitato.name=Infinitato
#
# Misc
container.neutron_collector=Neutron Collector
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB