Jump to content

Eisenpaulchen

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Eisenpaulchen

  1. Hm ok this is pretty interesting since I watched what felt like thousands of videos of the same thing to make sure not one of them just missed something and this was never mentioned or written. And one last thing I was not able to find a error logentry is there non (would be very helpful for others like me :) ) or did I just missed it?
  2. Wow ok 1 day of search. Thank you very much, but is this requirement new or relativly new? Was just asking because in every turorial I watched no one did that and it worked just fine. Since the readthedocs documentation does not cover entitys as a whole thing I had to rely on those videos.
  3. I am trying to create a throwable object just like the snowball and was successfull with creating an item and the projectile entity as well as throwing it, referencing to the snowball. But I can not get my flying entity to be rendered. The minecraft snowball seems to be rendered with a SpriteRenderer that seems to be made for things like the ProjectileItemEntity. Here is my code to register the EntityType, renderer the render itself and the Entity class As far as I can see I did everything like the snowball does except for the extra constructor in the renderer which is needed for registration. In addition I figured out that no method of the renderer except for the constructor is ever called, but I can summon the entity and it flies and hits things but is just invisibile. Has anyone an Idea what I am missing? public static final DeferredRegister<EntityType<?>> ENTITYTYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, MODID); public static final RegistryObject<EntityType<MelonShardEntity>> MELONSHARD_ENTITY = ENTITYTYPES .register("melonshardentity", () -> EntityType.Builder .<MelonShardEntity>create(MelonShardEntity::new, EntityClassification.MISC) .size(0.25f, 0.25f).build(new ResourceLocation(MODID + ":melonshardentity").toString())); public void doClientSetup(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(MelonShardEntity.class, MelonshardRenderer::new); } public class MelonShardEntity extends ProjectileItemEntity { public static final int DAMAGE = 1000; public MelonShardEntity(EntityType<? extends MelonShardEntity> p_i50159_1_, World p_i50159_2_) { super(p_i50159_1_, p_i50159_2_); } public MelonShardEntity(World worldIn, LivingEntity throwerIn) { super(learnMod.MELONSHARD_ENTITY.get(), throwerIn, worldIn); } public MelonShardEntity(World worldIn, double x, double y, double z) { super(learnMod.MELONSHARD_ENTITY.get(), x, y, z, worldIn); } @Override protected Item func_213885_i() { return learnMod.MELON_SHARD; } @Override protected void onImpact(RayTraceResult result) { if (result.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult) result).getEntity(); entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) DAMAGE); } if (!this.world.isRemote) { this.world.setEntityState(this, (byte) 3); this.remove(); } } } @OnlyIn(Dist.CLIENT) public class MelonshardRenderer extends SpriteRenderer<MelonShardEntity> { public MelonshardRenderer(EntityRendererManager p_i50957_1) { super(p_i50957_1,Minecraft.getInstance().getItemRenderer()); } public MelonshardRenderer(EntityRendererManager p_i50957_1_, ItemRenderer p_i50957_2_) { super(p_i50957_1_,p_i50957_2_); } }
  4. Got it working I decided to use the reflection since while searching for what the access Transformer is I saw a post from diesieben07 advising to use reflection rather than the transformer and after consulting Oracle I felt confident enought to use it especially since it seemed much less work. Thank you for the help and the new knowledge of the existence of reflection.
  5. Thanks for this detailed information, bringin much light into this darknis, and your effort put into this will try it this way.
  6. This whole thing is really hard for me to understand there are so many Classes in MC regarding Sound and I have no Clue what they are meant for like there is the SoundHandler, Sound Engine, SoundHandler.Loader, SoundEvents,SoundEventAccessor and of course just Sound, but I cant find the point where the actual data goes in they just shuffel ResourceLocations from A to B. Is there an Overview of how Minecrafts soundmanagement works like here its loaded there it is registered this is to hold or process that information. Those number named Methods giving me a hard time to understand.
  7. Ok ill try looking into that. I first thought about copying the resources into the jar there are APIs in Java I think to do so, and then accessing them, but directly loading them into the game would be way better. thx for the suggestion
  8. But if you want to create a mod that is able to process resources given by the user you cant do so I thought.
  9. I want to load resources in this case an .ogg file, thats not inside the mod /assets folder, into the game and use it there. Has Forge already a clean solution for it or if that is not the case does someone know how to achieve that in Version 1.14?
  10. Ok I did some research my self in the Minecraft Sourcecode and I found a possible solution: In Minecrafts method for rendering the chat called drawChat() The method GlStateManager.disableBlend(); is called. As one can see in this OpenGl Wiki article this is what took the transparency from my background as long as the chat is visible. Therefore I fixed it like this: GlStateManager.color(1.0F, 1.0F, 1.0F, 0.7F); GlStateManager.enableBlend(); drawTexturedModalRect(i, j, 0, 0, xSize, ySize); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Hope this is the or at least one right way to do this. If this is not the case please tell me.
  11. Ok I did that but that was just a formal suggestion? It unfortunatly did not fix it. As you can imagine it looks now like this : @Override public void drawDefaultBackground() { int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; Minecraft.getMinecraft().getTextureManager().bindTexture(texture); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.7F); drawTexturedModalRect(i, j, 0, 0, xSize, ySize); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } plus the call in drawScreen() like this : @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { drawDefaultBackground(); ... }
  12. Hello, I am working on an GUI for a Block (in 1.12.2) and want the background to be drawn considering the Alphachannel. It worked like this : @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; Minecraft.getMinecraft().getTextureManager().bindTexture(texture); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.7F); drawTexturedModalRect(i, j, 0, 0, xSize, ySize); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } But I had to discover, that if I or a commandblock write something in the chat the background is drawn without transparency as long as the chat is visible. After the chat disappears it changes back. I am not enough into minecrafts intern rendering processes to understand what minecraft is doing here. Could anyone help me with that?
×
×
  • Create New...

Important Information

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