mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-22 05:02:37 +00:00
Vis aura provider rendering!
Rename EfectJarRenderer to RendererEffectJar.
This commit is contained in:
1 parent
a5fed5c9b7
commit
52798c8175
11 files changed
+323
-15
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@@ -19,7 +20,7 @@ public class BlockVisAuraProvider extends BlockContainer {
|
||||
this.setBlockName("visAuraProvider");
|
||||
this.setHardness(0.5f);
|
||||
this.setResistance(1.5f);
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.5f, 0.75f);
|
||||
this.setLightLevel(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,10 +34,16 @@ public class BlockVisAuraProvider extends BlockContainer {
|
||||
return new TileEntityVisAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdVisAuraProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelEffectJar
|
||||
{
|
||||
public static final String objFile = CommonProxy.MODEL_PATH + "effectJar.obj";
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "effectJar.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
|
||||
|
||||
public static final ModelEffectJar model = new ModelEffectJar();
|
||||
@@ -20,7 +20,7 @@ public class ModelEffectJar
|
||||
|
||||
public ModelEffectJar()
|
||||
{
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(new ResourceLocation("magicbees", "model/effectJar.obj"));
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelVisAuraProvider {
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float)(Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float)(Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float)(Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EffectJarRenderer extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
{
|
||||
public static EffectJarRenderer instance = new EffectJarRenderer();
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
||||
@@ -0,0 +1,50 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import magicbees.client.model.ModelVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package magicbees.main;
|
||||
|
||||
import magicbees.client.render.RendererEffectJar;
|
||||
import magicbees.client.render.RendererVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.render.EffectJarRenderer;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy
|
||||
@@ -18,7 +20,11 @@ public class ClientProxy extends CommonProxy
|
||||
super.registerRenderers();
|
||||
|
||||
RenderIdEffectJar = RenderingRegistry.getNextAvailableRenderId();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.effectJar), EffectJarRenderer.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, EffectJarRenderer.instance);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.effectJar), RendererEffectJar.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, RendererEffectJar.instance);
|
||||
|
||||
RenderIdVisAuraProvider = RenderingRegistry.getNextAvailableRenderId();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.visAuraProvider), RendererVisAuraProvider.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVisAuraProvider.class, RendererVisAuraProvider.instance);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class CommonProxy
|
||||
public static final String GUI_PATH = TEXTURE_PATH + "gui/";
|
||||
|
||||
public static int RenderIdEffectJar;
|
||||
public static int RenderIdVisAuraProvider;
|
||||
|
||||
public void registerRenderers() { }
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory
|
||||
private static final int SLOT_PRODUCTS_COUNT = 7;
|
||||
|
||||
private static final int AURAPROVIDER_SEARCH_RADIUS = 6;
|
||||
private static int CHARGE_TIME_MUTATION = 1200;
|
||||
private static int MAX_BLOCKS_SEARCH_PER_CHECK = (AURAPROVIDER_SEARCH_RADIUS * 2 + 1) * 8;
|
||||
private static int CHARGE_TIME_MUTATION = 850;
|
||||
private static int CHARGE_TIME_DEATH = 400;
|
||||
private static int CHARGE_TIME_PRODUCTION = 300;
|
||||
|
||||
@@ -698,7 +699,6 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory
|
||||
}
|
||||
}
|
||||
|
||||
private static int MAX_BLOCKS_SEARCH_PER_CHECK = (AURAPROVIDER_SEARCH_RADIUS * 2 + 1) * 12;
|
||||
private void findAuraProvider() {
|
||||
if (worldObj.getTotalWorldTime() % 10 != 0) {
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
int currentDeathCharges;
|
||||
int currentProductionCharges;
|
||||
|
||||
private static final int VIS_PER_CHARGE = 10;
|
||||
private static final int VIS_PER_CHARGE = 8;
|
||||
private static Aspect ASPECT_MUTATION = Aspect.WATER;
|
||||
private static Aspect ASPECT_DEATH = Aspect.ENTROPY;
|
||||
private static Aspect ASPECT_PRODUCTION = Aspect.AIR;
|
||||
|
||||
Reference in new issue
Block a user