Closed kerplamp closed 3 years ago
I may have sorted out most of the oddities with the shield. The thing to consider is that the amount of energy it consumes is dependent upon the number of entities it's defending against. When it's unchallenged it really shouldn't be depleting your mana reserves.
After a lot more testing with the shield I found a few more things.
XP orbs and arrows that have been stuck in the ground are still detected by shield and drain stamina. ( I tried to fix arrow thing but my knowledge of minecraft modding begins at when I made my first post on this github, sorry.)
The shield is off center. Entities coming from the south-east are able to get further into the shield. South east is the direction where coordinates decrease.
Also I'm attaching a video of what I was talking about originally with the whole-
if (source.getMaster().age > 20 ) { double cost = 1 + (source.getLevel().get() * 2);
-thing.
The first clip is testing the above settings. The second clip is using what it currently is set at. https://www.youtube.com/watch?v=yDxAxoz0l84
Setting the "1" to a lower number should decrease drain rate.
These three most recent commits should help with your issues. https://github.com/Sollace/Unicopia/commit/f8851980852c5676971cef08dc8cca1351b752b9 , https://github.com/Sollace/Unicopia/commit/8f654177ec0a72b563b66b611140018f8897bd5f and https://github.com/Sollace/Unicopia/commit/b43ed1975b20de87bb1645941f242eeb652e0a07
The shield still seems to have inconsistency but I think I've figured out why.
@Override
public boolean updateOnPerson(Caster<?> source) {
int costMultiplier = applyEntities(source);
if (costMultiplier > 0) {
if (source.getMaster().age % 20 == 0) {
double cost = 2 + source.getLevel().get();
cost *= Math.max(1, costMultiplier / 12F);
if (!source.subtractEnergyCost(cost)) {
onDestroyed(source);
}
}
}
every tick (atleast I think it's every tick) it sets the costMultiplier to whatever is touching the shield and every 20 ticks(?) it uses costMultiplier in its equation. This means that a mob has to be in contact with the shield the exact moment the age is divisible by 20.
The problem is that the shield bounces enemies back. Enemies bump into the shield every now and then and aren't in constant contact with the shield. That means the bumps into the shield have to sync up with the 20 tick(?) check. And what all that means is that the shield depletion is almost luck based.
I've messed with the code and came up with this:
@Override
public boolean updateOnPerson(Caster<?> source) {
costMultiplier += applyEntities(source);
if (costMultiplier > 0) {
if (source.getMaster().age % 20 == 0) {
double cost = 2 + source.getLevel().get();
cost *= (costMultiplier / 5F);
costMultiplier = 0;
if (!source.subtractEnergyCost(cost)) {
onDestroyed(source);
}
}
}
This should store the mobs that bump into the shield until the next time it checks to deplete the shield. But there is the problem that the same entity could bump into the shield over and over and increase the count but you could just change how much costMultiplier is divided by when cost is set, that's what I did atleast.
*costMultiplier is declared outside the public boolean up where I saw other variable type stuff being declared
double costMultiplier = 0;
@Override
public String getName() {
return "shield";
}
@Override
public Affinity getAffinity() {
return Affinity.NEUTRAL;
}
Also uhh, I haven't mentioned it because I think you already know but I just want to make sure. Everytime I start my minecraft with a version that I compiled myself (DISCLAIMER: I HAVE NO IDEA HOW COMPILING WORKS I GOT IT TO WORK BY BLIND LUCK) my game immediately crashes from this error: https://pastebin.com/z3PXvSbV
I've managed to get it "working" by deleting "client.MixinWorldRenderer" in \Unicopia-beta-4\src\main\resources\unicopia.mixin.json but I doubt that counts as an actual fix.
Sorry if I'm bothersome but I do try to make sure I at least try to fix it or do something before I post an issue. Well, if I think I'll be able to figure anything out. That whole renderer thing is beyond my comprehension. My best guess is that I'm missing some sort of compile setting.
You can now try the beta5 release and see if the inconsistency is fixed. I believe it should be better in that version.
Mixin error is also fixed. Thanks!
I've never done anything with java or minecraft mods. It took me like 4 hours to figure out how to add haste to earth ponies, and even then its not really a good solution. So idk how you would fix the unicorn shield stuff.
I feel bad just dumping issues so I hope including what I tried will help.
Sorry for all the comments so quickly but this mod is so awesome and promising I can't help but get excited.