Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

4sterism

Members
  • Posts

    31
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

4sterism's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thats bc the code is not robust. It doesnt work in all possible situations.
  2. Well, I would 1. hook into an event 2. check if entity/player is in the dimension 3. check equipment slots 4. if not wearing space suit, then damage player you can then make a custom dmg source as mentioned above.
  3. Its not relased anywhere, its just for a group of small friends. I have no interest in releasing it anywhere.
  4. By the way, where should I read up on how to improve this for future reference?
  5. I can maybe test my server by disabling monster spawns and see what happens.
  6. Ok. I will do that. On server, fighting mosnters can usually cause crashes. Testing on client doesnt cause crashes though, which is telling.
  7. I don't know whats causing the crashes exactly. And yh, I think I need to nerf slime dmg. We dont encounter lots of slimes. Regen happens every second. Ive never seen a problem with regen.
  8. Just walk around and fight monsters ig. It's spaghetti code.
  9. https://github.com/ndrwln/Mine-and-Slash-modified Its just open source code I modified so... I also think the baubles jar is a forked version someone changed so that it would send an event when equipment changed. So that my mod could catch it and recalculate the stats. Its in the lib folder. The original implementation of the mod would not recalc stats when a bauble equip was changed -_-. The crash doesnt occur when changing equipment, though. Sometimes we can go 40 minutes without a crash. Other times its constant crashing,
  10. Thank you for taking your time. Ok, I will try to upload a repository. RecalculateStats is called int he same class and another class. That has a method called recalculateStats, that checks if the unit is null or if there is a need to recalc the stats. That method is called in a number of places.
  11. I dont understand what Im being asked, and googling just describes errors.
  12. I didn't write this code, but I'm willing to learn how to fix and clean it up. As for where the code is registered. MinecraftForge.EVENT_BUS.register(new PlayerUnitPackage()); MinecraftForge.EVENT_BUS.register(new EntityUnitPackage()); MinecraftForge.EVENT_BUS.register(new DamageNumberPackage()); MinecraftForge.EVENT_BUS.register(new ParticlePackage()); MinecraftForge.EVENT_BUS.register(new WorldPackage()); MinecraftForge.EVENT_BUS.register(new PacketAnimation()); Network.registerMessage(PlayerUnitPackage.Handler.class, PlayerUnitPackage.class, 0, Side.CLIENT); Network.registerMessage(EntityUnitPackage.Handler.class, EntityUnitPackage.class, 1, Side.CLIENT); Network.registerMessage(DamageNumberPackage.Handler.class, DamageNumberPackage.class, 2, Side.CLIENT); Network.registerMessage(ParticlePackage.Handler.class, ParticlePackage.class, 3, Side.CLIENT); Network.registerMessage(WorldPackage.Handler.class, WorldPackage.class, 4, Side.CLIENT); Network.registerMessage(MessagePackage.Handler.class, MessagePackage.class, 5, Side.CLIENT); @Mod.EventBusSubscriber public class OnTrackEntity { @SubscribeEvent public static void onEntityTrack(PlayerEvent.StartTracking event) { Entity entity = event.getTarget(); if (entity instanceof EntityLivingBase) { if (entity.isEntityEqual(event.getEntityPlayer()) == false) { if (entity.hasCapability(EntityData.Data, null)) { Main.Network.sendTo(new EntityUnitPackage((EntityLivingBase) entity), (EntityPlayerMP) event.getEntityPlayer()); } } } } } /** * @return checks if it should be synced to clients. Clients currently only see health and status * effects */ private DirtyCheck getDirtyCheck() { DirtyCheck check = new DirtyCheck(); check.hp = (int) MyStats.get(Health.GUID).Value; return check; } public void RecalculateStats(EntityLivingBase entity, UnitData data, int level, IWorldData world) { data.setEquipsChanged(false); if (data.getUnit() == null) { data.setUnit(this, entity); } DirtyCheck old = getDirtyCheck(); Unit copy = this.Clone(); int tier = 0; if (world != null) { tier = world.getTier(); } ClearStats(); MobRarity rar = Rarities.Mobs.get(data.getRarity()); float hpadded = this.getHpAdded(entity, rar, data); MyStats.get(Health.GUID).Flat += hpadded; if (entity instanceof EntityPlayer) { List<GearItemData> gears = PlayerStatUtils.getEquipsExcludingWeapon(entity); // slow boolean gearIsValid = this.isGearCombinationValid(gears, entity); ItemStack weapon = entity.getHeldItemMainhand(); if (weapon != null) { GearItemData wep = Gear.Load(weapon); if (wep != null && wep.GetBaseGearType().slotType().equals(GearSlotType.Weapon)) gears.add(wep); } ItemStack offhand = entity.getHeldItemOffhand(); if (offhand != null) { GearItemData off = Gear.Load(offhand); if (off != null && off.GetBaseGearType().slotType().equals(GearSlotType.OffHand)) gears.add(off); } PlayerStatUtils.AddPlayerBaseStats(data, this); if (gearIsValid) { PlayerStatUtils.CountWornSets(entity, gears, this); PlayerStatUtils.AddAllGearStats(entity, gears, this, level); // slow, but required PlayerStatUtils.AddAllSetStats(entity, this, level); } } else { MobStatUtils.AddMobcStats(data, data.getLevel(), entity); MobStatUtils.AddMobTierStats(this, tier); } CommonStatUtils.AddStatusEffectStats(this, level); CommonStatUtils.AddMapAffixStats(this, level); PlayerStatUtils.CalcStatConversionsAndTransfers(copy, this); PlayerStatUtils.CalcTraits(data); CalcStats(data); DirtyCheck newcheck = getDirtyCheck(); if (old.isDirty(newcheck)) { Main.Network.sendToAllTracking(new EntityUnitPackage(entity, data), entity); } }
  13. its the nbt data associated with this packet. I deleted one entry and when it errored again, this time with was 31 instead of 32, so they're related. What I dont get is why readerIndex(31) + length(1) exceeds writerIndex(31). Where did that length 1 come from?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.