Jump to content

Boy132

Members
  • Posts

    54
  • Joined

  • Last visited

Posts posted by Boy132

  1. On 4/26/2020 at 11:26 PM, Ommina said:

    If the colour is wrong (it is), then you're not applying the color attribute of the fluid (fluid.getAttributes().getColor()).  Apply the colour to GlStateManager.color4f before the blit.  Reset after!

    Thanks, that worked! :)

     

    On 4/26/2020 at 11:26 PM, Ommina said:

    For the scaling, the .bindTexture call looks wrong for reasons I don't remember.  I want to say it takes a TextureAtlas ResourceLocation, instead of that of a particular sprite.  The getUV methods inside the blit then pull the correct texture from the atlas.

    I do bind the textureatlas resourcelocation and if I just use  sprite.getName() it renders the "pink black missing texture" texture. :/ 

  2. 2 minutes ago, Harry12OK said:

    But IItemTier is an interface.It isn't a class.How am i supposed to pass an instance of it.I could only implement it.

     

    Sorry if i asked some foolish thing,i just have knowledge of basic core java.

    Basically the item tier is what used to be tool material in older versions.

    You create a class that implents IItemTier and then you pass that class to your item. (In simple words you "just copy" the vanilla ItemTier class and replace the values.)

    • Thanks 1
  3. 1 hour ago, Fluorescent Flamingo said:

    [...] if it's essential to create recipe advancements for them all too - is it functionally required or does it just have some effect on the recipe book? [...]

    You are correct. It is not required to create advancements for your recipes but if you do so you can control when the recipe appears in the recipe book. Look at the vanilla json files for examples.

     

    1 hour ago, Fluorescent Flamingo said:

    [..] Also, why do all the recipe advancements for complex, multi-item recipes unlock depending only on a single ingredient?

    I guess reasons of simplicity? Because - correct me if I'm wrong - you can only check for a single item so let's say for the enchantment table you could only say "if you get obisidian OR a diamond you unlock the advancement".

  4. 23 minutes ago, Ugdhar said:

    Do you happen to know much about structures, for instance what ScatteredStructure is vs Structure, or how the Placement configuration works? I've tinkered with it some but honestly have no clue what I'm doing, just tinkering, guessing, and stabbing in the dark lol.

    I think a Structure can spawn in every chunk and ScatteredStructure's are... scattered :D. Look at ScatteredStructure#getStartPositionForPosition for more details.

     

    Most of the vanilla structures (or actually all?) don't use any placement config so you have to manually check the config somewhere. I havn't done this either so I don't really know how and when to do this.

     

  5. I had a similar problem the last few days and I solved it by overriding func_225558_a_ in my structure class. For some reason the original function always returned false because generatorIn.hasStructure(biomeIn, this); always returned false although I added my structure to the biome. When using biomeIn.hasStructure(this) it returns the correct value. This doesn't really make sense because hasStructure from the ChunkGenerator basically just calls hasStructure from the Biome.

  6.  

    On 4/22/2020 at 3:26 PM, shrexish said:

    [...]

     

    
    package com.shrexish.horsemod;
    
    import org.apache.logging.log4j.LogManager;
    
    import net.minecraftforge.event.entity.player.PlayerContainerEvent;
    import net.minecraftforge.eventbus.api.SubscribeEvent;
    import net.minecraftforge.fml.common.Mod;
    
    @Mod.EventBusSubscriber
    public class EventHandler {
    	@SubscribeEvent
    	public static void containerOpen(PlayerContainerEvent.Open event) {
    		LogManager.getLogger();
    	}
    }

    [...]

    You need to actually call the Logger#log function. (e.g. LogManager.getLogger().log(Level.INFO, "debug info");)

     

    On 4/22/2020 at 3:26 PM, shrexish said:

    [...]

    
    package com.shrexish.horsemod;
    
    import org.apache.logging.log4j.LogManager;
    
    import net.minecraftforge.event.entity.player.PlayerContainerEvent;
    import net.minecraftforge.eventbus.api.SubscribeEvent;
    import net.minecraftforge.fml.common.Mod;
    
    @Mod.EventBusSubscriber
    public class EventHandler {
    	@SubscribeEvent
    	public static void containerOpen(PlayerContainerEvent.Open event) {
    		LogManager.getLogger();
    	}
    }

    This is my event handler. This is my main class:

    
    package com.shrexish.horsemod;
    
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.fml.common.Mod;
    import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
    import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
    
    @Mod(Reference.MOD_ID)
    public class HorseMod {
    	public HorseMod() {
    		MinecraftForge.EVENT_BUS.register(this);
            FMLJavaModLoadingContext.get().getModEventBus().register(this);
            FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
    	}
    	
    	private void onClientSetup(FMLClientSetupEvent event) {
            //PROXY.setupClient();
    		MinecraftForge.EVENT_BUS.register(new EventHandler());
        }
    }

    [...]

    Also you should not use both methods that @imacatlolol mentioned above but rather choose one.

     

     

    If this works then you can access the container of the event (event.getContainer()) and can check if it's the HorseInventoryContainer (instanceof HorseInventoryContainer).

    And after that point I have no idea how to continue. :D Maybe adding a new Slot at the position of the old one? (maybe not the best idea ?)

  7. 15 minutes ago, Delpig said:

    [...]

    But i have and other issue, my arrow isn't rendering when i shoot it, but if i'm making an effect onHit, it work.. so..
    If you could know from where it came

    Here's my render class

    
    package com.alduin.alduinmod.client.render;
    
    import com.alduin.alduinmod.AlduinMod;
    import com.alduin.alduinmod.entity.training_arrow.EntityTrainingArrow;
    
    import net.minecraft.client.renderer.entity.ArrowRenderer;
    import net.minecraft.client.renderer.entity.EntityRendererManager;
    import net.minecraft.item.Item;
    import net.minecraft.util.ResourceLocation;
    
    public class RenderTrainingArrow extends ArrowRenderer<EntityTrainingArrow>
    {
    
    	public RenderTrainingArrow(EntityRendererManager renderManagerIn) {
    		super(renderManagerIn);
    		// TODO Auto-generated constructor stub
    	}
    	@Override
    	public ResourceLocation getEntityTexture(EntityTrainingArrow entity) 
    	{	Item refItem = entity.getArrowStack().getItem();
    		return new ResourceLocation(AlduinMod.MOD_ID + ":textures/entity/projectile/"+ refItem.getRegistryName().getPath());
    	}
    
    }

    [...]

    Make sure your texture file is really in "textures/entity/projectile/" and look for related errors in your console log. (the vanilla arrow texture is in "projectiles" so you should check if you forgot the s)

  8. 24 minutes ago, Delpig said:

    [...]

    I have something like that

     

    
    {
    	"replace": false,
    	"values": [
    		"alduinmod:training_arrow"
    	]
    }

    Is that you are meaning ?

    If this is a json file named "arrows.json" in your "data/minecraft/tags/items" folder, then yes. :D

    Make sure this file is in the "minecraft" namespace and not in your modid namespace.

  9. Hello, I'm currently doing a fluid tank block and now I want to render the fluid in the gui:

    @Override
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
    {
    	super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
    	
    	int fluidStored = getFluidStoredScaled(73);
    	
    	Fluid fluid = fluidTank.getFluid().getFluid();
    	
    	if(fluid != Fluids.EMPTY)
    	{
    		ResourceLocation stillLocation = fluid.getAttributes().getStillTexture(fluidTank.getFluid());
    		TextureAtlasSprite sprite = Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(stillLocation);
    		ResourceLocation spriteLocation = sprite.getName();
    		minecraft.getTextureManager().bindTexture(new ResourceLocation(spriteLocation.getNamespace(), "textures/" + spriteLocation.getPath() + ".png"));
    		blit(guiLeft + 80, guiTop + 7 + (73 - fluidStored), 0, 16, fluidStored, sprite);
    	}
    }

     

    The result is this: (left is water and right is lava)

    2020-04-26_19_56_54.png.8855ca2cd2fa20eb8043bd04b1590659.png2020-04-26_19_56_40.png.4fb06af1ac32cca431f4ee2d7ac36ccf.png

    One problem is that the color  of the water is wrong and that the scale (I guess?) is wrong. It should look something like this:

    Dynamic_Tank_GUI.png.9b6223a74ea595f85e6e975715a44ea3.png

  10. Works now: (it was didn't work because of the "matrixStack.rotate")

    RenderHelper.enableStandardItemLighting();
    				
    matrixStack.push();
    
    matrixStack.scale(0.5f, 0.5f, 0.5f);
    matrixStack.translate(1, 1.5, 1);
    
    Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.NONE, combinedLight, combinedOverlay, matrixStack, buffer);
    
    matrixStack.pop();

     

  11. Hello,

    I updated my mod files from 1.14.4 to 1.15.2 but now me block doesn't render the item

    public class TERChoppingBlock extends TileEntityRenderer<TileEntityChoppingBlock>
    {
    	public TERChoppingBlock(TileEntityRendererDispatcher rendererDispatcher)
    	{
    		super(rendererDispatcher);
    	}
    
    	@Override
    	public void render(TileEntityChoppingBlock tileEntityChoppingBlock, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay)
    	{
    //		GlStateManager.pushLightingAttributes();
    //		GlStateManager.pushMatrix();
    		matrixStack.push();
    
    		BlockPos blockPos = tileEntityChoppingBlock.getPos();
    //		GlStateManager.translated(blockPos.getX(), blockPos.getY(), blockPos.getZ());
    //		GlStateManager.disableRescaleNormal();
    		matrixStack.translate(blockPos.getX(), blockPos.getY(), blockPos.getZ());
    		renderItem(tileEntityChoppingBlock, matrixStack, buffer, combinedLight, combinedOverlay);
    
    		matrixStack.pop();
    //		GlStateManager.popMatrix();
    //		GlStateManager.popAttributes();
    	}
    
    	private void renderItem(TileEntityChoppingBlock tileEntityChoppingBlock, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay)
    	{
    		IItemHandler itemHandler = tileEntityChoppingBlock.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).orElse(null);
    		
    		if(itemHandler != null)
    		{
    			ItemStack stack = itemHandler.getStackInSlot(0);
    			
    			if(!stack.isEmpty())
    			{
    				RenderHelper.enableStandardItemLighting();
    //				GlStateManager.enableLighting();
    //				GlStateManager.pushMatrix();
    				matrixStack.push();
    
    //				GlStateManager.scaled(0.5f, 0.5f, 0.5f);
    //				GlStateManager.translated(1, 1.5, 1);
    //				GlStateManager.rotatef(-90, 0f, 1f, 0f);
    				matrixStack.scale(0.5f, 0.5f, 0.5f);
    				matrixStack.translate(1, 1.5, 1);
    				matrixStack.rotate(new Quaternion(0f, 1f, 0f, -90));
    
    				Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.NONE, combinedLight, combinedOverlay, matrixStack, buffer);
    //				Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.NONE);
    
    				matrixStack.pop();
    //				GlStateManager.popMatrix();
    			}
    		}
    	}
    }

    In the comments is my older 1.14 code.

     

    Wanted behavior from 1.14: (now in 1.15 the log block doesn't render)

    Screen.png.31546a9ca470b82c9c4bc4855fd09962.png

     

     

     

    EDIT:

    I removed this line "matrixStack.translate(blockPos.getX(), blockPos.getY(), blockPos.getZ());" and now this is the result: (o.O)

    Spoiler

    2020-04-24_18_48_21.png.2b56738846d07cf10609f616270d63a0.png

     

  12. I created a throwable rock item and I can throw it but the entity is not rendered.

    This is called during client setup:

    RenderingRegistry.registerEntityRenderingHandler(EntityRock.class, new IRenderFactory<Entity>()
    {
      @Override
      public EntityRenderer<? super Entity> createRenderFor(EntityRendererManager manager)
      {
      	return new SpriteRenderer(manager, Minecraft.getInstance().getItemRenderer());
      }
    });

     

    I found setCustomClientFactory() when creating the entity type but I don't know if I must use it?

  13. So I found this LootUtils class from Draco18s and edited it so I could also add Items to LootTables. If I run my mod within eclipse (runClient) it all works but if I build the mod and use it in my normal minecraft all block do not drop anything.

    Here's the LootUtils code:

    Spoiler
    
    public class LootUtils
    {
    	private static Field tablePools;
    	private static Field poolEntries;
    	private static Field entryItem;
    
    	static
    	{
    		tablePools = ObfuscationReflectionHelper.findField(LootTable.class, "pools");
    		tablePools.setAccessible(true);
    		poolEntries = ObfuscationReflectionHelper.findField(LootPool.class, "lootEntries");
    		poolEntries.setAccessible(true);
    		entryItem = ObfuscationReflectionHelper.findField(ItemLootEntry.class, "item");
    		entryItem.setAccessible(true);
    	}
    	
    	public static boolean removeLootFromTable(LootTable table, Item toRemove)
    	{
    		try
    		{
    			List<LootPool> pools = (List<LootPool>) tablePools.get(table);
    			
    			for(LootPool pool : pools)
    			{
    				List<LootEntry> entries = (List<LootEntry>) poolEntries.get(pool);
    				Iterator<LootEntry> iterator = entries.iterator();
    
    				while(iterator.hasNext())
    				{
    					LootEntry entry = iterator.next();
    
    					if(entry instanceof ItemLootEntry)
    					{
    						ItemLootEntry itemLootEntry = (ItemLootEntry) entry;
    						Item item = (Item) entryItem.get(itemLootEntry);
    
    						if(item == toRemove)
    						{
    							iterator.remove();
    							return true;
    						}
    					}
    				}
    			}
    		} catch(Exception exception)
    		{
    			exception.printStackTrace();
    			return false;
    		}
    		
    		return false;
    	}
    
    	public static LootPool createLootPool(String name, RandomValueRange numRolls, RandomValueRange bonusRolls, LootEntry.Builder entryBuilder, ILootCondition.IBuilder conditionBuilder, ILootFunction.IBuilder functionBuilder)
    	{
    		LootPool.Builder builder = LootPool.builder();
    		builder.name(name);
    		builder.rolls(numRolls);
    		builder.bonusRolls(bonusRolls.getMin(), bonusRolls.getMax());
    		builder.addEntry(entryBuilder);
    		builder.acceptCondition(conditionBuilder);
    		builder.acceptFunction(functionBuilder);
    		
    		return builder.build();
    	}
    
    	public static void addItemToTable(LootTable table, LootPool pool)
    	{
    		table.addPool(pool);
    	}
    
    	public static void addItemToTable(LootTable table, Item item, int weight, float probability, int minQuantity, int maxQuantity, String name)
    	{
    		addItemToTable(table, item, weight, 1, probability, minQuantity, maxQuantity, name);
    	}
    
    	public static void addItemToTable(LootTable table, Item item, int weight, float probability, int quantity, String name)
    	{
    		addItemToTable(table, item, weight, 1, probability, quantity, quantity, name);
    	}
    
    	private static void addItemToTable(LootTable table, Item item, int weight, float numRolls, float probability, int minQuantity, int maxQuantity, String name)
    	{
    		RandomChance.IBuilder conditionBuilder = RandomChance.builder(probability); 
    		SetCount.IBuilder functionBuilder = SetCount.func_215932_a(new RandomValueRange(minQuantity, maxQuantity));
    		
    		ItemLootEntry.Builder entryBuilder = ItemLootEntry.builder(item);
    		entryBuilder.weight(weight);
    		entryBuilder.quality(1);
    		entryBuilder.acceptCondition(conditionBuilder);
    		entryBuilder.acceptFunction(functionBuilder);
    		
    		LootPool newPool = createLootPool(name, new RandomValueRange(numRolls), new RandomValueRange(0), entryBuilder, conditionBuilder, functionBuilder);
    	
    		addItemToTable(table, newPool);
    	}

     

    And my Event:

    Spoiler
    
    private static final ResourceLocation STONE = new ResourceLocation("blocks/stone");
    
    @SubscribeEvent
    public void onLootTableLoad(LootTableLoadEvent event)
    {
      LootTable table = event.getTable();
    	
      if(event.getName().equals(STONE))
      {
        LootUtils.removeLootFromTable(table, Item.getItemFromBlock(Blocks.COBBLESTONE));
        LootUtils.addItemToTable(table, ItemRegistry.ROCK, 10, 1f, 2, 4, "rock");
      }
    }

     

     

  14. 1 hour ago, Draco18s said:

    Its a Forge "bug"

     

    https://github.com/MinecraftForge/MinecraftForge/issues/5615

     

    Currently you are required to have a concrete texture reference in your model file.

    I tried it with "oak_planks" and "block/oak_planks" in the model file but still the same error:

    Unable to resolve texture reference: block/oak_planks in mce:block/drying_rack_side
    Unable to resolve texture reference: block/oak_planks in mce:item/drying_rack

     

  15. Hello!

     

    I have a drying rack block with this blockstate json:

    {
        "forge_marker": 1,
        "defaults": {
            "model": "mce:drying_rack",
    		"textures": {
    			"leg": "minecraft:block/oak_planks"
    		}
        },
        "variants": {
            "facing": {
                "north": { "model": "mce:drying_rack_side", "y": 180 },
                "south": { "model": "mce:drying_rack_side" },
                "east": { "model": "mce:drying_rack_side", "y": 270 },
                "west": { "model": "mce:drying_rack_side", "y": 90 }
            },
    		"inventory": [{}]
        }
    }

    But the console says:

    Unable to resolve texture due to upward reference: #leg in mce:block/drying_rack_side
    Unable to resolve texture due to upward reference: #leg in mce:block/drying_rack_side
    Unable to resolve texture due to upward reference: #leg in mce:block/drying_rack
    Unable to resolve texture due to upward reference: #leg in mce:block/drying_rack_side
    Unable to resolve texture due to upward reference: #leg in mce:block/drying_rack_side
    Unable to resolve texture reference: #leg in mce:block/drying_rack_side
    Unable to resolve texture reference: #leg in mce:item/drying_rack

    It worked in 1.12.2

×
×
  • Create New...

Important Information

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