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

Cadiboo

Members
  • Posts

    3624
  • Joined

  • Last visited

  • Days Won

    58

Posts posted by Cadiboo

  1. Minecrafts got like everything abstracted away in multiple ways. Looking at vanilla’s code is the best way to understand stuff.

     

    The basics of rendering are

    - get the render buffer you want

    - add data to that buffer

     

    Your data then gets drawn by minecraft AT A LATER DATE. So you cannot interact with open GL directly as by the time your data is rendered, the open GL state will have been changed by other stuff.

     

    You render data to a render type buffer by adding vertices to the buffer. You do this by calling methods on the buffer like “pos”, “color”, “tex” and then finish it off for each vertex with “endVertex()”. These methods are chainable so you can do “buffer.pos(x, y, z).color(r, g, b, a).tex(u, v).endVertex();”

    • Thanks 1
  2. 14 hours ago, Drachenbauer said:

    else { super.livingTick(); }

    You’re definitely going to want to call super regardless of if you’re going to deflate soon or not. 

     

    14 hours ago, Drachenbauer said:

    If i spawn an entity, it generates it´s own instances from it´s entity-class and renderer-clas.

    No. There is only one renderer instance. This instance renders all of your entities one by one. So you need to get the data from your entity in your Renderer and act according to that data

  3. public final class ModItems
    {
    	// 1: This shouldn't be in a class called ModItems
      	// 2: You shouldn't be using this method, thats why its depreciated, you should be using the registry events
    	@SuppressWarnings("deprecation")
    	private static <T extends Entity> EntityType<T> register(String key, EntityType.Builder<T> builder) {
    		return Registry.register(Registry.ENTITY_TYPE, key, builder.build(key));
    	}
    	public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Main.MODID);
    	// This shouldn't be in a class called ModItems
    	//public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Main.MODID);
    	
    	// 1: This shouldn't be in a class called ModItems
    	// 2: You shouldn't use static initialisers
      	// 3: You shouldn't register stuff statically
      	// You should create and register your objects inside the registry events
    	public static final EntityType<UnicornEntity> UNICORN = register("unicorn_entity", EntityType.Builder.create(UnicornEntity::new, EntityClassification.AMBIENT).size(0.5F, 0.9F));
      	// This is correct - it's how you should be doing your registration, but it shouldn't be in a class called ModItems
    	//public static final RegistryObject<EntityType<UnicornEntity>> UNICORN = ENTITY_TYPES.register("unicorn_entity", () -> EntityType.Builder.create(UnicornEntity::new, EntityClassification.AMBIENT).build(null));
    	public static final RegistryObject<Item> RAINBOW_INGOT = ITEMS.register("rainbow_ingot",() -> new Item(new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)));
    	public static final RegistryObject<Item> UNICORN_ENTITY_EGG = ITEMS.register("unicorn_entity_egg", () -> new SpawnEggItem(UNICORN, 0xf0f0f0, 0xdf51f5, new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)));
    }

    You should remove entity related stuff from your ModItems class and make a new class like so:

    public final class ModEntityTypes {
    	public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Main.MODID);
    
    	public static final RegistryObject<EntityType<UnicornEntity>> UNICORN = ENTITY_TYPES.register("unicorn", () -> EntityType.Builder.create(UnicornEntity::new, EntityClassification.AMBIENT).size(0.5F, 0.9F).build(null));
    }

    and register your DeferredRegister in your mods constructor like this.

    • Thanks 1
  4. 1 hour ago, KillerMapper said:

    The mods are added using gradle dependencies. So they won't be in the mods folder. They're stored somewhere else but I don't know, probably in the .gradle folder in the user folders. And that's probably why the files can't be found.

    Do they get loaded when you run the game though?

×
×
  • Create New...

Important Information

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