Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Tessa

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by Tessa

  1. I've been trying to use a custom sky renderer to change the sun and moon textures in my dimension. Everything works fine, but I can't figure out how to render the textures in "world space" if that makes sense. Everything just rotates with the view of the player. This is the code I have in the render function of my IRenderHandler implementation. @Override public void render(int ticks, float partialTicks, ClientWorld world, Minecraft mc) { BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); Tessellator tessellator = Tessellator.getInstance(); GlStateManager.enableTexture(); GlStateManager.enableBlend(); GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glPushMatrix(); float alpha = 1.0F - world.getRainStrength(partialTicks); GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); float size = 100.0F; mc.getTextureManager().bindTexture(SUN_TEXTURES); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos((double)size, 100.0D, (double)(-size)).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos((double)size, 100.0D, (double)size).tex(1.0F, 1.F).endVertex(); bufferbuilder.pos((double)(-size), 100.0D, (double)size).tex(0.0F, 1.0F).endVertex(); tessellator.draw(); size = 100.0F; mc.getTextureManager().bindTexture(MOON_PHASES_TEXTURES); int k1 = world.getMoonPhase(); int i2 = k1 % 4; int k2 = k1 / 4 % 2; float f22 = (float)(i2 + 0) / 4.0F; float f23 = (float)(k2 + 0) / 2.0F; float f24 = (float)(i2 + 1) / 4.0F; float f14 = (float)(k2 + 1) / 2.0F; bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos((double)(-size), -100.0D, (double)size).tex(f24, f14).endVertex(); bufferbuilder.pos((double)size, -100.0D, (double)size).tex(f22, f14).endVertex(); bufferbuilder.pos((double)size, -100.0D, (double)(-size)).tex(f22, f23).endVertex(); bufferbuilder.pos((double)(-size), -100.0D, (double)(-size)).tex(f24, f23).endVertex(); tessellator.draw(); GlStateManager.disableTexture(); GL11.glPopMatrix(); }
  2. Hey @kwpugh, I've been trying to make a custom crossbow myself and ran into the same issue mentioned before. I tried taking a bunch of the vanilla crossbow code and I eventually just copied your code into my class, but still it keeps looping the reload animation. Would you have any idea why?
  3. To make a more impressive looking weapon, I've been trying to combine a model and a generated item. In the image you can see the "staff/rod" is rendering, but I'm trying to render the spear head item, which you can see in the bottom, at the end of the pole. I figured a TileEntityItemStackRenderer would be the right way to go so i made a class that extends the vanilla TEISR. I looked at the vanilla code and other sources for examples, but I can't get it to work. Anyone have a suggestions on how to attempt this? This where I register the item: https://github.com/tessa19950/TheBigBang_1.14.4/blob/master/src/main/java/com/homebrewCult/TheBigBang/init/ModItems.java This is the code for the renderer: https://github.com/tessa19950/TheBigBang_1.14.4/blob/master/src/main/java/com/homebrewCult/TheBigBang/items/render/OmegaSpearRenderer.java This is the model made in Blockbench: https://github.com/tessa19950/TheBigBang_1.14.4/blob/master/src/main/java/com/homebrewCult/TheBigBang/items/model/OmegaSpearModel.java
  4. So after some fiddling around I noticed in the screenshot that my custom sprites were added to the Texture Atlas you see, It just wasn't showing the right part of that image which was because I had overwritten the getMinU, getMaxU, getMinV and getMaxV functions. The reason I'd overwritten them in the first place was because I had an issue before where the game crashed if i didn't overwrite them, but it appears that something else was causing that first problem, I fixed it somewhere along the way, but now the overwrites were breaking the sprite.
  5. I'm trying to get a simple particle to work with a custom sprite animation, but when the particle gets spawned in it looks like this. I've made a particle before that uses an item texture as its visual, which works perfectly. But it seems like this one isn't using the right texture atlas or something like that? I'm not sure what's going wrong. Particle class: https://github.com/tessa19950/TheBigBang_1.14.4/blob/master/src/main/java/com/homebrewCult/TheBigBang/particles/MagicClawParticle.java Particle type registry: https://github.com/tessa19950/TheBigBang_1.14.4/blob/master/src/main/java/com/homebrewCult/TheBigBang/init/ModParticleTypes.java
  6. At this point I assumed we were on the same page, but yes, I was talking about the models. Regardless I really appreciate your help and I'm sorry for the misunderstanding. I guess I should've mentioned they were using the right textures...
  7. Yeah, but as you can see, it doesn't use the correct model. That's the default quadmodel right? Looks like a pig
  8. Right, that wasn't what was crashing the game, there was a nullpointerexception because, like you said, the register entity spawns was being done in the wrong place. For now i commented them out, but the entities still use pig models.
  9. Okay, so I think I have the initialization set up correctly now. But now when the game starts it gives me a this error for each entity type [24Apr2020 11:14:22.209] [Render thread/WARN] [net.minecraft.entity.EntityType/]: No data fixer registered for entity thebigbangstump_entity
  10. But if I make the initializers non static I have to make the functions using them non static which means I cannot call stuff like the registerEntityRenderers function, right?
  11. Okay, this is the first time I'm setting up a git repository with Forge so I hope it's okay like this. Can you access this https://github.com/tessa19950/TheBigBang_1.15.2 ?
  12. Seems like getRenderer is returning the correct renderer, as well as the right model
  13. No never mind, it is also called on the client, when I spawn one of the entities 2 breakpoints happen, one for the server and one for the client.
  14. Waaait, okay sorry for misunderstanding you. So you're saying because the entity is only spawned on the server the client doesn't know what model to use, right? Okay so yeah, the breakpoint was only reached once which was on the server, so I guess that means you were right and it isn't spawned on the client. For some reason I thought it didn't need to be spawned on clientside.
  15. Yep, definitely happening on server
  16. Well, when I was still working in 1.14 everything worked perfectly and in that version even had some issues where entities spawned on the Client which I fixed. But if you insist, what do thing would be the best way to 100% verify they're spawned on server?
  17. Yep, 100% sure, I have a block that spawns the entities on the server, I've used their spawn eggs and I've used the summon command. All of which result in them using the pig model.
  18. Sorry for the late reply, I've been trying to make it work, but neither using the proper EntityType nor creating my registries in the registry events fixes it. Could something be wrong with the models themselves? What causes the game to render the entity using the pig model instead of the designated one?
  19. Well, this way I can use the function i made called "registerEntityType", which significantly reduces the amount of typing and copy pasting I need to do. In my main class @Mod(TheBigBang.MODID) public final class TheBigBang { public static final String MODID = "thebigbang"; public static final Logger LOGGER = LogManager.getLogger(MODID); public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy()); public TheBigBang() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); } private void setup(final FMLCommonSetupEvent event) { proxy.Init(); BigBangPacketHandler.packetHandlerInit(); } private void clientRegistries(final FMLClientSetupEvent event) { EntityInit.registerEntityRenders(); } } Here's one of the entities public class StumpEntity extends AnimalEntity { private static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.BONE_MEAL, Items.POISONOUS_POTATO, Items.ROTTEN_FLESH); @SuppressWarnings("unchecked") public StumpEntity(EntityType<? extends AnimalEntity> type, World worldIn) { super((EntityType<? extends AnimalEntity>) EntityList.STUMP_ENTITY, worldIn); } @Override protected void registerGoals() { this.goalSelector.addGoal(0, new SwimGoal(this)); this.goalSelector.addGoal(1, new PanicGoal(this, 0.5D)); this.goalSelector.addGoal(3, new BreedGoal(this, 0.4D)); this.goalSelector.addGoal(4, new TemptGoal(this, 0.4D, false, TEMPTATION_ITEMS)); this.goalSelector.addGoal(5, new FollowParentGoal(this, 0.3D)); this.goalSelector.addGoal(6, new WaterAvoidingRandomWalkingGoal(this, 0.3D)); this.goalSelector.addGoal(7, new LookAtGoal(this, PlayerEntity.class, 0.3F)); this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); } @Override protected void registerAttributes() { super.registerAttributes(); this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0d); this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3d); } @Override protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundInit.STUMP_DAMAGE; } @Override protected SoundEvent getDeathSound() { return SoundInit.STUMP_DIE; } @Override public StumpEntity createChild(AgeableEntity ageable) { return (StumpEntity) EntityList.STUMP_ENTITY.create(this.world); } public boolean isBreedingItem(ItemStack stack) { return TEMPTATION_ITEMS.test(stack); } }
  20. After updating my mod to version 1.15 and fixing almost everything, the one thing that isn't working for me are all the models of my entities. There are 11 different models for 26 new entities. I don't NEED to switch to the deferred registry method, right? I've taken out the registry for the rest of the entities for the sake of clarity. public class EntityList { public static EntityType<?> STUMP_ENTITY = registerEntityType(StumpEntity::new, EntityClassification.CREATURE, 1f, 1.5f, "stump_entity"); public static EntityType<?> OCTOPUS_ENTITY = registerEntityType(OctopusEntity::new, EntityClassification.CREATURE, 1f, 2.5f, "octopus_entity"); public static <T extends Entity> EntityType<?> registerEntityType(EntityType.IFactory<T> factoryIn, EntityClassification classification, float width, float height, String name) { return EntityType.Builder.create(factoryIn, EntityClassification.CREATURE).size(width, height).build(TheBigBang.MODID + name).setRegistryName(TheBigBang.MODID, name); } } @Mod.EventBusSubscriber(modid = TheBigBang.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(TheBigBang.MODID) public class EntityInit { @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().registerAll ( EntityList.STUMP_ENTITY, EntityList.OCTOPUS_ENTITY ); registerEntityWorldSpawn(EntityList.STUMP_ENTITY, 2, 4, Biomes.FOREST); registerEntityWorldSpawn(EntityList.OCTOPUS_ENTITY, 2, 8, Biomes.GRAVELLY_MOUNTAINS, Biomes.STONE_SHORE); } @SuppressWarnings("unchecked") public static void registerEntityRenders() { RenderingRegistry.registerEntityRenderingHandler((EntityType<StumpEntity>)EntityList.STUMP_ENTITY, new StumpRenderer.RenderFactory()); RenderingRegistry.registerEntityRenderingHandler((EntityType<OctopusEntity>)EntityList.OCTOPUS_ENTITY, new OctopusRenderer.RenderFactory()); } @SubscribeEvent public static void registerEntityItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.STUMP_SPAWN_EGG = registerEntitySpawnEgg(EntityList.STUMP_ENTITY, 0x886633, 0x3e2e17, "stump_spawn_egg"), ItemList.OCTOPUS_SPAWN_EGG = registerEntitySpawnEgg(EntityList.OCTOPUS_ENTITY, 0x6356B5, 0xBD4E86, "octopus_spawn_egg") ); } public static Item registerEntitySpawnEgg(EntityType<?> type, int color1, int color2, String name) { SpawnEggItem item = new SpawnEggItem(type, color1, color2, new Item.Properties().group(ItemGroup.MISC)); item.setRegistryName(TheBigBang.MODID, name); return item; } public static void registerEntityWorldSpawn(EntityType<?> entity, int minGroupCount, int maxGroupCount, Biome... biomes) { for(Biome biome : biomes) { if(biome != null) { biome.getSpawns(entity.getClassification()).add(new SpawnListEntry(entity, 10, minGroupCount, maxGroupCount)); } } } }
  21. Yes! That's right, but you need to convert the 0-255 value to hexadecimal. Because the fill function decodes the number you give it like this. public static void fill(int p_fill_0_, int p_fill_1_, int p_fill_2_, int p_fill_3_, int p_fill_4_) { float f3 = (float)(p_fill_4_ >> 24 & 255) / 255.0F; float f = (float)(p_fill_4_ >> 16 & 255) / 255.0F; float f1 = (float)(p_fill_4_ >> 8 & 255) / 255.0F; float f2 = (float)(p_fill_4_ & 255) / 255.0F; GlStateManager.color4f(f, f1, f2, f3); }
  22. After handling the packet I did the "setPacketHandled" thing, and the packet itself is registered through forge's SimpleChannel public static void handle(Packet_HandInQuest msg, Supplier<NetworkEvent.Context> ctx) { DangerSignTile te = (DangerSignTile)ctx.get().getSender().getServerWorld().getTileEntity(msg.pos); te.container.takeQuestItems(msg.questInt); te.container.takeKillCount(msg.questInt); te.container.giveRewards(msg.questInt); te.setQuestCompleted(msg.questInt); ctx.get().setPacketHandled(true); }
  23. Worked like a charm! Too bad none of the hex color pickers seem to have an AARRGGBB option. So I had to get a normal RRGGBB hex code, then convert some arbitrary value (I think it was 201) to hexadecimal which is the C9 value. public void renderGhostItem(ItemStack stack, int x, int y) { RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); GlStateManager.depthFunc(516); AbstractGui.fill(x, y, x + 16, y + 16, 0xC9365A7F); GlStateManager.depthFunc(515); renderGhostItemOverlay(font, stack, x, y); GlStateManager.enableLighting(); RenderHelper.disableStandardItemLighting(); } This is what it looks like now
  24. Just wanted to "close" this topic by saying I managed to get the packets working. Indeed, it wasn't too difficult. I didn't feel like the Forge documentation got me all the way there, but with the help of a few tutorials and other forum posts I got it together. When clicking the GUI button a packet gets sent to the server telling it to reduce the stack size of my input slot.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.