Jump to content

GiantNuker

Members
  • Posts

    139
  • Joined

Everything posted by GiantNuker

  1. Here is my item code: import mods.giantnuker.backslash.item.ItemBasicArmor; import mods.giantnuker.backslash.item.ItemData; import mods.giantnuker.javautil.Pair; import mods.giantnuker.javautil.PairList; import mods.giantnuker.modifiablearmorredone.modifiers.ArmorModifier; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.EnumHelper; public class ItemModableArmor extends ItemBasicArmor { public ItemModableArmor(EntityEquipmentSlot slot) { super(ModArmor.MODID, "modifiablearmor." + slot.toString(), ArmorMaterial.LEATHER, slot, true); this.setMaxDamage(1); } public PairList<ArmorModifier, NBTTagCompound> getModifiers(NBTTagList modList) { if (modList == null) return new PairList(); PairList<ArmorModifier, NBTTagCompound> modifiers = new PairList(); for (NBTBase nbt1 : modList) { if (!(nbt1 instanceof NBTTagCompound)) continue; NBTTagCompound nbt2 = (NBTTagCompound) nbt1; ResourceLocation id = new ResourceLocation(nbt2.getString("id")); if (!ArmorModifier.MAP.containsKey(id)) continue; NBTTagCompound nbt3 = nbt2.getCompoundTag("data"); if (nbt3 == null) nbt3 = new NBTTagCompound(); modifiers.add(ArmorModifier.MAP.get(id), nbt3); } return modifiers; } public void setupMods(ItemStack stack) { NBTTagCompound nbt = (NBTTagCompound) ItemData.getStackNBTTag(stack, "itemData", new NBTTagCompound()); PairList<ArmorModifier, NBTTagCompound> modifiers = getModifiers((NBTTagList) nbt.getTag("modifiers")); nbt.setInteger("reduction", this.damageReduceAmount); nbt.setFloat("toughness", this.toughness); nbt.setInteger("maxDamage", MAConfig.maxDamage); for (Pair<ArmorModifier, NBTTagCompound> modifier : modifiers) { modifier.getA().apply(modifier.getB(), this.armorType, stack); } ItemData.setStackNBTTag(stack, "itemData", nbt); stack.getMaxDamage(); } public void addModifier(ItemStack stack, ArmorModifier modifier, NBTTagCompound nbt) { NBTTagCompound nbtI = (NBTTagCompound) ItemData.getStackNBTTag(stack, "itemData", new NBTTagCompound()); NBTTagList mods = (NBTTagList) nbt.getTag("modifiers"); if (mods == null) mods = new NBTTagList(); NBTTagCompound nbtM = new NBTTagCompound(); nbtM.setString("id", modifier.toString()); nbtM.setTag("data", nbt); mods.appendTag(nbtM); nbtI.setTag("modifiers", mods); ItemData.setStackNBTTag(stack, "itemData", nbtI); } public void initNBT(ItemStack stack) { NBTTagCompound nbt = (NBTTagCompound) ItemData.getStackNBTTag(stack, "itemData", new NBTTagCompound()); if (nbt.getInteger("reduction") == 0) nbt.setInteger("reduction", this.damageReduceAmount); if (nbt.getInteger("toughness") == 0) nbt.setFloat("toughness", this.toughness); if (nbt.getInteger("maxDamage") == 0) nbt.setInteger("maxDamage", MAConfig.maxDamage); ItemData.setStackNBTTag(stack, "itemData", nbt); } @Override public int getMaxDamage(ItemStack stack) { initNBT(stack); NBTTagCompound nbt = (NBTTagCompound) ItemData.getStackNBTTag(stack, "itemData", new NBTTagCompound()); if (stack.getItemDamage() != -1)return nbt.getInteger("maxDamage"); else return 0; } @Override public int getDamage(ItemStack stack) { initNBT(stack); NBTTagCompound nbt = (NBTTagCompound) ItemData.getStackNBTTag(stack, "itemData", new NBTTagCompound()); if (super.getDamage(stack) >= nbt.getInteger("maxDamage")) { this.setDamage(stack, nbt.getInteger("maxDamage")); return -1; } return super.getDamage(stack); } } I want to know why this thing cannot get damaged. This item is supposed to be unbreakable. If it gets broken, it goes into an unuseable state(not yet coded). Note: getDamage has never returned -1. Note2: No modifiers, so maxDamage is always 500.
  2. I do not want to mess up everything by replacing every single renderer. I just want to add my LayerHitProjectile to every entity. LayerHitProjectile is basically for rendering things like arrows in entities, and things like spears etc... But it should go on every mob, so is there anything like RenderPlayerEvent for other entities?
  3. there is no writeString method in ByteBuf.
  4. why
  5. Thanks, Iwas wondering why horses used a data peramiter for that
  6. Thank You!!!! Never again will I have so much trouble sending strings
  7. It would be much less of a pain to send packets if I knew how to put NBT in them, it is possible, because when I spawn an entity, my NBT read code activates: [13:26:48] [Server thread/INFO]: Saving and pausing game... [13:26:48] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [13:26:48] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [13:26:48] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:77]: deser [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:83]: body_chestnut [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_whitefield [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_whitedots [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_white [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_blackfield [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_greyfield [13:26:50] [Server thread/INFO]: [mods.giantnuker.horse.Markings:deserializeNBT:88]: mark:marks_white This first prints the body image, body_chestnut, then all the additional markings the horse has, marks_whitedots, marks_greyfield. Help would be nice
  8. Hi, I am trying to make a custom horse. The NBT does not save. The marking data is completely different. First attatchmet was at spawn, second was after a reload, third was after another. EntityModHorse: package mods.giantnuker.horse.entity; import javax.annotation.Nullable; import com.google.common.base.Predicate; import mods.giantnuker.horse.Markings; import mods.giantnuker.horse.ai.EntityAIHorseAttack; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWanderAvoidWater; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.AbstractChestHorse; import net.minecraft.entity.passive.AbstractHorse; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; public class EntityModHorse extends AbstractHorse { public int openMouthCounter = 0; public Markings markings = new Markings(); public Predicate<Entity> BREEDABLE_HORSE = new Predicate<Entity>() { @Override public boolean apply(Entity input) { if (!(input instanceof EntityModHorse))return false; EntityModHorse horse = (EntityModHorse) input; if (!horse.canBreed(EntityModHorse.this)) return false; return true; } }; public EntityModHorse(World world) { super(world); this.canGallop = true; } @Override protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIHorseAttack(this)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D, EntityModHorse.class)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.3D)); this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 0.8D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); } public boolean isBreedingItem(ItemStack item) { return item.getItem() == Items.GOLDEN_CARROT || item.getItem() == Items.SPECKLED_MELON || item.getItem() == Items.GOLDEN_APPLE; } @Override protected AbstractHorse getClosestHorse(Entity entityIn, double range) { return closestBreedableHorse(range); } @Nullable public EntityModHorse closestBreedableHorse(double range) { EntityModHorse cHorse = null; double dist = Double.MAX_VALUE; for (Entity entity : this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().expand(range, range, range), BREEDABLE_HORSE)) { if (this.getDistanceSqToEntity(entity) < dist) { cHorse = (EntityModHorse) entity; dist = this.getDistanceSqToEntity(entity); } } return cHorse; } public boolean canBreed(EntityModHorse breedWith) { return true; } @Override public void onUpdate() { super.onUpdate(); if (this.openMouthCounter > 0) { this.openMouthCounter--; this.setHorseWatchableBoolean(64, true); } else if (openMouthCounter == -1) { this.setHorseWatchableBoolean(64, true); } //else { //this.setHorseWatchableBoolean(64, false); //} } /**open mouth for time, time may be -1 for until set to close*/ public void openHorseMouth(int time) { if (!this.world.isRemote) { this.openMouthCounter = time; this.setHorseWatchableBoolean(64, true); } } public void closeHorseMouth() { if (!this.world.isRemote) { this.openMouthCounter = 0; this.setHorseWatchableBoolean(64, false); } } @Override public EntityModHorse createChild(EntityAgeable mate) { EntityModHorse horse = new EntityModHorse(this.world); horse.markings = Markings.merge(this.markings, ((EntityModHorse)mate).markings); return horse; } public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); boolean flag = !itemstack.isEmpty(); if (flag && itemstack.getItem() == Items.SPAWN_EGG) { return super.processInteract(player, hand); } else { if (!this.isChild()) { if (this.isTame() && player.isSneaking()) { this.openGUI(player); return true; } if (this.isBeingRidden()) { return super.processInteract(player, hand); } } if (flag) { if (this.handleEating(player, itemstack)) { if (!player.capabilities.isCreativeMode) { itemstack.shrink(1); } return true; } if (itemstack.interactWithEntity(player, this, hand)) { return true; } if (!this.isTame()) { this.makeMad(); return true; } //boolean flag1 = HorseArmorType.getByItemStack(itemstack) != HorseArmorType.NONE; boolean flag2 = !this.isChild() && !this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE; if (/*flag1 ||*/ flag2) { this.openGUI(player); return true; } } if (this.isChild()) { return super.processInteract(player, hand); } else { this.mountTo(player); return true; } } } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setTag("looks", markings.serializeNBT()); return nbt; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); markings.deserializeNBT(nbt.getTag("looks")); } protected SoundEvent getAmbientSound() { super.getAmbientSound(); return SoundEvents.ENTITY_HORSE_AMBIENT; } protected SoundEvent getDeathSound() { super.getDeathSound(); return SoundEvents.ENTITY_HORSE_DEATH; } protected SoundEvent getHurtSound(DamageSource p_184601_1_) { super.getHurtSound(p_184601_1_); return SoundEvents.ENTITY_HORSE_HURT; } protected SoundEvent getAngrySound() { super.getAngrySound(); return SoundEvents.ENTITY_HORSE_ANGRY; } protected ResourceLocation getLootTable() { return LootTableList.ENTITIES_HORSE; } public static class GroupData implements IEntityLivingData { public Markings variant; public GroupData(Markings variantIn) { this.variant = variantIn; } } } Markings package mods.giantnuker.horse; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import java.util.Random; import mods.giantnuker.backslash.DoubleMap; import mods.giantnuker.backslash.ListMap; import mods.giantnuker.horse.entity.EntityModHorse; import mods.giantnuker.javautil.ArrayUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.LayeredTexture; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.INBTSerializable; public class Markings implements INBTSerializable { public static final String KEY_BODY_PART = "body_part"; public static final String KEY_BODY = "body"; public static final String KEY_MARKING = "marking"; public static final String KEY_ADDED_ALL = "add_all"; //Registry public static Random rand = new Random(); public static Markings merge(Markings marksA, Markings marksB) { if (marksB == null || marksA.equals(marksB)) return marksA.copy(); Markings markings = new Markings(); markings.markings.clear(); /*if (rand.nextInt(5) != 0)*/ markings.bodyBase = rand.nextBoolean() ? marksA.bodyBase : marksB.bodyBase; for (Entry<String, List<String>> e : marksA.markings.entrySet()) { for (String s : e.getValue()) { if (rand.nextBoolean()) markings.markings.add(e.getKey(), s); } } for (Entry<String, List<String>> e : marksB.markings.entrySet()) { for (String s : e.getValue()) { if (rand.nextBoolean()) markings.markings.add(e.getKey(), s); } } return markings; } public static final HashMap<String, ResourceLocation> renders = new HashMap(); public static final DoubleMap<String, String, ResourceLocation> tex_ids = new DoubleMap(); static { //Body tex_ids.put(KEY_BODY, "black", new ResourceLocation(HorseMod.MODID, "textures/entity/body/black.png")); tex_ids.put(KEY_BODY, "white", new ResourceLocation(HorseMod.MODID, "textures/entity/body/white.png")); tex_ids.put(KEY_BODY, "creamy", new ResourceLocation(HorseMod.MODID, "textures/entity/body/creamy.png")); tex_ids.put(KEY_BODY, "chestnut", new ResourceLocation(HorseMod.MODID, "textures/entity/body/chestnut.png")); tex_ids.put(KEY_BODY, "brown", new ResourceLocation(HorseMod.MODID, "textures/entity/body/brown.png")); tex_ids.put(KEY_BODY, "darkbrown", new ResourceLocation(HorseMod.MODID, "textures/entity/body/darkbrown.png")); tex_ids.put(KEY_BODY, "gray", new ResourceLocation(HorseMod.MODID, "textures/entity/body/gray.png")); //Mane tex_ids.put(KEY_BODY_PART, "mane_black0", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/black0.png")); tex_ids.put(KEY_BODY_PART, "mane_black1", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/black1.png")); tex_ids.put(KEY_BODY_PART, "mane_white0", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/white0.png")); tex_ids.put(KEY_BODY_PART, "mane_white1", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/white1.png")); tex_ids.put(KEY_BODY_PART, "mane_creamy0", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/creamy0.png")); tex_ids.put(KEY_BODY_PART, "mane_creamy1", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/creamy1.png")); tex_ids.put(KEY_BODY_PART, "mane_chestnut0", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/chestnut0.png")); tex_ids.put(KEY_BODY_PART, "mane_chestnut1", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/chestnut1.png")); tex_ids.put(KEY_BODY_PART, "mane_brown0", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/brown0.png")); tex_ids.put(KEY_BODY_PART, "mane_brown1", new ResourceLocation(HorseMod.MODID, "textures/entity/mane/brown1.png")); //Tail tex_ids.put(KEY_BODY_PART, "tail_white0", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/white0.png")); tex_ids.put(KEY_BODY_PART, "tail_white1", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/white1.png")); tex_ids.put(KEY_BODY_PART, "tail_black0", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/black0.png")); tex_ids.put(KEY_BODY_PART, "tail_black1", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/black1.png")); tex_ids.put(KEY_BODY_PART, "tail_creamy_top0", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/creamy_top0.png")); tex_ids.put(KEY_BODY_PART, "tail_creamy_top1", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/creamy_top1.png")); tex_ids.put(KEY_BODY_PART, "tail_chestnut0", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/chestnut0.png")); tex_ids.put(KEY_BODY_PART, "tail_chestnut1", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/chestnut1.png")); tex_ids.put(KEY_BODY_PART, "tail_chestnut_top1", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/chestnut3.png")); tex_ids.put(KEY_BODY_PART, "tail_chestnut_top0", new ResourceLocation(HorseMod.MODID, "textures/entity/tail/chestnut2.png")); //add to all tex_ids.put(KEY_ADDED_ALL, "chest", new ResourceLocation(HorseMod.MODID, "textures/entity/misc/chest.png")); tex_ids.put(KEY_ADDED_ALL, "riding_gear", new ResourceLocation(HorseMod.MODID, "textures/entity/misc/riding_gear.png")); //Additional Markings tex_ids.put(KEY_MARKING, "blackdots", new ResourceLocation(HorseMod.MODID, "textures/entity/marking/blackdots.png")); tex_ids.put(KEY_MARKING, "greyfield", new ResourceLocation(HorseMod.MODID, "textures/entity/marking/greyfield.png")); tex_ids.put(KEY_MARKING, "blackfield", new ResourceLocation(HorseMod.MODID, "textures/entity/marking/blackfield.png")); tex_ids.put(KEY_MARKING, "blaze", new ResourceLocation(HorseMod.MODID, "textures/entity/marking/blaze.png")); tex_ids.put(KEY_MARKING, "white", new ResourceLocation("textures/entity/horse/horse_markings_white.png")); tex_ids.put(KEY_MARKING, "whitefield", new ResourceLocation("textures/entity/horse/horse_markings_whitefield.png")); tex_ids.put(KEY_MARKING, "whitedots", new ResourceLocation("textures/entity/horse/horse_markings_whitedots.png")); tex_ids.put(KEY_MARKING, "blackshag", new ResourceLocation("textures/entity/horse/horse_markings_blackdots.png")); } //Instance public Markings() { randomize(); } public Markings(int oldID) { /*int j = (oldID & 255) % 7; int k = ((oldID & 65280) >> 8) % 5; switch (j) { case 1: baseCoat = "creamy"; case 2: baseCoat = "chestnut"; case 3: baseCoat = "brown"; case 4: baseCoat = "black"; case 5: baseCoat = "gray"; case 6: baseCoat = "darkbrown"; default:baseCoat = "white"; } switch (k) { case 1: markings.add("marks_whitefield"); case 2: markings.add("marks_whitedots"); case 3: markings.add("marks_blackdots"); default:markings.add("marks_white"); }*/ } public void randomize() { markings.clear(); bodyBase = tex_ids.keySet(KEY_BODY).get(new Random().nextInt(tex_ids.size(KEY_BODY))); int bodyParts = rand.nextInt(5); for (int i = 0; i < bodyParts; i++) { String mark = tex_ids.keySet(KEY_BODY_PART).get(rand.nextInt(tex_ids.size(KEY_BODY_PART))); if (markings.contains(KEY_BODY_PART, mark)) continue; markings.add(KEY_BODY_PART, mark); } int marks = rand.nextInt(5); for (int i = 0; i < marks; i++) { String mark = tex_ids.keySet(KEY_MARKING).get(rand.nextInt(tex_ids.size(KEY_MARKING))); if (markings.contains(KEY_MARKING, mark)) continue; markings.add(KEY_MARKING, mark); } } public ListMap<String, String> markings = new ListMap(); public String bodyBase = null; @Override public void deserializeNBT(NBTBase arg0) { if (!(arg0 instanceof NBTTagCompound)) { return; } NBTTagCompound nbt = (NBTTagCompound) arg0; System.out.println("-------------------------"); for (String key : nbt.getKeySet()) { if (key == "bodyBase") bodyBase = nbt.getString(key); else if (nbt.getTag(key) instanceof NBTTagList){ markings.clear(key); NBTTagList list = (NBTTagList) nbt.getTag(key); for (NBTBase nbt2 : list) { if (nbt2 instanceof NBTTagString) markings.add(key, ((NBTTagString)nbt2).getString()); } } } System.out.println(markings); } @Override public NBTBase serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("bodyBase", bodyBase); for (Entry<String, List<String>> e : markings.entrySet()) { NBTTagList tl = new NBTTagList(); for (String s : e.getValue()) tl.appendTag(new NBTTagString(s)); nbt.setTag(e.getKey(), tl); } return nbt; } public ResourceLocation getTex() { String texId = "gianthorses:b" + bodyBase; for (Entry<String, List<String>> list : markings.entrySet()) { texId += "[" + list.getKey() + "]"; for (String s : list.getValue()) texId += "(" + s + ")"; } ResourceLocation tex = renders.get(texId); if (tex == null) { tex = new ResourceLocation(texId); ArrayList<String> tex_mp = new ArrayList(); tex_mp.add(tex_ids.get(KEY_BODY, bodyBase).toString()); //for (int i = 0; i < markings.size(); i++) tex_lst[i + 1] = (tex_ids.get(markings.get(i)).toString()); for (Entry<String, List<String>> list: markings.entrySet()) { for (String s : list.getValue()) tex_mp.add(tex_ids.get(list.getKey(), s).toString()); } for (String s : tex_ids.keySet(KEY_ADDED_ALL)) { tex_mp.add(tex_ids.get(KEY_ADDED_ALL, s).toString()); } Minecraft.getMinecraft().getTextureManager().loadTexture(tex, new LayeredTexture(tex_mp.toArray(new String[0]))); renders.put(texId, tex); } return tex; } public Markings copy() { System.out.println("cpy"); Markings m = new Markings(); m.markings.clear(); m.bodyBase = this.bodyBase; for (Entry<String, List<String>> e : this.markings.entrySet()) { for (String s : e.getValue()) { m.markings.add(e.getKey(), s); } } System.out.println("B4:" + markings); System.out.println("AFTER:" + m.markings); return m; } } All my checks show that the horses have the right data, do I need to send packets to the client to tell it what the horse's NBT is?
  9. It is immobile & does not die, I have not made a replacemet for entityThrowable yet, it only extends it because it was the first class that came to mind.
  10. Well, none of my server-to-client data is saved, and I do not get an nbt reading message on world load.
  11. It is a shield entity. It is cast by a magic wand. The wand has no nbt/capabilities, It is all stored in the player's capability. Also just did that 2017-10-10 10:07:12,594 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [10:07:12] [main/INFO]: Extra: [] [10:07:12] [main/INFO]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/T902/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [10:07:13] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [10:07:13] [main/INFO]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [10:07:13] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [10:07:13] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [10:07:13] [main/INFO]: Forge Mod Loader version 14.23.0.2494 for Minecraft 1.12.2 loading [10:07:13] [main/INFO]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_144, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre1.8.0_144 [10:07:13] [main/INFO]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [10:07:13] [main/INFO]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin [10:07:13] [main/INFO]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin [10:07:13] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [10:07:13] [main/INFO]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [10:07:13] [main/INFO]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [10:07:13] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:07:13] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [10:07:13] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [10:07:13] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:07:13] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:07:13] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper 2017-10-10 10:07:14,085 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-10-10 10:07:14,804 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [10:07:19] [main/ERROR]: FML appears to be missing any signature data. This is not a good thing [10:07:19] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [10:07:19] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [10:07:21] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [10:07:21] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [10:07:21] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [10:07:21] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main} [10:07:23] [main/INFO]: Setting user: Player327 [10:07:33] [main/WARN]: Skipping bad option: lastServer: [10:07:33] [main/INFO]: LWJGL Version: 2.9.4 [10:07:35] [main/INFO]: -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_144, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 752826728 bytes (717 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '3.3.0 - Build 8.15.10.2696' Renderer: 'Intel(R) HD Graphics 4000' [10:07:35] [main/INFO]: MinecraftForge v14.23.0.2494 Initialized [10:07:35] [main/INFO]: Starts to replace vanilla recipe ingredients with ore ingredients. [10:07:35] [main/INFO]: Replaced 1036 ore ingredients [10:07:36] [main/INFO]: Found 0 mods from the command line. Injecting into mod discoverer [10:07:36] [main/INFO]: Searching C:\Users\T902\Programming\Java\Minecraft\1.12\run\mods for mods [10:07:38] [Thread-3/INFO]: Using sync timing. 200 frames of Display.update took 562921265 nanos [10:07:40] [main/INFO]: Forge Mod Loader has identified 7 mods to load [10:07:41] [main/INFO]: Attempting connection with missing mods [minecraft, mcp, FML, forge, backslash, giantwizardry, guideapi] at CLIENT [10:07:41] [main/INFO]: Attempting connection with missing mods [minecraft, mcp, FML, forge, backslash, giantwizardry, guideapi] at SERVER [10:07:42] [main/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:BackSlash API, FMLFileResourcePack:Giant's Wizardry, FMLFileResourcePack:Guide-API [10:07:42] [main/INFO]: Processing ObjectHolder annotations [10:07:42] [main/INFO]: Found 1168 ObjectHolder annotations [10:07:42] [main/INFO]: Identifying ItemStackHolder annotations [10:07:42] [main/INFO]: Found 0 ItemStackHolder annotations [10:07:43] [main/INFO]: Configured a dormant chunk cache size of 0 [10:07:43] [Forge Version Check/INFO]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Starting Block Registration----- [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Finished Block Registration----- [10:07:43] [main/INFO]: Applying holder lookups [10:07:43] [main/INFO]: Holder lookups applied [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Starting Item Registration----- [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: Registered Item "giantwizardry:wand" into forge registry [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Finished Item Registration----- [10:07:43] [main/INFO]: Applying holder lookups [10:07:43] [main/INFO]: Holder lookups applied [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Starting Potion Effect Registration----- [10:07:43] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Finished Potion Effect Registration----- [10:07:43] [main/INFO]: Applying holder lookups [10:07:43] [main/INFO]: Holder lookups applied [10:07:43] [main/INFO]: Applying holder lookups [10:07:43] [main/INFO]: Holder lookups applied [10:07:43] [main/INFO]: Injecting itemstacks [10:07:43] [main/INFO]: Itemstack injection complete [10:07:44] [Forge Version Check/INFO]: [forge] Found status: OUTDATED Target: 14.23.0.2512 [10:07:55] [Sound Library Loader/INFO]: Starting up SoundSystem... [10:07:55] [Thread-5/INFO]: Initializing LWJGL OpenAL [10:07:55] [Thread-5/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [10:07:55] [Thread-5/INFO]: OpenAL initialized. [10:07:56] [Sound Library Loader/INFO]: Sound engine started [10:08:09] [main/INFO]: Max texture size: 8192 [10:08:10] [main/INFO]: Created: 512x512 textures-atlas [10:08:14] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: ------------Registered Custom Recipes(0) [10:08:14] [main/INFO]: Applying holder lookups [10:08:14] [main/INFO]: Holder lookups applied [10:08:14] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Seting Up Renderer for following Items----- [10:08:14] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: Render Set up for item "giantwizardry:wand" whith meta 1 as "giantwizardry:wandlit" [10:08:14] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: Render Set up for item "giantwizardry:wand" whith meta 0 as "giantwizardry:wand" [10:08:14] [main/INFO]: [mods.giantnuker.backslash.Logger:logMsg:15]: [BackSlash API]: -----Finished Setting Up Renders----- [10:08:14] [main/INFO]: Injecting itemstacks [10:08:14] [main/INFO]: Itemstack injection complete [10:08:14] [main/INFO]: Forge Mod Loader has successfully loaded 7 mods [10:08:14] [main/WARN]: Skipping bad option: lastServer: [10:08:15] [main/INFO]: Narrator library for x64 successfully loaded [10:08:18] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id [10:08:39] [main/INFO]: Deleting level New World [10:08:39] [main/INFO]: Attempt 1... [10:08:45] [Server thread/INFO]: Starting integrated minecraft server version 1.12.2 [10:08:45] [Server thread/INFO]: Generating keypair [10:08:45] [Server thread/INFO]: Injecting existing registry data into this server instance [10:08:45] [Server thread/INFO]: Applying holder lookups [10:08:45] [Server thread/INFO]: Holder lookups applied [10:08:46] [Server thread/INFO]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1ad5e160) [10:08:47] [Server thread/INFO]: Loaded 488 advancements [10:08:48] [Server thread/INFO]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1ad5e160) [10:08:48] [Server thread/INFO]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1ad5e160) [10:08:48] [Server thread/INFO]: Preparing start region for level 0 [10:08:49] [Server thread/INFO]: Preparing spawn area: 4% [10:08:50] [Server thread/INFO]: Preparing spawn area: 7% [10:08:51] [Server thread/INFO]: Preparing spawn area: 9% [10:08:52] [Server thread/INFO]: Preparing spawn area: 13% [10:08:53] [Server thread/INFO]: Preparing spawn area: 15% [10:08:54] [Server thread/INFO]: Preparing spawn area: 20% [10:08:55] [Server thread/INFO]: Preparing spawn area: 27% [10:08:56] [Server thread/INFO]: Preparing spawn area: 36% [10:08:57] [Server thread/INFO]: Preparing spawn area: 46% [10:08:58] [Server thread/INFO]: Preparing spawn area: 55% [10:08:59] [Server thread/INFO]: Preparing spawn area: 62% [10:09:00] [Server thread/INFO]: Preparing spawn area: 68% [10:09:01] [Server thread/INFO]: Preparing spawn area: 79% [10:09:02] [Server thread/INFO]: Preparing spawn area: 92% [10:09:03] [Server thread/INFO]: Changing view distance to 2, from 10 [10:09:06] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2441ms behind, skipping 48 tick(s) [10:09:12] [Netty Local Client IO #0/INFO]: Server protocol version 2 [10:09:12] [Netty Server IO #1/INFO]: Client protocol version 2 [10:09:12] [Netty Server IO #1/INFO]: Client attempting to join with 7 mods : [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] [10:09:12] [Server thread/INFO]: [Server thread] Server side modded connection established [10:09:13] [Netty Local Client IO #0/INFO]: [Netty Local Client IO #0] Client side modded connection established [10:09:13] [Server thread/INFO]: Player327[local:E:5752a670] logged in with entity id 2175 at (-83.5, 68.0, 256.5) [10:09:13] [Server thread/INFO]: Player327 joined the game 7 0.01 [10:09:15] [Server thread/INFO]: Saving and pausing game... [10:09:15] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:09:17] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:09:17] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:09:17] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@5166b06b[id=29308414-ff71-3cdd-a4fa-c0ef7b0196d4,name=Player327,properties={},legacy=false] com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?] at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3007) [Minecraft.class:?] at net.minecraft.client.resources.SkinManager$3.run(SourceFile:110) [SkinManager$3.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_144] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_144] at java.lang.Thread.run(Unknown Source) [?:1.8.0_144] [10:10:59] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.SpellRegistry:getForIncantation:42]: inc [10:10:59] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.SpellRegistry:getForIncantation:42]: protego [10:10:59] [Server thread/INFO]: <Player327> Protego [10:10:59] [main/INFO]: [CHAT] <Player327> Protego [10:11:02] [Server thread/INFO]: Saving and pausing game... [10:11:02] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:11:02] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:11:02] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:11:02] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:11:27] [Server thread/INFO]: [Player327: Teleported Player327 to -84.18883450480062, 71.07840000152588, 258.2905688524473] [10:11:27] [main/INFO]: [CHAT] Teleported Player327 to -84.18883450480062, 71.07840000152588, 258.2905688524473 [10:11:41] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:11:51] [Server thread/INFO]: Saving and pausing game... [10:11:51] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:11:51] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:11:51] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:11:51] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:11:55] [Server thread/INFO]: Saving and pausing game... [10:11:55] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:11:55] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:11:55] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:11:55] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:12:11] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.SpellRegistry:getForIncantation:42]: inc [10:12:11] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.SpellRegistry:getForIncantation:42]: protego [10:12:11] [Server thread/INFO]: <Player327> Protego [10:12:12] [main/INFO]: [CHAT] <Player327> Protego [10:12:18] [Server thread/INFO]: Saving and pausing game... [10:12:19] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:12:19] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:12:19] [Server thread/INFO]: [mods.giantnuker.wizardry.spell.entity.EntityShieldCharm:writeToNBT:66]: --------------------------------------------------------------Writing NBT------------------------------------------- [10:12:19] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:12:19] [Server thread/INFO]: Saving chunks for level 'New World'/the_end The NBT is never read. Do you know how I can fix this? Edit: But someting's not right - It's position is saved, That requires NBT reading...
  12. I have two spell entities - one is a shield, the other is a disarming bullet. NBT is not being saved. The caster is not saved for either and the size is not saved for the shield. I know because all my shields are tiny on the client but react in a five block range, and neither recognize the caster. Example: saying Expelliarmus while holding a wand shoots the spell, but not only does it launch the target, it launches you, because the client does not know who cast it, and therefore - who not to hit. Shield Charm @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.size = nbt.getFloat("size"); setSize(size, size); NBTTagList list = (NBTTagList) nbt.getTag("casters"); List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox()); for (NBTBase n : list) { String uuid = n.toString(); for (Entity e : entities) { if (e.getPersistentID().toString() == uuid) caster.add(e); } } } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setFloat("size", size); NBTTagList list = new NBTTagList(); for (Entity e : caster) { list.appendTag(new NBTTagString(e.getPersistentID().toString())); } nbt.setTag("casters", list); return nbt; } And the Disarming spell extends EntityThrowale so it should save the thrower flag. In PreInit EntityRegistry.registerModEntity(new ResourceLocation(WizardryMod.MODID, "entitySpellShield"), EntityShieldCharm.class, "shieldSpell", 998, this, 100, 1, false); EntityRegistry.registerModEntity(new ResourceLocation(WizardryMod.MODID, "entityDisarmShield"), EntityDisarmSpell.class, "disarmSpell", 999, this, 100, 6, true);
  13. I was getting a devide by 0 exception before i realised trackingRange & the update stuff were the same thing. trackingRange is now 100 but I still need to know what is wrong with the render script - all it does is changes it from a white cube to air, but i see the bounding box. The reason I did not before is because the server tells the client about the entity via it's registration id.
  14. Hi, I'm working on a Wizardry mod (harry potter themed) and I am having a BIG issue with my shield charm. Currently it does not render at all. EntityShieldCharm public class EntityShieldCharm extends EntityThrowable { //public AxisAlignedBB box; public List<Entity> caster; public float size; public EntityShieldCharm(World arg0) { super(arg0); this.caster = new ArrayList(); this.motionX = 0; this.motionY = 0; this.motionZ = 0; } public EntityShieldCharm(World arg0, EntityLivingBase caster, float size) { super(arg0, caster); this.caster = new ArrayList(); this.caster.add(caster); //this.caster.addAll(world.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox())); this.setSize(size, size); this.size = size; //this.accelerationX = 0; //this.accelerationY = 0; //this.accelerationZ = 0; this.motionX = 0; this.motionY = 0; this.motionZ = 0; } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = (NBTTagList) nbt.getTag("casters"); List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox()); for (NBTBase n : list) { String uuid = n.toString(); for (Entity e : entities) { if (e.getPersistentID().toString() == uuid) caster.add(e); } } } public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); NBTTagList list = new NBTTagList(); for (Entity e : caster) { list.appendTag(new NBTTagString(e.getPersistentID().toString())); } nbt.setTag("casters", list); return nbt; } public boolean allow(Entity e) { return caster.contains(e);// || !isHeadingTowards(e); } @Override public void onUpdate() { List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox()); for (Entity e : entities) { if (allow(e)) continue; double mx = e.motionX, my = e.motionY, mz = e.motionZ; e.setPositionAndUpdate(e.lastTickPosX, e.lastTickPosY, e.lastTickPosZ); e.setVelocity(-mx, -my, -mz); e.velocityChanged = true; Class c = e.getClass(); try { Field xf = c.getField("accelerationX"); Field yf = c.getField("accelerationY"); Field zf = c.getField("accelerationZ"); try { double x = xf.getDouble(e), y = yf.getDouble(e), z = zf.getDouble(e); xf.setDouble(e, -x); yf.setDouble(e, -y); zf.setDouble(e, -z); } catch (IllegalArgumentException e1) { } catch (IllegalAccessException e1) { } } catch (NoSuchFieldException e1) { } catch (SecurityException e1) { e1.printStackTrace(); } } } public boolean attackEntityFrom(DamageSource c, float a) { return false; } public boolean isHeadingTowards(Entity e) { double x = e.posX, y = e.posY, z = e.posZ; double nx = e.posX - e.motionX, ny = e.posY - e.motionY, nz = e.posZ - e.motionZ; if (MathHelper.sqrt(x * x + y * y + z * z) < MathHelper.sqrt(nx * nx + ny * ny + nz * nz)) return true; return false; } public boolean canBeCollidedWith() { return false; } @Override protected void onImpact(RayTraceResult arg0) {} } WizardryMod @Mod(modid = WizardryMod.MODID, version = WizardryMod.VERSION, name = WizardryMod.NAME) public class WizardryMod { public static final String MODID = "giantwizardry", VERSION = "1.0.0-1.12.2", NAME = "Giant's Wizardry"; public static CustomCreativeTab tab = new CustomCreativeTab(MODID, WizardryItems.wand); public static WizardryMod instance = new WizardryMod(); @SidedProxy(clientSide="mods.giantnuker.wizardry.proxy.ClientProxy") public static IProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); WizardryItems.init(); PacketUpdateCapability.init(); CapabilityManager.INSTANCE.register(WizardryCapability.class, new WizardryCapability.Storage(), WizardryCapability.Implementation.class); MinecraftForge.EVENT_BUS.register(new WizardryHandler()); //EntityRegistry.registerModEntity(new ResourceLocation(WizardryMod.MODID, "entitySpellShield"), EntityShieldCharm.class, "shieldSpell", 999, this, 0, 0, false); } @EventHandler public static void init(FMLInitializationEvent event) { proxy.init(event); } } ClentProxy public class ClientProxy implements IProxy { @Override public void preInit(FMLPreInitializationEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityShieldCharm.class, new ShieldCharmRenderFactory()); } @Override public void init(FMLInitializationEvent event) { } @Override public void postInit(FMLPostInitializationEvent event) { } } ShieldCharmRenderFactory public class ShieldCharmRenderFactory implements IRenderFactory { @Override public Render createRenderFor(RenderManager arg0) { return new RenderShieldSpell(arg0); } } RenderShieldSpell public class RenderShieldSpell extends Render<EntityShieldCharm>{ public ModelRectCube model = new ModelRectCube(); public RenderShieldSpell(RenderManager rm) { super(rm); } @Override protected ResourceLocation getEntityTexture(EntityShieldCharm arg0) { return new ResourceLocation("textures/entity/creeper/creeper_armor.png"); } @Override public void doRender(EntityShieldCharm charmEnt, double x, double y, double z, float yaw, float partialTicks) { this.bindTexture(getEntityTexture(charmEnt)); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); model.render(charmEnt, 0, 0, 0, 0, 0, charmEnt.size); GlStateManager.popMatrix(); super.doRender(charmEnt, x, y, z, yaw, partialTicks); } } And ModelRectCube public class ModelRectCube extends ModelBase { public void render(Entity entity, float a0, float a1, float a2, float a3, float a4, float a5) { ModelRenderer cube = new ModelRenderer(this, 0, 0); cube.addBox(0, 0, 0, 16, 16, 16); cube.render(a5); } } Also, when I press F3 + B I do not see it's bounding box, but it is there sience it repels everything.
  15. So add an extra NBT tag to Botania's wand of the forest? Also, what should I do to message the other TE, when bound, the first TE is supposed to send a message to the second.
  16. More like this, the work fine when the player links them with both in render distance. One does not know It's linked to the other if one is not in render distance. Same thing goes for activating them. Teleportation works fine. The only problems are those mentioned above. And no to your Question, because if they are already connected, there should be no issue.
  17. That's not what I'm talking about, my problem is that the TileEntities will not link properly if they are not both loaded at the time. Also I am having problems because no connection can be started if it cannot reach the other TileEntity.
  18. setPositionAndUpdate But that's not it, I'm taking about linking portals in different chunks.
  19. Hi, I'm making a Botania addon, I've copied the code from the alfhaim portal renderer, but I really dislike the fact that behind the portal, no TESRs, water or particles render. Is there any way to get around this? Vazkii's render code: I have never really used the Tesselator, so any help would be appreciated.
  20. I want to send it when the state updates.
  21. Thanks, I thought I had to send a packet to every client player EDIT: Trying to update the TE, not the block.
  22. Hi, I'm still working on the portals for my botania addon, This time, the problem is that data is not syncing between the server and client. when I activate a portal - you can go through it, but none of the animations show up. here is my source code: What I think is happening is, mana is handled on the server(I think) so there will never be any on the client, right? Do I need to notify every client when a portal activates/deactivates? What do I have to do? If you can tell me Thanks!
×
×
  • Create New...

Important Information

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