Jump to content

Jummit

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by Jummit

  1. For anyone searching for this, I managed to get it working in 1.15.2 with this code:

    public static final ResourceLocation INTERACT_WITH_SHIP_CONTROLLER = registerCustomStat("interact_with_ship_controller");
    	
    private static ResourceLocation registerCustomStat(String name) {
      ResourceLocation resourcelocation = new ResourceLocation(MOD_ID, name);
      Registry.register(Registry.CUSTOM_STAT, name, resourcelocation);
      Stats.CUSTOM.get(resourcelocation, IStatFormatter.DEFAULT);
      return resourcelocation;
    }

     

    You can then increase the stat:

    player.addStat(Registry.INTERACT_WITH_SHIP_CONTROLLER);

     

    Don't forget to localize it so it has a name in the stat list:

    "stat.sol.interact_with_ship_controller": "Interactions with Ship Controller"

     

    For fun, you can track your new stat with these commands:

    /scoreboard objectives add stat minecraft.custom:minecraft.interact_with_ship_controller
    /scoreboard objectives setdisplay sidebar stat

     

    • Like 1
  2. I want to render planets in a space dimension, but don't know where to put the code to do that. Is RenderTickEvent what I want?

    I found this pretty helpful, but I don't want it to depend on blocks: http://greyminecraftcoder.blogspot.com/2014/12/the-tessellator-and-worldrenderer-18.html

    This is what I have so far:

    @Mod.EventBusSubscriber
    public class EventHandler {
    
    	@SubscribeEvent
    	public static void renderTick(RenderTickEvent event) {
    		if (Minecraft.getMinecraft().currentScreen != null) {
    			return;
    		}
    		if (event.phase==Phase.START) {
    			// render sphere .obj
    		}
    
    }

    EDIT:

    Turns out RenderTickEvent isn't the right event. Using RenderWorldLastEvent worked.

  3. I got something to work, I now have an entity that renders an obj model. How can I make it textured? I tried setting the map in the .mtl file, but it always gives me the error texture.

    Quote

    newmtl None
    Ka 0.000000 0.000000 0.000000
    Kd 0.8 0.8 0.8
    Ks 0.8 0.8 0.8
    d 1
    map_Kd What to put here?

     

    The forge wiki states

    Quote

    The .mtl file will probably have to be manually edited to change the paths pointing to textures into Minecraft ResourceLocations.

    But when I put in "minecraft:stone" or "mymod:mytexture" it doesn't work either.

     

    Never mind, I just read the "Resources" page of the forg e wiki and figured it out: "minecraft:stone" should be "minecraft:blocks/stone". I still can't get my own textures to work...

  4. 1 hour ago, Cadiboo said:

    This approach involves baking the model and registering neccesary textures

    And that's where I'm struggling...

    OBJLoader.INSTANCE.addDomain(MOD_ID);
    OBJLoader.INSTANCE.onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
    IModel model = OBJLoader.INSTANCE.loadModel(new ResourceLocation(MOD_ID, "models/cube.obj"));
    //model.bake(state, format, bakedTextureGetter) ?
    @Override
    public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
    	// what to put in here?
    }

    Or is this the better way?

    @Override
    public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
    TileEntityRendererDispatcher.instance.render(MY_TILE_ENTITY, x, y, z, 0);
    }

     

  5. What do I have to give the getCapability function?

    This doesn't work: container.getCapability(IItemHandler.class, EnumFacing.EAST);

     

    EDIT:

    Got it.

    container.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.EAST);

  6. I have this problem that when I get the tile data of a chest it is empty. I use world.getTileEntity(pos).getTileData(), and that works on one of my custom ones, which looks like this: "{built:1b,multiblock:"test.json",multiblockcenter:[I;-906,5,310]}", but if I print the chest data it is empty ("{}").

    Why is that?

  7. 2 minutes ago, Draco18s said:

    Then you need way more.

    There is no way around this, you MUST place a block in each of the 27 occupied places otherwise all kinds of things get screwed up, like players falling on it or mobs trying to pathfind over it.

    Could I make a block that if placed creates a 3x3 block around itself, and if broken deconstructs it again?

  8. How would I go about making a 3x3 block that you can place and break like a normal one? I looked into tile entities and got one to work, but how can I make it occupy nine blocks? I also looked at how the bed does it, and it looks like what I need, but that are only two parts. Mine has way more.

×
×
  • Create New...

Important Information

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