Fancy Render system, leaves, lang changes, leaf description added

This commit is contained in:
TheCricket committed 2014-11-24 18:48:10 -05:00
1 parent 0ccfc9025f
commit 5fcdaf5dee
16 files changed
+3074 -2912

No files matched your search

@@ -16,6 +16,7 @@ public class Configurations
public static boolean enableChiseling;
public static boolean chiselRecipe;
public static boolean autoChisel;
public static boolean fancy;
public static int factoryBlockAmount;
public static int particlesTickrate;
@@ -30,6 +31,7 @@ public class Configurations
particlesTickrate = config.get("client", "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1);
oldPillars = config.get("client", "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false);
disableCTM = !config.get("client", "connectedTextures", true, "Enable connected textures").getBoolean(true);
fancy = config.get("client", "fancyLeaves", true, "Enable fancy textures").getBoolean(true);
blockDescriptions = config.get("client", "tooltipsUseBlockDescriptions", true, "Make variations of blocks have the same name, and use the description in tooltip to distinguish them.").getBoolean(true);
chiselStoneToCobbleBricks = config.get("general", "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left-click.").getBoolean(true);
enableChiseling = config.get("general", "enableChiselingLeftClicking", false, "Change blocks to another block using the Chisel and left-click.").getBoolean(false);
@@ -20,16 +20,17 @@ import java.util.List;
public class BlockCarvable extends Block implements ICarvable
{
public CarvableHelper carverHelper;
private boolean isAlpha;
private boolean isAlpha, isOpaque;
public BlockCarvable()
{
this(Material.rock);
this(Material.rock, true);
}
public BlockCarvable(Material m)
public BlockCarvable(Material m, boolean isOpaque)
{
super(m);
this.isOpaque = isOpaque;
carverHelper = new CarvableHelper();
setCreativeTab(ModTabs.tabChiselBlocks);
}
@@ -71,6 +72,11 @@ public class BlockCarvable extends Block implements ICarvable
carverHelper.registerBlockIcons("Chisel", this, register);
}
@Override
public boolean isOpaqueCube(){
return this.isOpaque;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list)
{
@@ -7,7 +7,7 @@ public class BlockCarvablePowered extends BlockCarvable
{
public BlockCarvablePowered(Material m)
{
super(m);
super(m, false);
}
/**
@@ -16,7 +16,7 @@ public class BlockCloud extends BlockCarvable
public BlockCloud()
{
super(Material.ice);
super(Material.ice, false);
useNeighborBrightness = true;
}
@@ -15,7 +15,7 @@ public class BlockHolystone extends BlockCarvable
public BlockHolystone(Material m)
{
super(m);
super(m, false);
this.setLightLevel(0.25F);
}
@@ -11,7 +11,7 @@ public class BlockLightstoneCarvable extends BlockCarvable
{
public BlockLightstoneCarvable()
{
super(Material.glass);
super(Material.glass, false);
}
@Override
@@ -17,7 +17,7 @@ public class BlockMarbleLamp extends BlockCarvable
public BlockMarbleLamp()
{
super(Material.redstoneLight);
super(Material.redstoneLight, false);
powered = false;
blockUnpowered = this;
@@ -28,7 +28,7 @@ public class BlockMarbleLamp extends BlockCarvable
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion)
{
super(Material.redstoneLight);
super(Material.redstoneLight, false);
carverHelper = unpoweredVersion.carverHelper;
@@ -12,7 +12,7 @@ public class BlockMarblePillar extends BlockCarvable
public BlockMarblePillar(Material m)
{
super(m);
super(m, false);
}
@Override
@@ -1,10 +1,13 @@
package info.jbcs.minecraft.chisel.block.tileentity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
import info.jbcs.minecraft.chisel.carving.Carving;
import info.jbcs.minecraft.chisel.carving.CarvingVariation;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemBlock;
@@ -20,6 +23,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory{
private ItemStack[] inventory = new ItemStack[3];
private String name = "autoChisel";
private static EntityItem ghostItem;
boolean equal = false;
@Override
@@ -223,6 +227,21 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory{
NBTTagList tags = new NBTTagList();
System.out.print(tags);
}
@SideOnly(Side.CLIENT)
public EntityItem getItemForRendering(int slot){
if(ghostItem == null){
ghostItem = new EntityItem(worldObj);
ghostItem.hoverStart = 0.0F;
}
if(inventory[slot] == null){
return null;
} else {
ghostItem.setEntityItemStack(new ItemStack(inventory[slot].getItem(), 1, inventory[slot].getItemDamage()));
return ghostItem;
}
}
@Override
public Packet getDescriptionPacket() {
@@ -1,28 +1,108 @@
package info.jbcs.minecraft.chisel.client.render.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
import info.jbcs.minecraft.chisel.client.model.ModelAutoChisel;
import info.jbcs.minecraft.chisel.init.ModItems;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import static org.lwjgl.opengl.GL11.*;
public class RenderAutoChisel extends TileEntitySpecialRenderer {
private final ModelAutoChisel model;
private final ResourceLocation texture = new ResourceLocation("chisel:textures/blocks/autoChisel.png");
private final RenderItem renderTargetAndChisel, renderBase;
private static EntityItem ghostItem;
private static TileEntityAutoChisel autoChisel;
public RenderAutoChisel(){
model = new ModelAutoChisel();
renderTargetAndChisel = new RenderItem(){
@Override
public boolean shouldBob(){
return false;
}
};
renderTargetAndChisel.setRenderManager(RenderManager.instance);
renderBase = new RenderItem(){
@Override
public boolean shouldBob(){
return true;
}
};
renderBase.setRenderManager(RenderManager.instance);
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
bindTexture(texture);
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(0.89F, 1.0F, 0.89F);
glPushMatrix();
glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
glRotatef(180F, 0.0F, 0.0F, 1.0F);
glScalef(0.89F, 1.0F, 0.89F);
this.model.renderAll();
GL11.glPopMatrix();
glPopMatrix();
//Render Blocks
autoChisel = (TileEntityAutoChisel) tile;
EntityItem item = autoChisel.getItemForRendering(1);
if(item != null){
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
GL11.glScaled(3, 3, 3);
renderTargetAndChisel.doRender(item, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}
EntityItem item2 = autoChisel.getItemForRendering(0);
if(item2 != null){
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glScaled(1, 1, 1);
renderBase.doRender(item2, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}
EntityItem chisel = getGhostItem(autoChisel.getWorldObj(), new ItemStack(ModItems.chisel));
if(chisel != null){
GL11.glPushMatrix();
GL11.glTranslated(x + 1.5, y + 1.5, z + 1.5);
GL11.glScaled(1, 1, 1);
renderTargetAndChisel.doRender(chisel, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}
}
@SideOnly(Side.CLIENT)
public EntityItem getGhostItem(World world, ItemStack itemStack){
if(ghostItem == null){
ghostItem = new EntityItem(world);
ghostItem.hoverStart = 0.0F;
}
if(itemStack == null){
return null;
} else {
ghostItem.setEntityItemStack(itemStack);
return ghostItem;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -3,15 +3,24 @@ package info.jbcs.minecraft.chisel.utils;
import java.util.HashMap;
import java.util.Random;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import scala.collection.parallel.ParIterableLike;
public class GeneralClient
{
public static Random rand = new Random();
private static EntityItem ghostItem;
public static void playChiselSound(World world, int x, int y, int z, String sound)
{
@@ -38,4 +47,5 @@ public class GeneralClient
Minecraft.getMinecraft().getTextureManager().bindTexture(res);
}
}