Everything posted by Oscarita25
-
Level.. Systems are complicated
Okay.. before reading this i want you to know that i: - have not coded this Level System - have really almost 0 .. ideas how to use a Subscribe event.. (i should look this up.. in a second) - that i am a bit confused with the code myself.. >:I -- what is no good thing (got this from a friend i want to continue it but i have to understand it first) so here the classes i am using: Quirk class .. here is basicly the Level system public abstract class Quirk { protected String name; protected static int cooldown = 0; protected static int maxCooldown = 0; protected static int act = 0; protected static int maxAct = 0; protected static boolean activated = false; protected static boolean aviable = true; protected static double xp = 0; protected static double nextXp = 0; protected static double xpPerTick = 0; protected static int level = 0; protected static double levelFactor = 0; protected static double levelMinimum = 0; protected static LevelUp levelUp = null; public Quirk(String name) { this.name = name; ModQuirks.QUIRKS.add(this); } @SubscribeEvent public abstract void onPlayerUse(EntityPlayer player); public String getName() { return name; } public static int xpToLevel(double xp) { double i = levelMinimum; int lvl = 1; if(xp < i) return 1; while(i <= xp) { lvl++; i *= levelFactor; } if(xp < i) { if(lvl - 1 == 0) { return 1; } return lvl - 1; } return lvl; } public void setXp(double xp) { this.xp = xp; this.level = xpToLevel(xp); System.out.println("LEVEL: " + level); init(); if(xp == 0) { nextXp = levelMinimum; } else { nextXp = xp * levelFactor; } } protected static void init() { if(levelUp == null || level == 0) return; maxCooldown = (int) (maxCooldown * Math.pow(levelUp.getCooldownMultiplier(), level)); maxAct = (int) (maxAct * Math.pow(levelUp.getActivatedMultiplier(), level)); } public void setMaxCooldown(int _maxCooldown) { this.maxCooldown = _maxCooldown; } public void setMaxActivatedTime(int _maxAct) { this.maxAct = _maxAct; } public void setLevelUp(LevelUp _levelUp) { this.levelUp = _levelUp; } public void setLevelFactor(double _levelFactor) { this.levelFactor = _levelFactor; } public void setLevelMinimum(double _levelMinimum) { this.levelMinimum = _levelMinimum; } public void setXpPerTick(double _xpPerTick) { this.xpPerTick = _xpPerTick; } public static double getXp() { return xp; } public static void addXp(double add) { xp += add; } } and i am using the Level system like this: public class QuirkExplosive extends Quirk { private static EntityPlayer p; public QuirkExplosive() { super("explosive"); setMaxCooldown(100); setLevelMinimum(100); setLevelFactor(5); setMaxActivatedTime(1); setLevelUp(new LevelUp(0, 0.99)); setXpPerTick(1/20); } @Override public void onPlayerUse(EntityPlayer player) { p = player; if(aviable) { //this is my instance of the simpleNetworkWrapper.. BnHA.simpleNetworkWrapper.sendToServer(new MessageExplosion(level * 0.5F)); aviable = false; xp += level * 2.75; } } @SubscribeEvent public static void tick(ServerTickEvent event) { if(!aviable) { cooldown++; if(cooldown >= maxCooldown) { aviable = true; cooldown = 0; } } if(xp >= nextXp) { level++; nextXp = xp * levelFactor; if(p != null) { p.sendMessage(new TextComponentString(TextFormatting.AQUA + "Level Up")); p.sendMessage(new TextComponentString(TextFormatting.AQUA + "Your now level " + level)); } maxCooldown *= levelUp.getCooldownMultiplier(); } } } what this should do: - pressing [Key] calls onPlayerUse in the QuirkExplosive class (works) - will cast a explosion (works) - aviable is set to false (works) - and adds xp to the player (works) - the tick event is getting called because aviable is false and the cooldown is running trough (works) - the player should level up when the xp reaches nextXp (Xp req for nextLvl) .... (doesn't work) .. thats what at least think it does and i bet .. really that its just because i am using the Subscribe event wrong ... °—°...
-
Modders Needed! (Minecraft MMO project)
i am pretty interested in this .. and i wouldn't mind helping out :I i am not that advanced in modding but i can do stuff .. like textures (i am very good at textures) my discord is Oscar#0853
-
Explosion spawning based on the rotation?
seems like it was for both...
-
Explosion spawning based on the rotation?
i thought that was for smoke ?
-
Explosion spawning based on the rotation?
yup .. that was it .. now just out of curiousity ... is there a way to turn off explosion damage and just do damage to entities?
-
Explosion spawning based on the rotation?
@V0idWa1k3r ... well i have overtaken the mod i am working on but i knew such thing as a "common" proxy should not exist aka. that what i were doing is wrong.. but just ignored that because it worked fine for now (right now i just want something running good XD) i will fix that in a second .. i wasn't sure about that .. but this actually could it be XD.. i will now debug my code and write another reply .. if changing the power worked
-
Explosion spawning based on the rotation?
oh that was just me trying .. i should change that.. i think i am doing that ... and i don't run a git on it right now :I .. but i can give you some more code Here some more code: Message Handler: public class MyMessageHandler implements IMessageHandler<MessageExplosion, IMessage> { @Override public IMessage onMessage(MessageExplosion message, MessageContext ctx) { EntityPlayerMP serverPlayer = ctx.getServerHandler().player; float amount = message.power; serverPlayer.getServerWorld().addScheduledTask(() -> { serverPlayer.getServerWorld().createExplosion(serverPlayer, serverPlayer.lastTickPosX + serverPlayer.getLookVec().x , serverPlayer.lastTickPosY + 1, serverPlayer.lastTickPosZ + serverPlayer.getLookVec().z , (float) (amount), true); }); return null; } } Message: public class MessageExplosion implements IMessage { public MessageExplosion() {} public MessageExplosion(float power) { this.power = power; } float power; EntityPlayer player; @Override public void toBytes(ByteBuf buf) { buf.writeFloat(power); } @Override public void fromBytes(ByteBuf buf) { power = buf.readFloat(); } public float getamount() { return power; } } Here is what class i am using to spawn the explosion public class QuirkExplosive extends Quirk { private static EntityPlayer p; public QuirkExplosive() { super("explosive"); setMaxCooldown(2000); setLevelMinimum(100); setLevelFactor(5); setMaxActivatedTime(1); setLevelUp(new LevelUp(0, 0.99)); setXpPerTick(1/20); } @Override public void onPlayerUse(EntityPlayer player) { p = player; if(aviable) { BnHA.proxy.simpleNetworkWrapper.sendToServer(new MessageExplosion(level * 0.1F)); aviable = false; xp += level * 2.75; } } @SubscribeEvent public static void tick(ServerTickEvent event) { if(!aviable) { cooldown++; if(cooldown >= maxCooldown) { aviable = true; cooldown = 0; } } if(xp >= nextXp) { level++; nextXp = xp * levelFactor; if(p != null) { p.sendMessage(new TextComponentString(TextFormatting.AQUA + "Level Up")); p.sendMessage(new TextComponentString(TextFormatting.AQUA + "Your now level " + level)); } maxCooldown *= levelUp.getCooldownMultiplier(); } } } @V0idWa1k3r if the superclass is relevant i can send it too
-
Explosion spawning based on the rotation?
still not sure about that .. also my explosion still does no damage .... (it should do damage to the entities not the player)
-
[1.12.2] Render OBJ on item depending on NBT
never worked with custom item models but i found this in the Item class.. : @SideOnly(Side.CLIENT) public void setTileEntityItemStackRenderer(@Nullable net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer teisr) { this.teisr = teisr; } its client sided .. named renderer.. maybe you can change the model in there with a simple switch checking for the NBT? but i am not sure tho..
-
addChatMessage() upon joining a server
no problem you just have to check that the player is loaded somehow
-
addChatMessage() upon joining a server
? sorry cant help you :I but i would suggest to send a message for debugging in the console to see if the event is fired before the player loaded
-
addChatMessage() upon joining a server
no, just wondering.. because thats a version i never modded on :I so i may will post you a bit innacurrate code
-
addChatMessage() upon joining a server
also on what version are you modding that you get the player with "Minecraft.getMinecraft().thePlayer"
-
addChatMessage() upon joining a server
@TheDigitalDev should all people see this message in the chat or should it only be client displayed?
-
Explosion spawning based on the rotation?
i got the packets working.. now everything or the explosions is server sided what is great.. but the explosion does not do damage... serverPlayer.getServerWorld().createExplosion(serverPlayer, serverPlayer.lastTickPosX + serverPlayer.getLookVec().x , serverPlayer.lastTickPosY + 1, serverPlayer.lastTickPosZ + serverPlayer.getLookVec().z , (float) (amount), true); is this the right way to do it? (this is in my packet handler class... the packet will send the amount of power that is being used)
-
1.12.2 Model animation
i know this is a bit older now but i just wanted to say .. that i think that you can also use obj models because the ModelRender does support these .. (obj models can be less blocky aka. they can be even completly smooth spheres)
-
How do fix this rendering?
okay i just used a work around that is way easier child the parts to the biped model - what would be the player and then rendering then the super method (what would be Modelbiped) and just using LArm.isHidden = true; Body.isHidden = true; RLeg.isHidden = true; LLeg.isHidden = true; RArm.isHidden = true; Head.isHidden = true; to hide the models that are getting rendered 2 times
-
How do fix this rendering?
also now its rendering propertly but its not showing the animation
-
How do fix this rendering?
@Alexiy yes right now its only intentended for players
-
How do fix this rendering?
-just making a message so anybody may see this post and help me
-
Explosion spawning based on the rotation?
thanks .. funny enough i already have a packets .. but i forgot that i could use them to do that
-
Explosion spawning based on the rotation?
ahh nooo :I .. i think this would not be any releated to this anymore but i noticed i am spawning the explosion client side and not server side .. how would spawn it server sided?
-
Explosion spawning based on the rotation?
@V0idWa1k3r thanks that worked!
-
Explosion spawning based on the rotation?
thanks i will try that
-
Explosion spawning based on the rotation?
Well i try to spawn a explosion on the coardinates of the player.. that works pretty well with this: player.world.createExplosion(player, player.getPosition().getX(), player.getPosition().getY() + 1, player.getPosition().getZ(), (float) (level * 0.1), true); *i am spawning it with a keybind* but that wont change if the player rotates ... what i want it to do .. i want it to be always spawned at the right side of the player inside of his right hand ..
IPS spam blocked by CleanTalk.