• Recently Browsing

    No registered users viewing this page.

  • Posts

    • This would play your music once every 1000 ticks (every 50 seconds): private static int musicTimer = 1000; @SubscribeEvent public static void onTick(ClientTickEvent event) { if (event.phase == Phase.END && event.side == LogicalSide.CLIENT) { if (musicTimer-- <= 0 && Minecraft.getInstance() != null && Minecraft.getInstance().player != null) { musicTimer = 1000; Minecraft.getInstance().player.playSound(YOUR MUSIC HERE, 2f, 1f); Minecraft.getInstance().getMusicTicker().stop(); } } }   Although I think the vanilla Minecraft music could potentially start while your music is playing, so you would have to handle that also.
    • I took a deeper look at vanilla minecraft code and noticed, that the addParticle()- function of the class World is empty. However ClientWorld extends World and implements the addParticle function properly. I also looked at the working 1.16 mod 'Rats'. Here he simply calls event.getWorld(), with event being an instance of PlayerInteractEvent.EntityInteract. Calling event.getWorld() should also return a World (not a ClientWorld!), but somehow he can then call .spawnParticle(). I'm kinda confused, why his mod is working. Also I still have no idea, how I should get the right ClientWorld, so I can use its addParticle() function.
    • Hey,  I'm trying to make blocks that are moving smoothly. For that, I want to create an entity that renders the block.  I'm registering the renderer but for some reason, it isn't being rendered.  This is my code of the renderer and the registry package me.cirex.fluidships.entity.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import me.cirex.fluidships.entity.EntityBlock; import me.cirex.fluidships.entity.model.EntityBlockModel; 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.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; public class EntityBlockRenderer extends EntityRenderer<EntityBlock> { protected EntityBlockRenderer(EntityRendererManager renderManager) { super(renderManager); } @Override public void render(EntityBlock entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { System.out.println("test"); EntityBlockModel model = new EntityBlockModel(entityIn); for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType .getBlockRenderTypes()) { model.render(matrixStackIn, bufferIn.getBuffer(type), packedLightIn, 0, 1, 1, 1, 1); } super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); } @Override public ResourceLocation getEntityTexture(EntityBlock entity) { return null; } public static class RenderFactory implements IRenderFactory<EntityBlock> { @Override public EntityRenderer<? super EntityBlock> createRenderFor(EntityRendererManager manager) { return new EntityBlockRenderer(manager); } } } package me.cirex.fluidships.registry; import me.cirex.fluidships.FluidShips; import me.cirex.fluidships.block.InvisibleBlock; import me.cirex.fluidships.entity.EntityBlock; import me.cirex.fluidships.entity.renderer.EntityBlockRenderer; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ShipRegistry { @SuppressWarnings("unchecked") public static EntityType<EntityBlock> BLOCK_ENTITY = (EntityType<EntityBlock>) EntityType.Builder .create(EntityBlock::new, EntityClassification.MISC).size(1F, 1F) .build(FluidShips.MODID + ":block_entity") .setRegistryName(new ResourceLocation(FluidShips.MODID, "block_entity")); public static Block INVISIBLE_BLOCK = new InvisibleBlock(); @SubscribeEvent public void onBlockRegistry(final RegistryEvent.Register<Block> event) { event.getRegistry().register(INVISIBLE_BLOCK); } @SubscribeEvent public void onEntityTypeRegistry(final RegistryEvent.Register<EntityType<? extends Entity>> event) { event.getRegistry().register(BLOCK_ENTITY); } public void registerRenderer() { RenderingRegistry.registerEntityRenderingHandler(BLOCK_ENTITY, new EntityBlockRenderer.RenderFactory()); } public void onClientSetup(final FMLClientSetupEvent event) { registerRenderer(); } }  
    • My textures have been changed to make sure that nothing is in the 64 x 32 area so I believe that shouldnt get in the way of the default model rendering.   But I still do not understand why the textures on the model are so off. I thought this might be the same problem for me but I do not have any decimals and I tried playing around with scaling the texture up aswell as increasing textureHeight and textureWidth in the model but It does not make it any better.   Thanks for your help so far btw,
  • Topics

  • Who's Online (See full list)