Jump to content

BlueMond

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by BlueMond

  1. Hmm, that's odd, cus I don't think they really have much of a super. There's the base read/write nbt for entity and then there is the read/write additional nbt, which I'm using. Last I checked, there isn't really a body to the super of them. Could be wrong, but I can't check right now. EDIT: Though I do believe that there is an issue with my read/write additional nbt methods. It seems that it is not despawning on reload, but instead, failing to save/load. I commented out the body of my read/write additional nbt methods and it saves/loads just fine. No errors that I've seen though.
  2. I have a custom basic entity that happens to despawn whenever I reload the save. It's not a living entity. Afaik, it wasn't doing this before, but I don't know when it started happening. Does anyone have any idea of where this issue could be originating from? Here is a link to the entity class. The rest of the repo is also there, if necessary. https://github.com/BlueMond/BlueMagic/blob/master/src/main/java/me/bluemond/bluemagic/entities/EmpowermentEntity.java
  3. Alright, I'll look into it. EDIT: So I've looked into the item renderer and I dont see any special culling within the render function, but it does seem like whatever rendertype it is using for the buffer in the vertexbuilder could be affecting whether or not it is visible through the block. EDIT 2: Now that I think of it, I might benefit from using the EntityItemRenderer, rather than the ItemRenderer. Item Entities seem to be able to be seen from within translucent blocks, for example, water. EDIT 3: So I can't seem to find where and how an ItemEntity is rendered. Anyone know about that?
  4. So I've made an entity that has a part of the model that is a translucent cube, and now I'm trying to render an item from the entity within that translucent cube. I can see that the item is rendering, since it peeks out of the cube a bit, but I can't see the item through the translucent cube. I'm not that great with rendering since I've only recently begun modding Minecraft, so I need a bit of help figuring out how to get the item to be visible through the translucent cube. Here is what it looks like. Here is the renderer class that it uses. package me.bluemond.bluemagic.client.entity.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import me.bluemond.bluemagic.BlueMagic; import me.bluemond.bluemagic.client.entity.model.EmpowermentEntityModel; import me.bluemond.bluemagic.entities.EmpowermentEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; import software.bernie.geckolib.render.IModelRenderer; public class EmpowermentEntityRenderer extends EntityRenderer<EmpowermentEntity> implements IModelRenderer { protected static final ResourceLocation TEXTURE = new ResourceLocation(BlueMagic.MOD_ID, "textures/entity/empowerment_entity.png"); protected final EmpowermentEntityModel empowermentModel = new EmpowermentEntityModel(); public EmpowermentEntityRenderer(EntityRendererManager renderManager) { super(renderManager); this.shadowSize = 0.5f; } @Override public void render(EmpowermentEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { this.empowermentModel.setRotationAngles(entityIn, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); this.empowermentModel.setLivingAnimations(entityIn, 0, 0, partialTicks); IVertexBuilder iVertexBuilder = bufferIn.getBuffer(RenderType.getEntityTranslucent(this.getEntityTexture(entityIn))); this.empowermentModel.render(matrixStackIn, iVertexBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); if(entityIn.getPotionStack() != null){ matrixStackIn.push(); matrixStackIn.translate(0, 1, 0); matrixStackIn.scale(0.5F, 0.5F, 0.5F); Minecraft.getInstance().getItemRenderer().renderItem(entityIn.getPotionStack(), ItemCameraTransforms.TransformType.FIXED, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn); matrixStackIn.pop(); } } @Override public ResourceLocation getEntityTexture(EmpowermentEntity entity){ return TEXTURE; } @Override public EntityModel getEntityModel() { return this.empowermentModel; } }
  5. Oh, I gotcha. I'll use the other entity renderer's as reference, thanks.
  6. I finished setting up my first custom basic entity, but the model for the entity isn't rendering when I summon the entity in. I'm guessing I can attribute it to the fact that the model isn't being linked to the renderer in any way. Here is the code snippet where I think this should be happening, and yet I can't seem to make it happen. What am I doing wrong? public class EmpowermentEntityRenderer extends EntityRenderer<EmpowermentEntity> { protected static final ResourceLocation TEXTURE = new ResourceLocation(BlueMagic.MOD_ID, "textures/entity/empowerment_entity.png"); public EmpowermentEntityRenderer(EntityRendererManager renderManager) { // this is what works super(renderManager); // this is supposed to be how I pass the model instance to the renderer super // (no super constructor matching the arguments below) // super(renderManager, new EmpowermentEntityModel<>(), 0.0f); } @Override public ResourceLocation getEntityTexture(EmpowermentEntity entity){ return TEXTURE; } }
  7. Ah okay, I see what youre saying. I'll make that change and give it a try. Thanks vemerion and beethoven. EDIT: Oh boy, it still seems to be having the same exact issue. So I guess it wasnt coming from my entity as expected. I found a typo in one of my registries I was sending to the dependency mod that also had to do with the new entity, but not directly. Fixing that seems to allow it to load properly. Oops Thanks for that though because that would have probably been my next problem regardless of this issue
  8. Please read the post. This is coming from a dependency and I have verified the file being present in the dependency. Something is cascading issues with the registry, coming from my mod as the source of the problem.
  9. I've been working on my first implementation of a basic Entity. I pulled from a few different sources on trying to make sure I register and implement everything properly, but on my first attempt using it in the client, I get a crash, once mcforge actually completes loading the client, that has inexplicable origins to me. In the debug client, I can also see a bunch of errors popping up before the crash happens, which also seem to have nothing to do with my mod, and yet never happened until I tried to create a basic entity. My model class was mostly made by Blockbench. I will include code snippets pertinent to the entity. *Please note you may see items related to "Mana and Artifice", this is just a dependency of my mod, since it's being developed as an addon. Sorry for all the code, but I really don't know where this could be coming from. It's not my workspace either because I've tried rebuilding my workspace and also attempting to run an actual client using the built jar. It may also seem like it's coming from Mana and Artifice, but I assure you, it's not. Here is a link to the crash report if that may also help: https://pastebin.com/hifFKCQu Let me know if I may have left something out that is needed to see where the problem might be. Entity class (just basic implementation, not fully finished) public class EmpowermentEntity extends Entity { private static final String KEY_POTIONSTACK = "itemstack"; private static final String KEY_EFFECT = "effect"; private ItemStack potionStack; private Effect effect; public EmpowermentEntity(EntityType<? extends EmpowermentEntity> entityTypeIn, World worldIn) { super(entityTypeIn, worldIn); } @Override protected void registerData() { } @Override protected void readAdditional(CompoundNBT compound) { } @Override protected void writeAdditional(CompoundNBT compound) { } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override public boolean canBeCollidedWith(){ return false; } @Override protected boolean canBeRidden(Entity entityIn){ return false; } @Override public boolean canBeAttackedWithItem(){ return false; } } Mod class constructor public BlueMagic() { // Register ourselves for server and other game events we are interested in IEventBus eventBus = MinecraftForge.EVENT_BUS; EntityInit.ENTITY_TYPES.register(eventBus); eventBus.register(this); } EntityInit class (includes deferred register) public class EntityInit { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, BlueMagic.MOD_ID); public static final RegistryObject<EntityType<EmpowermentEntity>> EMPOWERMENT_ENTITY = ENTITY_TYPES .register("empowerment_entity", () -> EntityType.Builder.create(EmpowermentEntity::new, EntityClassification.MISC) .setShouldReceiveVelocityUpdates(false) .disableSummoning() .build(new ResourceLocation(BlueMagic.MOD_ID, "empowerment_entity").toString())); } ClientEventBusSubscriber class @Mod.EventBusSubscriber(modid = BlueMagic.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ClientEventBusSubscriber { @SubscribeEvent public static void clientSetupEvent(FMLClientSetupEvent event){ RenderingRegistry.registerEntityRenderingHandler(EntityInit.EMPOWERMENT_ENTITY.get(), EmpowermentEntityRenderer::new); } } Renderer class public class EmpowermentEntityRenderer extends EntityRenderer<EmpowermentEntity> { protected static final ResourceLocation TEXTURE = new ResourceLocation(BlueMagic.MOD_ID, "textures/entity/empowerment_entity.png"); public EmpowermentEntityRenderer(EntityRendererManager renderManager) { super(renderManager); } @Override public ResourceLocation getEntityTexture(EmpowermentEntity entity){ return TEXTURE; } } Model class public class EmpowermentEntityModel<T extends EmpowermentEntity> extends EntityModel<T> { private final ModelRenderer Body; private final ModelRenderer Torso; private final ModelRenderer Legs; private final ModelRenderer Leg1; private final ModelRenderer Leg2; private final ModelRenderer Leg3; private final ModelRenderer Leg4; public EmpowermentEntityModel() { textureWidth = 32; textureHeight = 32; Body = new ModelRenderer(this); Body.setRotationPoint(0.0F, 24.0F, 0.0F); Torso = new ModelRenderer(this); Torso.setRotationPoint(0.0F, 0.0F, 0.0F); Body.addChild(Torso); Torso.setTextureOffset(0, 0).addBox(-3.0F, -11.0F, -3.0F, 6.0F, 6.0F, 6.0F, 0.0F, false); Legs = new ModelRenderer(this); Legs.setRotationPoint(0.0F, 0.0F, 0.0F); Body.addChild(Legs); Leg1 = new ModelRenderer(this); Leg1.setRotationPoint(0.0F, 0.0F, 0.0F); Legs.addChild(Leg1); Leg2 = new ModelRenderer(this); Leg2.setRotationPoint(0.0F, 0.0F, 0.0F); Legs.addChild(Leg2); Leg3 = new ModelRenderer(this); Leg3.setRotationPoint(0.0F, 0.0F, 0.0F); Legs.addChild(Leg3); Leg4 = new ModelRenderer(this); Leg4.setRotationPoint(0.0F, 0.0F, 0.0F); Legs.addChild(Leg4); } @Override public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ Body.render(matrixStack, buffer, packedLight, packedOverlay); } public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } }
  10. I've been on a few forums where they've had tags for titles, including "solved".
  11. Ah, thank you much. This will be helpful. EDIT: Is there a way to mark this thread as solved?
  12. Oh okay, then I'm still wondering how it is that I determine what dimension the in question ServerWorld object is for. By that I don't mean the dimension type, but the exact identifier specific to just one dimension, considering there can be multiple instance of the same dimension type in some cases.
  13. I'm not sure what you're saying in that second part. Is it maybe the case that there is only one centralized ServerWorld object, and that the WorldTickEvent is NOT individually called by each dimension? I'm not sure if I'm misunderstanding what the ServerWorld object is.
  14. Hmm, I thought that was clear. I need a way to compare world objects, to check if the two world objects being referenced are the same world. I tried to compare them directly, but it seems that they diverge at some point. I thought comparing their dimension IDs would allow for more sound comparison. I'm doing this to create a World Tick Scheduler of sorts. The WorldTickEvent gives a world, but I'm assuming it has the potential to be any of the loaded dimensions, so I need to make sure it is the world that my timed process is executing in. EDIT: When I say world object, I'm referring to an instance of the ServerWorld class. Also, I'm from Spigot, so sorry if I'm confusing the functionality differences between Spigot and MCForge.
  15. I simply need to know one thing. How does one get the dimension ID from a World object/instance. (Yes, I looked for this on google/the forums, but I could only find what seemed to be outdated methods of doing so)
×
×
  • Create New...

Important Information

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