This commit is contained in:
tterrag1098 committed 2015-06-22 16:07:00 -04:00
commit 5cc3f2a3e0
9 files changed
+236

No files matched your search

@@ -238,6 +238,19 @@ public enum Features {
}
},
BEACON {
@Override
void addBlocks(){
BlockCarvableBeacon beacon = (BlockCarvableBeacon) new BlockCarvableBeacon().setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
Carving.chisel.addVariation("beacon", Blocks.beacon, 0, 0);
for(int meta = 0; meta < 16; meta++){
beacon.carverHelper.addVariation("tile.beacon." + ItemDye.field_150923_a[meta] + ".desc", meta, "beacon", (meta + 1));
}
beacon.carverHelper.registerAll(beacon, "beacon");
Carving.chisel.registerOre("beacon", "beacon");
}
},
BLOOD_RUNE("AWWayofTime") {
@Override
@@ -0,0 +1,70 @@
package com.cricketcraft.chisel.block;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
import com.cricketcraft.chisel.block.tileentity.TileEntityCarvableBeacon;
import com.cricketcraft.chisel.init.ChiselTabs;
import net.minecraft.block.BlockBeacon;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
public CarvableHelper carverHelper;
public BlockCarvableBeacon() {
super();
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
setLightLevel(5.0F);
carverHelper = new CarvableHelper(this);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCarvableBeacon();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return true;
} else {
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
if (tileentitybeacon != null) {
player.func_146104_a(tileentitybeacon);
}
return true;
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
super.onBlockPlacedBy(world, x, y, z, player, stack);
if (stack.hasDisplayName()) {
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
}
}
@Override
public int getRenderType(){
return 34;
}
@Override
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
public IVariationInfo getVariation(ItemStack stack) {
return carverHelper.getVariation(stack.getItemDamage());
}
}
@@ -0,0 +1,14 @@
package com.cricketcraft.chisel.block.tileentity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityCarvableBeacon extends TileEntityBeacon {
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return INFINITE_EXTENT_AABB;
}
}
@@ -0,0 +1,114 @@
package com.cricketcraft.chisel.client.render.tile;
import com.cricketcraft.chisel.block.tileentity.TileEntityCarvableBeacon;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntityBeaconRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemDye;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class RenderCarvableBeacon extends TileEntityBeaconRenderer{
private static final ResourceLocation texture = new ResourceLocation("textures/entity/beacon_beam.png");
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) {
float f1 = beacon.func_146002_i();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
if(f1 > 0.1F){
Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]);
Tessellator tessellator = Tessellator.instance;
this.bindTexture(texture);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks;
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
byte b0 = 1;
double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
double d5 = (double) b0 * 0.2D;
double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
double d23 = (double) (256.0F * f1);
double d25 = 0.0D;
double d27 = 1.0D;
double d28 = (double) (-1.0F + f3);
double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28;
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28);
tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28);
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28);
tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28);
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28);
tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28);
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28);
tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28);
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
tessellator.draw();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDepthMask(false);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
double d30 = 0.2D;
double d4 = 0.2D;
double d6 = 0.8D;
double d8 = 0.2D;
double d10 = 0.2D;
double d12 = 0.8D;
double d14 = 0.8D;
double d16 = 0.8D;
double d18 = (double) (256.0F * f1);
double d20 = 0.0D;
double d22 = 1.0D;
double d24 = (double) (-1.0F + f3);
double d26 = (double) (256.0F * f1) + d24;
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
}
}
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
this.renderTileEntityAt((TileEntityCarvableBeacon) tile, x, y, z, partialTicks);
}
}
@@ -12,6 +12,7 @@ public final class ChiselBlocks {
public static final Block autoChisel = null;
public static final BlockCarvable antiBlock = null;
public static final BlockCarvableBeacon beacon = null;
public static final BlockCarvable marble = null;
public static final BlockCarvable marble_pillar = null;
public static final BlockCarvable limestone = null;
@@ -1,11 +1,13 @@
package com.cricketcraft.chisel.proxy;
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
import com.cricketcraft.chisel.block.tileentity.TileEntityCarvableBeacon;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import com.cricketcraft.chisel.client.player.PlayerSpecials;
import com.cricketcraft.chisel.client.render.*;
import com.cricketcraft.chisel.client.render.item.ItemChiselRenderer;
import com.cricketcraft.chisel.client.render.tile.RenderAutoChisel;
import com.cricketcraft.chisel.client.render.tile.RenderCarvableBeacon;
import com.cricketcraft.chisel.client.render.tile.RenderPresent;
import com.cricketcraft.chisel.entity.EntityBallOMoss;
import com.cricketcraft.chisel.entity.EntityChiselSnowman;
@@ -46,6 +48,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(rac);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ChiselBlocks.autoChisel), rac);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAutoChisel.class, rac);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCarvableBeacon.class, new RenderCarvableBeacon());
RenderPresent rp = new RenderPresent();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ChiselBlocks.present), rp);
@@ -1,5 +1,6 @@
package com.cricketcraft.chisel.proxy;
import com.cricketcraft.chisel.block.tileentity.TileEntityCarvableBeacon;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -13,6 +14,7 @@ public class CommonProxy {
public void registerTileEntities() {
GameRegistry.registerTileEntity(TileEntityAutoChisel.class, "autoChisel");
GameRegistry.registerTileEntity(TileEntityPresent.class, "tile.chisel.present");
GameRegistry.registerTileEntity(TileEntityCarvableBeacon.class, "tile.chisel.beacon");
}
public void preInit() {