Jump to content

weiblecr

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by weiblecr

  1. I searched all of the place getting it as far as it was ... mainly for ItemStackTileEntity and "Custom Shield" ... I hadn't searched just for Shield. I'll give this a look, looks promising .... Darco18s ... my texture does exist, log doesn't say much if anything about it. Will follow up with more detail if the below topic doesn't help!
  2. I am trying to make a custom shield, right now, I would just like it to render the shield_base from my mod's resources!! Most of the stuff I've take from existing code and started to update ... anything that can help would be greatly appreciated! I'm think it's having issues with the AtlasTextures, this is my first one of those, please be nice BlueShieldRenderer.java package weible.rupeehunt.item.blueshield; import java.util.Iterator; import java.util.List; import org.apache.logging.log4j.Level; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.entity.model.ShieldModel; import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.tileentity.BannerTileEntityRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.DyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.ShieldItem; import net.minecraft.resources.IResource; import net.minecraft.tileentity.BannerPattern; import net.minecraft.tileentity.BannerTileEntity; import net.minecraft.util.ResourceLocation; import weible.rupeehunt.RupeeHuntMod; import weible.rupeehunt.init.ModItems; public class BlueShieldRenderer extends ItemStackTileEntityRenderer { private final BlueShieldModel modelShield = new BlueShieldModel(); public static final Material BLUE_SHIELD_BASE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(RupeeHuntMod.modId, "textures/items/blueshield.png")); public static final Material MINECRAFT_SHIELD_BASE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(RupeeHuntMod.modId, "textures/items/shield_base.png")); @Override public void render(ItemStack itemStackIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { //RupeeHuntMod.LOGGER.log(Level.INFO, "Inside Blue Shield Renderer"); Item item = itemStackIn.getItem(); if (item == ModItems.BLUESHIELD) { //boolean flag = itemStackIn.getChildTag("BlockEntityTag") != null; matrixStackIn.push(); matrixStackIn.scale(1.0F, -1.0F, -1.0F); Material material = MINECRAFT_SHIELD_BASE; //RupeeHuntMod.LOGGER.log(Level.INFO, "Shield Base Material:" + MINECRAFT_SHIELD_BASE.getAtlasLocation() + " " + MINECRAFT_SHIELD_BASE.getTextureLocation()); RupeeHuntMod.LOGGER.log(Level.INFO, MINECRAFT_SHIELD_BASE.toString()); IVertexBuilder ivertexbuilder = material.getSprite().wrapBuffer(ItemRenderer.getBuffer(bufferIn, this.modelShield.getRenderType(material.getAtlasLocation()), false, itemStackIn.hasEffect())); this.modelShield.getHandleModelRenderer().render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn, 1.0F, 1.0F, 1.0F, 1.0F); this.modelShield.getPlateModelRenderer().render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn, 1.0F, 1.0F, 1.0F, 1.0F); matrixStackIn.pop(); } } } BlueShieldModel.java package weible.rupeehunt.item.blueshield; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.Model; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class BlueShieldModel extends Model { private final ModelRenderer plate; private final ModelRenderer handle; public BlueShieldModel() { super(RenderType::getEntitySolid); this.textureWidth = 64; this.textureHeight = 64; this.plate = new ModelRenderer(this, 0, 0); this.plate.addBox(-6.0F, -11.0F, -2.0F, 12.0F, 22.0F, 1.0F, 0.0F); this.handle = new ModelRenderer(this, 26, 0); this.handle.addBox(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, 0.0F); } public ModelRenderer getPlateModelRenderer() { return this.plate; } public ModelRenderer getHandleModelRenderer() { return this.handle; } public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { this.plate.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); this.handle.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); } }
  3. I'm attempting to create a custom brewing stand and ran into an interesting problem. I'm trying to spawn particles when the custom brewing stand is actually brewing, but getting mixed results. Note, my custom object right now is pretty much a copy of the original!! To doi this I am calling a method spawnProcessingParticle inside the ChuProcessorTileEntity.tick() method... I posted the tick method below along with two places I am trying to call spawnProcessingParticle() .... I have the placements in BOLD. Placement #1 Logs (Interesting because it calls the render): [03Apr2020 22:25:28.606] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0) [03Apr2020 22:25:28.678] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0) [03Apr2020 22:25:28.687] [Render thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0) [03Apr2020 22:25:28.710] [Render thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0) Placement #2 Logs (Doesn't call the render): [03Apr2020 22:43:57.059] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(398) [03Apr2020 22:43:57.103] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(397) [03Apr2020 22:43:57.155] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(396) [03Apr2020 22:43:57.202] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(395) public void spawnProcessingParticle() { double d0 = (double)this.getPos().getX() + 0.4D; double d1 = (double)this.getPos().getY() + 0.7D; double d2 = (double)this.getPos().getZ() + 0.4D; RupeeHuntMod.LOGGER.log(Level.INFO, "Spawning World Particle at ("+d0+","+d1+","+d2+"), BT("+this.brewTime+")"); for(int i = 0; i<100;i++) { this.world.addParticle(ParticleTypes.HAPPY_VILLAGER, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } ----------------- public void tick() { ItemStack itemstack = this.brewingItemStacks.get(4); if (this.fuel <= 0 && itemstack.getItem() == Items.BLAZE_POWDER) { this.fuel = 20; itemstack.shrink(1); this.markDirty(); } /* PLACEMENT NUMBER 1) THIS WORKS AND SPAWNS PARTICLES, BUT DOESN'T MEET THE DESIRE spawnProcessingParticle(); */ boolean flag = this.canBrew(); boolean flag1 = this.brewTime > 0; ItemStack itemstack1 = this.brewingItemStacks.get(3); if (flag1) { --this.brewTime; boolean flag2 = this.brewTime == 0; if (flag2 && flag) { this.brewPotions(); this.markDirty(); /* PLACEMENT NUMBER 2) THIS MEETS THE DESIRES BY CALLING THE METHOD, BUT PARTICLES NEVER RENDER spawnProcessingParticle(); */ } else if (!flag) { this.brewTime = 0; this.markDirty(); } else if (this.ingredientID != itemstack1.getItem()) { this.brewTime = 0; this.markDirty(); } } else if (flag && this.fuel > 0) { --this.fuel; this.brewTime = 400; this.isBrewing = true; this.ingredientID = itemstack1.getItem(); this.markDirty(); } if (!this.world.isRemote) { boolean[] aboolean = this.createFilledSlotsArray(); if (!Arrays.equals(aboolean, this.filledSlots)) { this.filledSlots = aboolean; BlockState blockstate = this.world.getBlockState(this.getPos()); if (!(blockstate.getBlock() instanceof ChuProcessorBlock)) { return; } for(int i = 0; i < ChuProcessorBlock.HAS_BOTTLE.length; ++i) { blockstate = blockstate.with(ChuProcessorBlock.HAS_BOTTLE, Boolean.valueOf(aboolean)); } } } } Anyway, curious on ideas, or why this is only Rendering at certain points in the code ..... I'm a little new to TileEntities .... so hopefully I'm not doing something completely not right ... any help would be appreciated!
  4. private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); RenderTypeLookup.setRenderLayer(ModBlocks.CHAINMAIL_TRANS_BLOCK, RenderType.getCutout()); } Thanks!!! Worked like a champ!
  5. I just started updating my mods from 1.14.4-28.1.109 to 1.15.2-31.1.18 ... I have a chain mail block that was previously rendering with opacity ...... Here is the code I used previously .. (1.14) public static final Block CHAINMAIL_TRANS_BLOCK = new GlassBlock( Block.Properties.create(Material.GLASS) .hardnessAndResistance(1f, 5f) .sound(SoundType.SCAFFOLDING) ); On port over to the 1.15 version this no longer works ... I looked at the Blocks class and am currently attempting .... public static final Block CHAINMAIL_TRANS_BLOCK = new GlassBlock( Block.Properties.create(Material.GLASS) .hardnessAndResistance(0.3F) .sound(SoundType.GLASS) .notSolid() ); But no joy .... any pointers would be appreciated ....
  6. I'm new to modding so been plowing through tutorials, I created my first items and blocks and am now venturing into custom entities. I'm trying to created a custom dog (EntityDog). I think I've got things layed out right, but the dogs body looks like it's rotated ninety degrees and I am struggling to figure out why. I basically copied the ModelWolf and RenderWolf class hoping that would help me narrow in on my error but it's not. Help would be greatly appreciated! package weible.ultramod.client.render; import weible.ultramod.client.model.ModelWolf; import weible.ultramod.entity.EntityDog; import weible.ultramod.client.render.LayerWolfCollar; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; //import net.minecraft.entity.passive.EntityWolf; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderWolf extends RenderLiving<EntityDog> { private static final ResourceLocation DOGTEXTURE = new ResourceLocation("ultramod:textures/entity/dog/dog.png"); private static final ResourceLocation WOLFTEXTURE = new ResourceLocation("textures/entity/wolf/wolf_tame.png"); public RenderWolf(RenderManager p_i47187_1_) { super(p_i47187_1_, new ModelWolf(), 0.5F); this.addLayer(new LayerWolfCollar(this)); } /** * Defines what float the third param in setRotationAngles of ModelBase is */ protected float handleRotationFloat(EntityDog livingBase, float partialTicks) { return livingBase.getTailRotation(); } /** * Renders the desired {@code T} type Entity. */ public void doRender(EntityDog entity, double x, double y, double z, float entityYaw, float partialTicks) { if (entity.isWolfWet()) { float f = entity.getBrightness(partialTicks) * entity.getShadingWhileWet(partialTicks); GlStateManager.color(f, f, f); } super.doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityDog entity) { return DOGTEXTURE; } } package weible.ultramod.client.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelWolf extends ModelBase { public ModelRenderer wolfHeadMain; public ModelRenderer wolfBody; public ModelRenderer wolfLeg1; public ModelRenderer wolfLeg2; public ModelRenderer wolfLeg3; public ModelRenderer wolfLeg4; ModelRenderer wolfTail; ModelRenderer wolfMane; public ModelWolf() { float f = 0.0F; float f1 = 13.5F; this.wolfHeadMain = new ModelRenderer(this, 0, 0); this.wolfHeadMain.addBox(-2.0F, -3.0F, -2.0F, 6, 6, 4, 0.0F); this.wolfHeadMain.setRotationPoint(-1.0F, 13.5F, -7.0F); this.wolfBody = new ModelRenderer(this, 18, 14); this.wolfBody.addBox(-3.0F, -2.0F, -3.0F, 6, 9, 6, 0.0F); this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); this.wolfMane = new ModelRenderer(this, 21, 0); this.wolfMane.addBox(-3.0F, -3.0F, -3.0F, 8, 6, 7, 0.0F); this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); this.wolfLeg1 = new ModelRenderer(this, 0, 18); this.wolfLeg1.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F); this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); this.wolfLeg2 = new ModelRenderer(this, 0, 18); this.wolfLeg2.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F); this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); this.wolfLeg3 = new ModelRenderer(this, 0, 18); this.wolfLeg3.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F); this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); this.wolfLeg4 = new ModelRenderer(this, 0, 18); this.wolfLeg4.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F); this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); this.wolfTail = new ModelRenderer(this, 9, 18); this.wolfTail.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F); this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); this.wolfHeadMain.setTextureOffset(16, 14).addBox(-2.0F, -5.0F, 0.0F, 2, 2, 1, 0.0F); this.wolfHeadMain.setTextureOffset(16, 14).addBox(2.0F, -5.0F, 0.0F, 2, 2, 1, 0.0F); this.wolfHeadMain.setTextureOffset(0, 10).addBox(-0.5F, 0.0F, -5.0F, 3, 3, 4, 0.0F); } public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); if (this.isChild) { float f = 2.0F; GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale); this.wolfHeadMain.renderWithRotation(scale); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); this.wolfBody.render(scale); this.wolfLeg1.render(scale); this.wolfLeg2.render(scale); this.wolfLeg3.render(scale); this.wolfLeg4.render(scale); this.wolfTail.renderWithRotation(scale); this.wolfMane.render(scale); GlStateManager.popMatrix(); } else { this.wolfHeadMain.renderWithRotation(scale); this.wolfBody.render(scale); this.wolfLeg1.render(scale); this.wolfLeg2.render(scale); this.wolfLeg3.render(scale); this.wolfLeg4.render(scale); this.wolfTail.renderWithRotation(scale); this.wolfMane.render(scale); } } public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); this.wolfHeadMain.rotateAngleX = headPitch * 0.017453292F; this.wolfHeadMain.rotateAngleY = netHeadYaw * 0.017453292F; this.wolfTail.rotateAngleX = ageInTicks; } } package weible.ultramod.entity; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; import weible.ultramod.client.model.ModelDeadCow; import weible.ultramod.client.model.ModelDog; import weible.ultramod.client.model.ModelDogDecent; import weible.ultramod.client.model.ModelWolf; import weible.ultramod.client.render.RenderDeadCow; import weible.ultramod.client.render.RenderDog; import weible.ultramod.client.render.RenderStandardDog; import weible.ultramod.client.render.RenderWolf; public class ModEntities { public static void init() { MobRegistryProcessor mbpr = new MobRegistryProcessor(); mbpr.registerEntity(EntityDeadCow.class, "dead_cow"); mbpr.registerEntity(EntityDog.class, "hershey"); RenderingRegistry.registerEntityRenderingHandler(EntityDog.class, new IRenderFactory<EntityDog>() { @Override public Render<EntityDog> createRenderFor(RenderManager manager) { // return new RenderWolf(manager, new ModelWolf(), 0.5F); return new RenderWolf(manager); } } ); RenderingRegistry.registerEntityRenderingHandler(EntityDeadCow.class, new IRenderFactory<EntityDeadCow>() { @Override public Render<EntityDeadCow> createRenderFor(RenderManager manager) { return new RenderDeadCow(manager, new ModelDeadCow(), 0.5F); } } ); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.