
Bluexin
Members-
Content Count
6 -
Joined
-
Last visited
Community Reputation
2 NeutralAbout Bluexin
-
Rank
Tree Puncher
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
-
Hello there \o/ So I took a try at making a custom arrow. Everything works fine, except one little detail: it shakes like there's no tomorrow. After some research, I saw a few people having similar issues but they never got an answer. Here's mah code : (the entity) package be.bluexin.rwbym.weaponry; import be.bluexin.rwbym.RWBYModels; import be.bluexin.rwbym.weaponry.dto.AmmoCapDTO; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; /** * Part of rwbym by Bluexin. * * @author Bluexin */ @MethodsReturnNonnullByDefault public class RWBYAmmoEntity extends EntityArrow { // FIXME: for some reason these are shaking like a superpowered vibrator private static final DataParameter<String> RS = EntityDataManager.createKey(RWBYAmmoEntity.class, DataSerializers.STRING); private ResourceLocation rs = new ResourceLocation("minecraft", "textures/entity/projectiles/spectral_arrow.png"); private RWBYAmmoItem itemRef; public RWBYAmmoEntity(World world) { super(world); this.dataManager.set(RS, this.rs.toString()); } public RWBYAmmoEntity(World worldIn, double x, double y, double z, AmmoCapDTO capabilities, RWBYAmmoItem from) { super(worldIn, x, y, z); this.rs = new ResourceLocation(RWBYModels.MODID, capabilities.getTexture()); this.dataManager.set(RS, this.rs.toString()); this.setDamage(capabilities.getBaseDamage()); this.setNoGravity(!capabilities.obeysGravity()); this.itemRef = from; } // TODO: add to dispenser registries (see usage of this constructor in other impl of EntityArrow public RWBYAmmoEntity(World worldIn, EntityLivingBase shooter, AmmoCapDTO capabilities, RWBYAmmoItem from) { this(worldIn, shooter.posX, shooter.posY + (double) shooter.getEyeHeight() - 0.10000000149011612D, shooter.posZ, capabilities, from); this.shootingEntity = shooter; if (shooter instanceof EntityPlayer && capabilities.canPickup()) this.pickupStatus = PickupStatus.ALLOWED; } protected void entityInit() { super.entityInit(); this.dataManager.register(RS, ""); } @Override protected ItemStack getArrowStack() { return new ItemStack(itemRef); } public ResourceLocation getRs() { return new ResourceLocation(this.dataManager.get(RS)); } public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setString("itemRef", this.itemRef == null ? "" : this.itemRef.getRegistryName().toString()); compound.setString("texture", this.rs.toString()); } public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if (compound.hasKey("itemRef")) this.itemRef = (RWBYAmmoItem) Item.getByNameOrId(compound.getString("itemRef")); if (compound.hasKey("texture")) { String s = compound.getString("texture"); this.rs = s.length() > 0 ? new ResourceLocation(s) : null; if (this.rs != null) this.dataManager.set(RS, this.rs.toString()); } } } (the render) package be.bluexin.rwbym.weaponry; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.entity.RenderArrow; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import javax.annotation.ParametersAreNonnullByDefault; /** * Part of rwbym by Bluexin. * * @author Bluexin */ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RWBYAmmoRender extends RenderArrow<RWBYAmmoEntity> { public RWBYAmmoRender(RenderManager renderManagerIn) { super(renderManagerIn); } @Override protected ResourceLocation getEntityTexture(RWBYAmmoEntity entity) { return entity.getRs(); } } I made these by looking at how the vanilla ones (tipped and spectral) were made, but I must have overlooked something. Any clues? Also, how I register the render (jic) RenderingRegistry.registerEntityRenderingHandler(RWBYAmmoEntity.class, RWBYAmmoRender::new); In my client proxy, called on preinit (FMLPreInitializationEvent)
-
Start taking a look at Capabilities (I previously used IExtendedProperties for RPG-style stats systems but they got removed now). Depending on how you want to override the vanilla system and mod integration, you could still use the vanilla HP variables, works just fine (don't forget to override the rendering though, especially if you have a lot of HP, like 200, because vanilla will render all 200 hearts each tick). If you don't want to break balance with other mods, you could find a way of changing the way they interact with the HP (for example, instead of "+2HP make it +10% HP).
-
I guess they may have made a feature which overrides the logs to make sure your username/... isn't written. If my guess is right, it won't affect other mods at all as it should only change the text output. (you could make an easy check by creating a dummy mod searching for your other one's MODID if you really want to though)
-
[1.7.10] [UNSOLVED] Injecting name from a config file into lang file?
Bluexin replied to saxon564's topic in Modder Support
Okay, I did it because i saw sb doing it that way (I'm new to modding ) thanks! Ohhh right... -
[1.7.10] [UNSOLVED] Injecting name from a config file into lang file?
Bluexin replied to saxon564's topic in Modder Support
Wouldn't this work? On: EntityRegistry.registerGlobalEntityID(entityClass, name, id); EntityRegistry.registerModEntity(entityClass, name, id, modInstance, int, int, boolean); (or whatever you use to register your entities) just assign the name to whatever string you would read from your config file? (I didn't try it, I only guess it COULD work...)