Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RenderRadiationBubble extends Render<EntityRadiationBubble> {
- private RenderHelper.UsableModel model;
- protected RenderRadiationBubble(RenderManager renderManager) {
- super(renderManager);
- model = RenderHelper.LoadOBJ(new ResourceLocation(AncientAddinMod.MODID, "models/sphere.obj"));
- }
- public void doRender(EntityRadiationBubble entity, double x, double y, double z, float entityYaw, float partialTicks) {
- GlStateManager.pushMatrix();
- GlStateManager.scale(1, 1, 1);
- GlStateManager.translate(x, y, z);
- GlStateManager.color(0, 1.0f, 0, 1.0f);
- RenderHelper.DrawModel(model);
- GlStateManager.popMatrix();
- }
- @Nullable
- protected ResourceLocation getEntityTexture(EntityRadiationBubble entity) {
- return TextureMap.LOCATION_BLOCKS_TEXTURE;
- }
- }
- public class RenderHelper {
- public static class UsableModel {
- private IBakedModel Model;
- private VertexFormat VFormat;
- private UsableModel(IBakedModel bm, VertexFormat fmt) {
- Model = bm;
- VFormat = fmt;
- }
- }
- public static UsableModel LoadOBJ(ResourceLocation loc) {
- IBakedModel fres = null;
- try {
- IModel tmp = OBJLoader.INSTANCE.loadModel(loc);
- fres = tmp.bake(tmp.getDefaultState(), DefaultVertexFormats.POSITION_TEX_NORMAL, ModelLoader.defaultTextureGetter());
- } catch (Exception e) {
- e.printStackTrace();
- }
- return (new UsableModel(fres, DefaultVertexFormats.POSITION_TEX_NORMAL));
- }
- public static void DrawModel(UsableModel model) {
- Tessellator t = Tessellator.getInstance();
- VertexBuffer vb = t.getBuffer();
- vb.begin(GL11.GL_QUADS, model.VFormat);
- for (BakedQuad q : model.Model.getQuads(null, null, 0)) {
- vb.addVertexData(q.getVertexData());
- }
- t.draw();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement