Jump to content

Recommended Posts

Posted

Don't call

ModelBakery.registerItemVariants

for the override models, they will automatically be loaded.

 

This error looks like it's caused by Forge trying to load

tetracraft:item/ballisticBow_pulling_1

, which is trying to load the parent model

tetracraft:item/ballisticBow

, which is trying to load the override model

tetracraft:item/ballisticBow_pulling_1

. If you allow the override models to be loaded automatically, you won't run into any circular reference errors.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Replies 83
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Don't call

ModelBakery.registerItemVariants

for the override models, they will automatically be loaded.

 

This error looks like it's caused by Forge trying to load

tetracraft:item/ballisticBow_pulling_1

, which is trying to load the parent model

tetracraft:item/ballisticBow

, which is trying to load the override model

tetracraft:item/ballisticBow_pulling_1

. If you allow the override models to be loaded automatically, you won't run into any circular reference errors.

 

That did the trick, thanks! Also, I'll make a note of that.

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hey Choonster, I got another question, what in the world is Loot Tables? I want to make my entity drop something, but it wants a Loot Table

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hey Choonster, I got another question, what in the world is Loot Tables? I want to make my entity drop something, but it wants a Loot Table

 

See the wiki page. They're basically a more flexible replacement for

ChestGenHooks

/

WeightedRandomChestContent

that are also used for entity drops.

 

Forge hasn't added any hooks for loot tables yet, but you can still register your own using the vanilla classes. You can see my loot table registration class here and a loot table here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Hey Choonster, I got another question, what in the world is Loot Tables? I want to make my entity drop something, but it wants a Loot Table

 

See the wiki page. They're basically a more flexible replacement for

ChestGenHooks

/

WeightedRandomChestContent

that are also used for entity drops.

 

Forge hasn't added any hooks for loot tables yet, but you can still register your own using the vanilla classes. You can see my loot table registration class here and a loot table here.

 

Thanks! How would this work if I want to add a custom condition, like if the player has tamed the entity and it died?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Thanks! How would this work if I want to add a custom condition, like if the player has tamed the entity and it died?

 

It looks like you'll need to create an

EntityProperty

to test whether the entity has been tamed. You'll also need to create its

EntityProperty.Serializer

and register an instance of it with

EntityPropertyManager.registerProperty

.

 

In your loot table, use the

entity_properties

condition with your property.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Thanks! How would this work if I want to add a custom condition, like if the player has tamed the entity and it died?

 

It looks like you'll need to create an

EntityProperty

to test whether the entity has been tamed. You'll also need to create its

EntityProperty.Serializer

and register an instance of it with

EntityPropertyManager.registerProperty

.

 

In your loot table, use the

entity_properties

condition with your property.

 

How do I make Custom Entity Properties? I never made those before, mostly did datawatchers for certain properties like gender and evo stages.

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

How do I make Custom Entity Properties? I never made those before, mostly did datawatchers for certain properties like gender and evo stages.

 

You need to implement

EntityProperty

, look at

EntityOnFire

for an example.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Ok so I made the entity property class but I'm not sure on how to acutally register it for the entity to use (And test to see if it works)

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Ok so I made the entity property class but I'm not sure on how to acutally register it for the entity to use (And test to see if it works)

 

Did you create and register the

Serializer

?

 

Look at the pig loot table to see how it uses the

on_fire

property to determine whether the meat should be cooked.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I'm not sure but while I was looking at the pig entity coding, I did find where I can acutally add in other conditions that isn't added to Loot Tables

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hm, I having a bit of an issue with my loot table, the item I made isn't dropping. Also the contionus bow I made, not all of the textures is being shown, it just shows the first two but not the last one.

 

The Source for this issue is in this commit

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

EntityTamed

is actually testing whether the entity is burning rather than whether it's tamed. You need to check whether the entity is tameable (

entity instanceof EntityTameable

) and whether it's tamed (

((EntityTameable) entity).isTamed()

) and then compare that to the expected result.

 

Your

ballisticBow

model is using

pull

instead of

tetracraft:pull

for the

ballisticBow_pulling_2

override model's condition.

 

You seem to have two copies of your main class and registration/initialisation classes, one in the

novaviper.tetracraft.main

package and one in the

novaviper.tetracraft.common.inti

package (should that be

init

rather than

inti

?). Delete the outdated copy.

 

I'm not too sure why it's not dropping your item.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Oh yeah, sorry about leaving that main package there, and I fixed that typo in the bow json and package. I did the EntityTamed like this

 

package novaviper.tetracraft.common.entity.properties;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.conditions.EntityHasScore;
import net.minecraft.world.storage.loot.properties.EntityProperty;
import novaviper.tetracraft.common.entity.EntityModTameable;

import java.util.Random;

