Jump to content

[NoOneButNo]

Members
  • Posts

    89
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by [NoOneButNo]

  1. Huh does that even need to be elaborated? I just said that he can copy the method and paste it in whatever utility class (or what class he wants) as a static method then modify it a bit. I am not going to teach basic java here but for the sake of explanation, enchantments level is read as an integer idk why the addEnchantment method converts it into a byte and you can just modify it a bit so that it will no longer be casted into byte and short...
  2. Well, I already know that. Manipulating the unbreaking enchantment gives many more opportunities that even other mods can be affected. Thanks for answering and have a good day.
  3. Not if you copy and paste and modify ItemStack#addEnchantment method to a new utility class or whatever.
  4. I wanted to modify the UnbreakingEnchantment#negateDamage method. If possible, no ASM. Can someone help me regarding this.
  5. Take a look at the shulker box code. I believe it might help you.
  6. Well, maybe for future reasons, such as "oh hey lets spam logs because its dev mod, and no, don't spam logs because this is not dev environment".
  7. ok, thanks.
  8. Is it possible to create a custom colored textformatting outside of the default one? like brown, indigo, etc.
  9. launch.blackboard.get("fml.deobfuscatedenvironment") is missing in 1.14.4 forge. Now how to check if the mod runs in dev mode in 1.14.4
  10. Well, sorry for being stupid.
  11. Ohhh learned something new today.
  12. Try allocating more RAM to minecraft.
  13. Wait, by sending packets to server while already on the server, did you mean by: if(!world.isRemote) PacketHandler.INSTANCE.sendToServer(new MsgResetSwordSign());
  14. Apparently, this crash only occurs if I call ItemSword#hitEntity. Is this an example of invalid thread?
  15. If you were to give an example of that, what would it be? Never encountered that type of problem before.
  16. Interesting, apparently commenting the decoration packets and the crash won't happen. I'll investigate more of this.
  17. Ok I'll run a dry test while disabling those "decoration packets"
  18. The Entity Slash is the only one who sends the packets
  19. Whoops I forgot to add some more code: package com.Test.Nothing.ModSlicer.slashFX; import com.Test.Nothing.ModSlicer.reference.Log; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class MysticRegistry { public static int FX_BEAM, FX_SLASH, FX_CUT; public static void init() { FX_BEAM = EffectsRegistry.registerEffect(nbt -> { EffectBeam beam = new EffectBeam(); beam.read(nbt); EffectManager.addEffect(beam); return null; }); FX_SLASH = EffectsRegistry.registerEffect(nbt -> { EffectSlash slash = new EffectSlash(); slash.read(nbt); EffectManager.addEffect(slash); return null; }); FX_CUT = EffectsRegistry.registerEffect(nbt -> { EffectCut slash = new EffectCut(); slash.read(nbt); EffectManager.addEffect(slash); return null; }); } } The code above is for the Mystic Registry, the init() method is called in the FMLPreInitializationEvent. package com.Test.Nothing.ModSlicer.slashFX; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EffectSlash extends Effect { public float yaw = 0, pitch = 0, slashAngle = 0, slashWidth = 0, slashRange = 0, slashRadius = 0; public EffectSlash() { } public EffectSlash(int id) { super(id); } public EffectSlash setSlashProperties(float yaw, float pitch, float angle, float radius, float thickness, float arc) { this.yaw = yaw; this.pitch = pitch; this.slashAngle = angle; this.slashRadius = radius; this.slashWidth = thickness; this.slashRange = arc; return this; } @Override public void read(NBTTagCompound tag) { super.read(tag); yaw = tag.getFloat("yaw"); pitch = tag.getFloat("pitch"); slashAngle = tag.getFloat("slashAngle"); slashRadius = tag.getFloat("slashRadius"); slashWidth = tag.getFloat("slashWidth"); slashRange = tag.getFloat("slashRange"); } @Override public NBTTagCompound write() { NBTTagCompound tag = super.write(); tag.setFloat("yaw", yaw); tag.setFloat("pitch", pitch); tag.setFloat("slashAngle", slashAngle); tag.setFloat("slashRadius", slashRadius); tag.setFloat("slashWidth", slashWidth); tag.setFloat("slashRange", slashRange); return tag; } @SideOnly(Side.CLIENT) @Override public void render(float pticks) { Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtility.glow_texture); Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); GlStateManager.translate(getInterpX(pticks), getInterpY(pticks), getInterpZ(pticks)); GlStateManager.rotate(-yaw, 0, 1, 0); GlStateManager.rotate(pitch, 1, 0, 0); GlStateManager.rotate(-slashAngle, 0, 0, 1); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); RenderUtility.renderSlash(buffer, 0, 0, 0, r, g, b, a * getLifeCoeff(pticks), slashRadius, slashWidth, slashRange); tess.draw(); } } The effect slash code. No need to post the code of Effect because its just duplicate-like (Really trust me). If you really wanted it, then look below: package com.Test.Nothing.ModSlicer.slashFX; import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager.DestFactor; import net.minecraft.client.renderer.GlStateManager.SourceFactor; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class Effect { public int lifetime = 0; public int maxLife = 0; public float r = 0; public float g = 0; public float b = 0; public float a = 0; public boolean inited = false; public double x = 0; public double y = 0; public double z = 0; public double px = 0; public double py = 0; public double pz = 0; public double vx = 0; public double vy = 0; public double vz = 0; public boolean additive = false; public boolean dead = false; public int dimId = 0; public Effect() { // } public Effect(int id) { this.dimId = id; } public Effect setLife(int l) { this.maxLife = l; this.lifetime = l; return this; } public Effect setColor(float r, float g, float b, float a) { this.r = r; this.g = g; this.b = b; this.a = a; return this; } public Effect setPosition(double x, double y, double z) { this.px = x; this.py = y; this.pz = z; this.x = x; this.y = y; this.z = z; return this; } public Effect setMotion(double vx, double vy, double vz) { this.vx = vx; this.vy = vy; this.vz = vz; return this; } public Effect setAdditive(boolean additive) { this.additive = additive; return this; } public void update() { if (!inited) { inited = true; } px = x; py = y; pz = z; x += vx; y += vy; z += vz; lifetime--; if (lifetime < 0) { kill(); } } public void kill() { dead = true; } public float getLifeCoeff(float pTicks) { return Math.max(0, ((float) lifetime - pTicks) / (float) maxLife); } public float getInterpX(float pticks) { return (float) x * (pticks) + (float) px * (1f - pticks); } public float getInterpY(float pticks) { return (float) y * (pticks) + (float) py * (1f - pticks); } public float getInterpZ(float pticks) { return (float) z * (pticks) + (float) pz * (1f - pticks); } @SideOnly(Side.CLIENT) public void renderTotal(float pticks) { if (inited) { GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, additive ? DestFactor.ONE : DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.depthMask(false); int dfunc = GL11.glGetInteger(GL11.GL_DEPTH_FUNC); GlStateManager.depthFunc(GL11.GL_LEQUAL); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager.disableCull(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.pushMatrix(); GlStateManager .translate(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); render(pticks); GlStateManager.popMatrix(); GlStateManager.alphaFunc(func, ref); GlStateManager.depthFunc(dfunc); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.depthMask(true); GlStateManager.disableBlend(); } } public void read(NBTTagCompound tag) { px = x; x = tag.getDouble("x"); py = y; y = tag.getDouble("y"); pz = z; z = tag.getDouble("z"); vx = tag.getDouble("vx"); vy = tag.getDouble("vy"); vz = tag.getDouble("vz"); r = tag.getFloat("r"); g = tag.getFloat("g"); b = tag.getFloat("b"); a = tag.getFloat("a"); maxLife = tag.getInteger("maxlife"); lifetime = tag.getInteger("life"); dimId = tag.getInteger("dim"); additive = tag.getBoolean("additive"); } public NBTTagCompound write() { NBTTagCompound tag = new NBTTagCompound(); tag.setDouble("x", x); tag.setDouble("y", y); tag.setDouble("z", z); tag.setDouble("vx", vx); tag.setDouble("vy", vy); tag.setDouble("vz", vz); tag.setFloat("r", r); tag.setFloat("g", g); tag.setFloat("b", b); tag.setFloat("a", a); tag.setInteger("maxlife", maxLife); tag.setInteger("life", lifetime); tag.setInteger("dim", dimId); tag.setBoolean("additive", additive); return tag; } @SideOnly(Side.CLIENT) public void render(float pticks) { } }
  20. package com.Test.Nothing.ModSlicer.slashFX; import java.util.List; import java.util.Random; import com.Test.Nothing.ModSlicer.interfaces.IFabledBlades; import com.Test.Nothing.ModSlicer.network.PacketHandler; import com.Test.Nothing.ModSlicer.network.message.MsgSlashFX; import com.Test.Nothing.ModSlicer.util.Utilities; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; 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.DamageSource; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public class EntitySlice extends Entity { public static final DataParameter<Integer> lifetime = EntityDataManager.createKey(EntitySlice.class, DataSerializers.VARINT); public static final DataParameter<Float> RED = EntityDataManager.createKey(EntitySlice.class, DataSerializers.FLOAT); public static final DataParameter<Float> GREEN = EntityDataManager.createKey(EntitySlice.class, DataSerializers.FLOAT); public static final DataParameter<Float> BLUE = EntityDataManager.createKey(EntitySlice.class, DataSerializers.FLOAT); public static final DataParameter<ItemStack> SWORD = EntityDataManager.createKey(EntitySlice.class, DataSerializers.ITEM_STACK); public static final DataParameter<Integer> LIFE_EFFECT = EntityDataManager.createKey(EntitySlice.class, DataSerializers.VARINT); public static final DataParameter<Float> ALPHA = EntityDataManager.createKey(EntitySlice.class, DataSerializers.FLOAT); public static final DataParameter<Boolean> SLASH_IMMEDIATELY = EntityDataManager.createKey(EntitySlice.class, DataSerializers.BOOLEAN); public EntityPlayer player = null; public EntitySlice(EntityPlayer player, World worldIn, float red, float green, float blue, ItemStack stack, int lifeeffect, float alpha) { super(worldIn); this.setSize(0, 0); this.setInvisible(true); this.getDataManager().set(RED, red); this.getDataManager().set(GREEN, green); this.getDataManager().set(BLUE, blue); this.getDataManager().set(ALPHA, alpha); if(stack != null) this.getDataManager().set(SWORD, stack); this.getDataManager().set(LIFE_EFFECT, lifeeffect); this.getDataManager().set(SLASH_IMMEDIATELY, true); this.player = player; } public EntitySlice(World worldIn) { super(worldIn); } public void setPlayer(EntityPlayer player) { this.player = player; } @Override public void onUpdate() { float red = this.getDataManager().get(RED).floatValue(); float green = this.getDataManager().get(GREEN).floatValue(); float blue = this.getDataManager().get(BLUE).floatValue(); boolean slashImmediately = this.getDataManager().get(SLASH_IMMEDIATELY).booleanValue(); ItemStack stack = this.getDataManager().get(SWORD); if(player == null) { this.setDead(); return; } if (slashImmediately && !this.world.isRemote || ((((Integer)getDataManager().get(lifetime)).intValue() % 3 == 0) && (!this.world.isRemote))) { this.getDataManager().set(SLASH_IMMEDIATELY, false); float offX = 0.5F * (float)Math.sin(Math.toRadians(-90.0F - this.player.rotationYaw)); float offZ = 0.5F * (float)Math.cos(Math.toRadians(-90.0F - this.player.rotationYaw)); double x1 = this.player.posX + this.player.getLookVec().x * 0.5D + offX; double y1 = this.player.posY + this.player.getLookVec().y * 0.5D + this.player.getEyeHeight(); double z1 = this.player.posZ + this.player.getLookVec().z * 0.5D + offZ; double x2 = this.player.posX + this.player.getLookVec().x * 4.0D; double y2 = this.player.posY + this.player.getEyeHeight() + this.player.getLookVec().y * 4.0D; double z2 = this.player.posZ + this.player.getLookVec().z * 4.0D; this.posX = this.player.posX; this.posY = this.player.posY; this.posZ = this.player.posZ; float slashYaw = this.player.rotationYaw; float slashPitch = this.player.rotationPitch; float angle = 30.0F + new Random().nextFloat() * 120.0F; float radius = 2; float thickness = 1.5f; float arc = 150; Effect slash = new EffectSlash(this.player.world.provider.getDimension()).setSlashProperties(slashYaw, slashPitch, angle, radius, thickness, arc).setPosition(x1, y1, z1).setMotion((x2 - x1) / 5.0D, (y2 - y1) / 5.0D, (z2 - z1) / 5.0D).setLife(this.getDataManager().get(LIFE_EFFECT).intValue()).setAdditive(true).setColor(red, green, blue, 1.0F); IMessage mess = new MsgSlashFX(MysticRegistry.FX_SLASH, slash.write()); PacketHandler.sendToAll(new MsgSlashFX(MysticRegistry.FX_SLASH, slash.write())); //Log.logger.info(mess + " idiot null"); //PacketHandler.sendToAll(); double lx = this.player.posX + this.player.getLookVec().x * 2.0D; double ly = this.player.posY + this.player.getEyeHeight() + this.player.getLookVec().y * 2.0D; double lz = this.player.posZ + this.player.getLookVec().z * 2.0D; float dist = 4f; float dist2 = 4f; List<EntityLivingBase> entities = this.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(lx - dist, ly - dist / 3, lz - dist, lx + dist2, ly + dist2 / 3, lz + dist2)); for (EntityLivingBase e : entities) { if (e.getUniqueID().compareTo(this.player.getUniqueID()) != 0) { e.hurtResistantTime = 0; if (e.getHealth() > 0.0F) { Effect cut = new EffectCut(this.world.provider.getDimension()).setSlashProperties(this.player.rotationYaw, this.player.rotationPitch, new Random().nextFloat() * 360.0F).setColor(red, green, blue, 1.0F).setPosition(e.posX, e.posY + e.height / 2.0F, e.posZ).setAdditive(true).setLife(12); PacketHandler.sendToAll(new MsgSlashFX(MysticRegistry.FX_CUT, cut.write())); // Log.logger.info(cut + " idiot null"); } if(stack.getItem() instanceof IFabledBlades && stack.getItem() instanceof ItemSword) { Utilities.spawnAppropriateSwordColor(stack, world, e, player); ItemSword sword = (ItemSword) stack.getItem(); //Separate chance for different swords if(player.getRNG().nextInt(4) <= 0) sword.hitEntity(stack, e, player); float attackDamageSlash = (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue(); e.attackEntityFrom(DamageSource.causePlayerDamage(this.player).setDamageBypassesArmor(), e.getMaxHealth() * 0.025f + (attackDamageSlash / 5)); } } } } getDataManager().set(lifetime, Integer.valueOf(((Integer)getDataManager().get(lifetime)).intValue() - 1)); if (((Integer)getDataManager().get(lifetime)).intValue() <= 0) { setDead(); } } protected void entityInit() { getDataManager().register(lifetime, Integer.valueOf(18)); getDataManager().register(RED, Float.valueOf(1)); getDataManager().register(GREEN, Float.valueOf(1)); getDataManager().register(BLUE, Float.valueOf(1)); getDataManager().register(SWORD, ItemStack.EMPTY); getDataManager().register(LIFE_EFFECT, Integer.valueOf(0)); getDataManager().register(ALPHA, Float.valueOf(0)); getDataManager().register(SLASH_IMMEDIATELY, Boolean.valueOf(true)); getDataManager().setDirty(lifetime); } protected void readEntityFromNBT(NBTTagCompound compound) { //setDead(); } protected void writeEntityToNBT(NBTTagCompound compound) {} } The code above is the code for the EntitySlice. package com.Test.Nothing.ModSlicer.network; import com.Test.Nothing.ModSlicer.network.message.MsgAlterHealthPercentage; import com.Test.Nothing.ModSlicer.network.message.MsgAlterHealthPercentageClient; import com.Test.Nothing.ModSlicer.network.message.MsgDecreaseDamage; import com.Test.Nothing.ModSlicer.network.message.MsgDecreaseDamageClient; import com.Test.Nothing.ModSlicer.network.message.MsgIncreaseDamage; import com.Test.Nothing.ModSlicer.network.message.MsgIncreaseDamageClient; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementConsecutiveStrikes; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementConsecutiveStrikesClient; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementHitCount; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementHitCountClient; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementSwordModeClient; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementSwordSign; import com.Test.Nothing.ModSlicer.network.message.MsgIncrementSwordSignClient; import com.Test.Nothing.ModSlicer.network.message.MsgNewIncrementSwordMode; import com.Test.Nothing.ModSlicer.network.message.MsgRemoveAwakened; import com.Test.Nothing.ModSlicer.network.message.MsgRemoveAwakenedClient; import com.Test.Nothing.ModSlicer.network.message.MsgResetConsecutiveStrikes; import com.Test.Nothing.ModSlicer.network.message.MsgResetConsecutiveStrikesClient; import com.Test.Nothing.ModSlicer.network.message.MsgResetHitCount; import com.Test.Nothing.ModSlicer.network.message.MsgResetHitCountClient; import com.Test.Nothing.ModSlicer.network.message.MsgResetSwordMode; import com.Test.Nothing.ModSlicer.network.message.MsgResetSwordModeClient; import com.Test.Nothing.ModSlicer.network.message.MsgResetSwordSign; import com.Test.Nothing.ModSlicer.network.message.MsgResetSwordSignClient; import com.Test.Nothing.ModSlicer.network.message.MsgSetAwakenEnergy; import com.Test.Nothing.ModSlicer.network.message.MsgSetAwakenEnergyClient; import com.Test.Nothing.ModSlicer.network.message.MsgSetAwakened; import com.Test.Nothing.ModSlicer.network.message.MsgSetAwakenedClient; import com.Test.Nothing.ModSlicer.network.message.MsgSetModeSelection; import com.Test.Nothing.ModSlicer.network.message.MsgSetModeSelectionClient; import com.Test.Nothing.ModSlicer.network.message.MsgSetReadyAwaken; import com.Test.Nothing.ModSlicer.network.message.MsgSetSkillDuration; import com.Test.Nothing.ModSlicer.network.message.MsgSetSkillDurationClient; import com.Test.Nothing.ModSlicer.network.message.MsgSetUsingSkillOrSign; import com.Test.Nothing.ModSlicer.network.message.MsgSetUsingSkillOrSignClient; import com.Test.Nothing.ModSlicer.network.message.MsgSlashFX; import com.Test.Nothing.ModSlicer.network.message.MsgSpecificAlterSwordMode; import com.Test.Nothing.ModSlicer.network.message.MsgSpecificAlterSwordModeClient; import com.Test.Nothing.ModSlicer.network.message.MsgSpecificAlterSwordSign; import com.Test.Nothing.ModSlicer.network.message.MsgSpecificAlterSwordSignClient; import com.Test.Nothing.ModSlicer.network.message.MsgSuspend; import com.Test.Nothing.ModSlicer.network.message.MsgUseLunarEnergyClient; import com.Test.Nothing.ModSlicer.reference.RefStrings; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; public class PacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(RefStrings.MODID); public static int id; public static void init() { INSTANCE.registerMessage(MsgIncreaseDamage.class, MsgIncreaseDamage.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgIncreaseDamageClient.class, MsgIncreaseDamageClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetAwakened.class, MsgSetAwakened.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSetAwakenedClient.class, MsgSetAwakenedClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetUsingSkillOrSign.class, MsgSetUsingSkillOrSign.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgDecreaseDamage.class, MsgDecreaseDamage.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgDecreaseDamageClient.class, MsgDecreaseDamageClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgNewIncrementSwordMode.class, MsgNewIncrementSwordMode.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgIncrementSwordModeClient.class, MsgIncrementSwordModeClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgUseLunarEnergyClient.class, MsgUseLunarEnergyClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgRemoveAwakened.class, MsgRemoveAwakened.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgRemoveAwakenedClient.class, MsgRemoveAwakenedClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgIncrementSwordSign.class, MsgIncrementSwordSign.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgIncrementSwordSignClient.class, MsgIncrementSwordSignClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgResetSwordMode.class, MsgResetSwordMode.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgResetSwordModeClient.class, MsgResetSwordModeClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgResetConsecutiveStrikes.class, MsgResetConsecutiveStrikes.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgResetConsecutiveStrikesClient.class, MsgResetConsecutiveStrikesClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgIncrementConsecutiveStrikes.class, MsgIncrementConsecutiveStrikes.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgIncrementConsecutiveStrikesClient.class, MsgIncrementConsecutiveStrikesClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgResetSwordSign.class, MsgResetSwordSign.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgResetSwordSignClient.class, MsgResetSwordSignClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetReadyAwaken.class, MsgSetReadyAwaken.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgIncrementHitCount.class, MsgIncrementHitCount.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgIncrementHitCountClient.class, MsgIncrementHitCountClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgResetHitCount.class, MsgResetHitCount.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgResetHitCountClient.class, MsgResetHitCountClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSuspend.class, MsgSuspend.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgAlterHealthPercentage.class, MsgAlterHealthPercentage.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgAlterHealthPercentageClient.class, MsgAlterHealthPercentageClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetSkillDuration.class, MsgSetSkillDuration.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSetSkillDurationClient.class, MsgSetSkillDurationClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSpecificAlterSwordMode.class, MsgSpecificAlterSwordMode.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSpecificAlterSwordModeClient.class, MsgSpecificAlterSwordModeClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSpecificAlterSwordSign.class, MsgSpecificAlterSwordSign.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSpecificAlterSwordSignClient.class, MsgSpecificAlterSwordSignClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetUsingSkillOrSignClient.class, MsgSetUsingSkillOrSignClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetAwakenEnergy.class, MsgSetAwakenEnergy.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSetAwakenEnergyClient.class, MsgSetAwakenEnergyClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSetModeSelection.class, MsgSetModeSelection.class, id++, Side.SERVER); INSTANCE.registerMessage(MsgSetModeSelectionClient.class, MsgSetModeSelectionClient.class, id++, Side.CLIENT); INSTANCE.registerMessage(MsgSlashFX.MessageHolder.class, MsgSlashFX.class, id++, Side.CLIENT); } public static void sendToAll(IMessage message) { if(message != null) INSTANCE.sendToAll(message); } public static void sendTo(IMessage message, EntityPlayerMP player) { INSTANCE.sendTo(message, player); } public static void sendToDimension(IMessage message, int dimensionId) { INSTANCE.sendToDimension(message, dimensionId); } public static void sendToServer(IMessage message) { INSTANCE.sendToServer(message); } } The code above is for the PacketHandler (U idiot I wish u cAN DIE). package com.Test.Nothing.ModSlicer.network.message; import com.Test.Nothing.ModSlicer.slashFX.EffectsRegistry; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; //Server Packet public class MsgSlashFX implements IMessage { public int id = 0; public NBTTagCompound tag = new NBTTagCompound(); public MsgSlashFX() { } public MsgSlashFX(int id, NBTTagCompound tag) { this.tag = tag; this.id = id; } @Override public void fromBytes(ByteBuf buf) { id = buf.readInt(); tag = ByteBufUtils.readTag(buf); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(id); ByteBufUtils.writeTag(buf, tag); } public static class MessageHolder implements IMessageHandler<MsgSlashFX, IMessage> { @SideOnly(Side.CLIENT) @Override public IMessage onMessage(final MsgSlashFX message, final MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(() -> { EffectsRegistry.effects.get(message.id).apply(message.tag); }); return null; } } } The code for the specific message. No need to tackle about EffectsRegistry. Its not the cause of the prob... [20:12:04] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770) ~[guava-21.0.jar:?] at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:38) ~[guava-21.0.jar:?] at com.google.common.collect.ImmutableList.of(ImmutableList.java:93) ~[guava-21.0.jar:?] at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$3.selectNetworks(FMLOutboundHandler.java:120) ~[FMLOutboundHandler$OutboundTarget$3.class:?] at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:378) ~[FMLOutboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:816) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:723) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:111) ~[MessageToMessageEncoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:801) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1032) ~[DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:296) ~[AbstractChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToAll(SimpleNetworkWrapper.java:236) [SimpleNetworkWrapper.class:?] at com.Test.Nothing.ModSlicer.network.PacketHandler.sendToAll(PacketHandler.java:110) [PacketHandler.class:?] at com.Test.Nothing.ModSlicer.slashFX.EntitySlice.onUpdate(EntitySlice.java:107) [EntitySlice.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171) [World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) [WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2130) [World.class:?] at net.minecraft.world.World.updateEntities(World.java:1931) [World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] [20:12:04] [Netty Server IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel theeightfabledblades java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770) ~[guava-21.0.jar:?] at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:38) ~[guava-21.0.jar:?] at com.google.common.collect.ImmutableList.of(ImmutableList.java:93) ~[guava-21.0.jar:?] at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$3.selectNetworks(FMLOutboundHandler.java:120) ~[FMLOutboundHandler$OutboundTarget$3.class:?] at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:378) ~[FMLOutboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:816) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:723) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:111) ~[MessageToMessageEncoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:801) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1032) ~[DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:296) ~[AbstractChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToAll(SimpleNetworkWrapper.java:236) ~[SimpleNetworkWrapper.class:?] at com.Test.Nothing.ModSlicer.network.PacketHandler.sendToAll(PacketHandler.java:110) ~[PacketHandler.class:?] at com.Test.Nothing.ModSlicer.slashFX.EntitySlice.onUpdate(EntitySlice.java:107) ~[EntitySlice.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2130) ~[World.class:?] at net.minecraft.world.World.updateEntities(World.java:1931) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) ~[MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] And the null pointer crash. Okay, now that the supplied codes are provided, I will describe how it'll occur. The crash will be thrown if I attempt to lets say summon the EntitySlice 6x in a quick session (like for 3 seconds). If not spammed/quickly summoned, the probability of the crash reduces into infinitesimal(?). What is wrong with the code?
  21. Report this to the author of thaumic additions.
  22. Well, got used to boolean check hehe.
  23. This is an example of an enchantment class I have: public class EnchantmentPenetratingEdge extends Enchantment { public EnchantmentPenetratingEdge() { super(Rarity.RARE, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND}); this.setName("PenetratingEdge"); this.setRegistryName("PenetratingEdge"); } @Override public int getMaxLevel() { return 6; } @Override public int getMinEnchantability(int par1) { return 16 + 12 * (par1 - 1); } @Override public int getMaxEnchantability(int par1) { return super.getMinEnchantability(par1) + 40; } @Override public boolean canApply(ItemStack fTest) { //Used this to find out if it yields true or false; turns out its useless //System.out.println(fTest.getItem() instanceof ItemAxe); return fTest.getItem() instanceof ItemAxe ? true : false; } }
  24. I know that canApply method exists for Enchantment class, but the way it works isn't applicable for locking down to a specific Item. For example, I want an enchantment that can only be applicable to axes and not pickaxes but overriding this method does not work. A code wise example: @Override public boolean canApply(ItemStack stack) { return stack.getItem() instanceof ItemAxe ? true : false; } This works if the item enchanted in question is a sword for example however does not work if EnumEnchantmentType is DIGGER (Checking for a pickaxe against axe returns false but the enchantment table still allows player to enchant it as if its true).
×
×
  • Create New...

Important Information

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