Altar blocks getting closer to done, all that's left is some brightness bugs and the lack of gem drops
This commit is contained in:
parent
0238c806d5
commit
c43dd31d6e
5 changed files with 89 additions and 47 deletions
|
@ -17,6 +17,7 @@ import biomesoplenty.api.Items;
|
|||
import biomesoplenty.blocks.renderers.AltarRenderer;
|
||||
import biomesoplenty.blocks.renderers.FoliageRenderer;
|
||||
import biomesoplenty.blocks.renderers.PlantsRenderer;
|
||||
import biomesoplenty.blocks.renderers.RenderUtils;
|
||||
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
|
||||
import biomesoplenty.items.projectiles.EntityDart;
|
||||
import biomesoplenty.items.projectiles.EntityMudball;
|
||||
|
@ -34,6 +35,8 @@ public class ClientProxy extends CommonProxy {
|
|||
@Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
RenderUtils.altarModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(Items.mudball.get(), 0));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart());
|
||||
//RenderingRegistry.registerEntityRenderingHandler(EntityPoisonDart.class, new RenderPoisonDart());
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package biomesoplenty.blocks;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -16,6 +20,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -25,6 +32,7 @@ import biomesoplenty.BiomesOPlenty;
|
|||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.api.Items;
|
||||
import biomesoplenty.blocks.renderers.AltarRenderer;
|
||||
import biomesoplenty.blocks.renderers.RenderUtils;
|
||||
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
|
||||
import biomesoplenty.tileentity.TileEntityAltar;
|
||||
|
||||
|
@ -111,9 +119,10 @@ public class BlockAltar extends Block
|
|||
if (!world.isRemote)
|
||||
{
|
||||
tileentityaltar.setPresent(equippedItem.getItemName(), true);
|
||||
System.out.println(equippedItem.getItemName());
|
||||
--equippedItem.stackSize;
|
||||
}
|
||||
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
|
@ -125,7 +134,6 @@ public class BlockAltar extends Block
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
|
||||
|
@ -149,7 +157,7 @@ public class BlockAltar extends Block
|
|||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return AltarRenderer.altarModel;
|
||||
return RenderUtils.altarModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,40 +168,37 @@ public class BlockAltar extends Block
|
|||
|
||||
if (tileentityaltar != null)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
if (tileentityaltar.getPresent("ruby"));
|
||||
{
|
||||
if (tileentityaltar.getPresent("ruby"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 10));
|
||||
}
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 10));
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("peridot"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 11));
|
||||
}
|
||||
if (tileentityaltar.getPresent("peridot"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 11));
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("topaz"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 12));
|
||||
}
|
||||
if (tileentityaltar.getPresent("topaz"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 12));
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("tanzanite"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 13));
|
||||
}
|
||||
if (tileentityaltar.getPresent("tanzanite"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 13));
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("apatite"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 14));
|
||||
}
|
||||
if (tileentityaltar.getPresent("apatite"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 14));
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("sapphire"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 15));
|
||||
}
|
||||
if (tileentityaltar.getPresent("sapphire"));
|
||||
{
|
||||
ret.add(new ItemStack(Items.miscItems.get(), 1, 15));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret.add(new ItemStack(Blocks.altar.get().blockID, 1, 0));
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -18,63 +18,48 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
|||
|
||||
public class AltarRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int altarModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
TileEntityAltar tileentityaltar = (TileEntityAltar) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (modelId == altarModel)
|
||||
if (modelId == RenderUtils.altarModel)
|
||||
{
|
||||
if (tileentityaltar != null)
|
||||
{
|
||||
renderer.renderAllFaces = false;
|
||||
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.altarFrame, world, x, y, z);
|
||||
|
||||
if (tileentityaltar.getPresent("apatite"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.frameApatite, world, x, y, z);
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("peridot"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.framePeridot, world, x, y, z);
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("ruby"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.frameRuby, world, x, y, z);
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("sapphire"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.frameSapphire, world, x, y, z);
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("tanzanite"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.frameTanzanite, world, x, y, z);
|
||||
}
|
||||
|
||||
if (tileentityaltar.getPresent("topaz"))
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderAltarSlotFaces(renderer, block, BlockAltar.frameTopaz, world, x, y, z);
|
||||
}
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
|
||||
renderer.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +92,6 @@ public class AltarRenderer implements ISimpleBlockRenderingHandler
|
|||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return altarModel;
|
||||
return RenderUtils.altarModel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package biomesoplenty.blocks.renderers;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
|
@ -13,6 +15,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
public class RenderUtils
|
||||
{
|
||||
public static int altarModel = -1;
|
||||
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
@ -671,7 +675,7 @@ public class RenderUtils
|
|||
}
|
||||
|
||||
private static boolean renderFaceWithColorMultiplier(RenderBlocks renderer, Block block, IBlockAccess world, Icon icon, int x, int y, int z, float r, float g, float b, int brightness, ForgeDirection face) {
|
||||
renderer.enableAO = false;
|
||||
//renderer.enableAO = false;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
boolean flag = false;
|
||||
float yMod = 0.5F;
|
||||
|
|
|
@ -2,7 +2,11 @@ package biomesoplenty.tileentity;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -39,6 +43,47 @@ public class TileEntityAltar extends TileEntity
|
|||
nbt.setBoolean("topazPresent", topazPresent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
nbt.setBoolean("apatitePresent", apatitePresent);
|
||||
nbt.setBoolean("peridotPresent", peridotPresent);
|
||||
nbt.setBoolean("rubyPresent", rubyPresent);
|
||||
nbt.setBoolean("sapphirePresent", sapphirePresent);
|
||||
nbt.setBoolean("tanzanitePresent", tanzanitePresent);
|
||||
nbt.setBoolean("topazPresent", topazPresent);
|
||||
|
||||
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(INetworkManager var1, Packet132TileEntityData packet)
|
||||
{
|
||||
//if (this.worldObj.isRemote)
|
||||
//{
|
||||
if (packet.actionType == 0)
|
||||
{
|
||||
this.apatitePresent = packet.customParam1.getBoolean("apatitePresent");
|
||||
this.peridotPresent = packet.customParam1.getBoolean("peridotPresent");
|
||||
this.rubyPresent = packet.customParam1.getBoolean("rubyPresent");
|
||||
this.sapphirePresent = packet.customParam1.getBoolean("sapphirePresent");
|
||||
this.tanzanitePresent = packet.customParam1.getBoolean("tanzanitePresent");
|
||||
this.topazPresent = packet.customParam1.getBoolean("topazPresent");
|
||||
}
|
||||
//}
|
||||
|
||||
this.worldObj.markBlockForUpdate(packet.xPosition, packet.yPosition, packet.zPosition);
|
||||
}
|
||||
|
||||
public void setPresent(String presentGem, boolean state)
|
||||
{
|
||||
if (presentGem == "apatite")
|
||||
|
|
Loading…
Reference in a new issue