/**
* Created by NovaViper on 4/11/2016.
* Class Purpose: Declares Entity Property for Tamed Mod Entities
*/
public class EntityTamed implements EntityProperty
{
private final boolean isTamed;

public EntityTamed(boolean isTamedIn)
{
	this.isTamed = isTamedIn;
}

public boolean testProperty(Random random, Entity entityIn)
{
	if(entityIn instanceof EntityTameable){
		EntityTameable entityTameable = (EntityTameable)entityIn;
		if(entityTameable.isTamed()){
			return this.isTamed == true;
		}else{
			return this.isTamed == false;
		}
	}else{
		return this.isTamed == false;
	}
}

public static Serializer getSerializer(){
	return new Serializer();
}

public static class Serializer extends EntityProperty.Serializer<EntityTamed>
{
	protected Serializer()
	{
		super(new ResourceLocation("is_tamed"), EntityTamed.class);
	}

	public JsonElement serialize(EntityTamed property, JsonSerializationContext serializationContext)
	{
		return new JsonPrimitive(Boolean.valueOf(property.isTamed));
	}

	public EntityTamed deserialize(JsonElement element, JsonDeserializationContext deserializationContext)
	{
		return new EntityTamed(JsonUtils.getBoolean(element, "is_tamed"));
	}
}
}

 

How do I acutally register this?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

You should include your mod ID in your property name

ResourceLocation

to avoid conflicts with other mods defining similar properties.

 

I already explained how to register your property:

You'll also need to create its

EntityProperty.Serializer

and register an instance of it with

EntityPropertyManager.registerProperty

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Caused by: java.lang.IllegalArgumentException: Can't re-register entity property name minecraft:is_tamed

at net.minecraft.world.storage.loot.properties.EntityPropertyManager.registerProperty(EntityPropertyManager.java:19) ~[EntityPropertyManager.class:?]

at novaviper.tetracraft.common.entity.EntityTerrakon.<init>(EntityTerrakon.java:43) ~[EntityTerrakon.class:?]

 

The property should be registered once in preInit, not every time the

EntityTerrakon

constructor is called.

 

As I said before, you should include your mod ID in your property name

ResourceLocation

to avoid conflicts with other mods defining similar properties.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Sorry for not responding in a while and I did get that error fixed, I have another question relating with commands. Is it possible to make sub-commands like

/tetracraft admin tame

and

/tetracraft help

? And for the admin commands, only restrict them to the owner/admin while leaving the other ones like

/tetracraft help

to be used by everyone?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

The existing command system has no concept of sub-commands, but you should be able to create an

ICommand

that implements

ICommandManager

by wrapping your own implementation of

CommandHandler

. This should allow you to register sub-commands and re-use the existing permissions system.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Basically I should make my own

CommandHandler

class that implements

ICommand

and

ICommandManager

correct?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

It's probably easiest to extend

CommandHandler

and implement

ICommand

, since

CommandHandler

provides a lot more functionality for you than

CommandBase

does (most of the useful methods from

CommandBase

are static, so you can use them from any implementation of

ICommand

).

 

Register this class like a normal command, then register your sub-commands with this class.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Should I make the class abstract? Also.. Should I override the

exeuteCommand

methods in

CommandHandler

and place the mod id here:

        if (rawCommand.startsWith("/")) <<<<<
        {
            rawCommand = rawCommand.substring(1);
        }

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

You need to create an instance of this class to register it as a command, so don't make it abstract.

 

You don't need to override

CommandHandler#executeCommand

, it should only ever be called from within the same class.

 

Implement

ICommand#execute

to join the arguments array into a single string and call

executeCommand

with it.

 

/tetracraft foo bar

will execute the

/tetracraft

command, which will pass

foo bar

to

executeCommand

. This will execute the

foo

sub-command with

bar

as its argument.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Ah ok, so should I just leave everything in the handler I made blank and have the subcommands write something for each of the implements from

ICommand

?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

I've actually implemented this myself now, I did it slightly differently than I originally suggested (which was mostly off the top of my head).

 

The command itself extends

CommandBase

and has a field storing an instance of a nested class that extends

CommandHandler

to manage the sub-commands.

 

It overrides

ICommand#execute

to call

ICommandManager#executeCommand

and

ICommand#getTabCompletionOptions

to call

ICommandManager#getTabCompletionOptions

, both on the sub-command manager.

 

It overrides

ICommand#isUsernameIndex

to check if the index is greater than 0 and the first argument is a valid sub-command. It then creates a copy of the arguments array without the first argument and calls

ICommand#isUsernameIndex

on the sub-command with this new array and the index minus 1.

 

When the sub-command manager is created, it calls

ModCommands.registerSubCommands

to register the sub-commands. These are just regular commands that return usage text starting with

/testmod3 command

instead of

/command

.

 

You can see my implementation here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




×
×
  • Create New...

Important Information

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