Skip to content

Commit

Permalink
Finished Echoes and Tusk
Browse files Browse the repository at this point in the history
///MERGE 1.15.x///

Finished Echoes and Tusk! These 2 took a long time because I treated all of their acts as separate Stands, so they were more like 7 Stands, I'm still counting them as 2 though. With them out of the way the last Stand before release is on the horizon, Beach Boy. Don't get too excited though, there are still a lot of things I need to add before release. Anyways, as always, changelog is below.

Changelog:
- Added Echoes as a Stand.
- Added Tusk.
- Fixed a bug with Sticky Fingers.
- Given D4C 2 new abilities.
- Given Killer Queen the ability to turn blocks into bombs.
- Fixed a huge bug with timestop.
- Added 2 new abilities to The World and Star Platinum.
- Nerfed Made in Heaven by making his timer have to recharge.
- Given Made in Heaven 2 new abilities.
- Added control and ability overviews to more Stand arrows.
  • Loading branch information
Novarch129 authored Aug 29, 2020
2 parents f006859 + 2bad27b commit 01a79ed
Show file tree
Hide file tree
Showing 115 changed files with 5,575 additions and 367 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## A mod that adds Stands from JoJo's Bizarre Adventure to Minecraft.

### List of planned Stands:
- [ ] Tusk
- [x] Tusk
- [x] Dirty Deeds Done Dirt Cheap
- [x] 20th Century Boy
- [x] Whitesnake
Expand All @@ -29,7 +29,7 @@
- [x] Crazy Diamond
- [x] Killer Queen
- [x] The Hand
- [ ] Echoes
- [x] Echoes
- [x] 「THE WORLD」
- [x] Star Platinum
- [x] Magician's Red
Expand Down
Binary file added images/echoes_act_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/echoes_act_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/echoes_act_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/green_day_punch.png
Binary file not shown.
Binary file added images/tusk_act_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tusk_act_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tusk_act_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tusk_act_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.novarch129.jojomod;

import io.github.novarch129.jojomod.capability.Stand;
import io.github.novarch129.jojomod.capability.StandChunkEffects;
import io.github.novarch129.jojomod.capability.StandEffects;
import io.github.novarch129.jojomod.capability.Timestop;
import io.github.novarch129.jojomod.command.impl.StandCommand;
Expand Down Expand Up @@ -63,6 +64,7 @@ private void setup(FMLCommonSetupEvent event) {
Stand.register();
Timestop.register();
StandEffects.register();
StandChunkEffects.register();
PacketHandler.register();
}

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/io/github/novarch129/jojomod/capability/IStand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.github.novarch129.jojomod.capability;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;

import java.util.List;

public interface IStand {
PlayerEntity getPlayer();
Expand Down Expand Up @@ -103,6 +107,20 @@ public interface IStand {

void putAbilityUseCount(int abilityUseCount);

BlockPos getBlockPos();

void setBlockPos(BlockPos blockPos);

void putBlockPos(BlockPos blockPos);

List<ChunkPos> getAffectedChunkList();

void addAffectedChunk(ChunkPos pos);

void removeAffectedChunk(ChunkPos pos);

void putAffectedChunkList(List<ChunkPos> list);

void clone(IStand props);

void removeStand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public interface ITimestop {

void putDamage(Map<String, Float> damage);

boolean isEmpty();

void onDataUpdated();

void clear();
Expand Down
147 changes: 109 additions & 38 deletions src/main/java/io/github/novarch129/jojomod/capability/Stand.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
package io.github.novarch129.jojomod.capability;

import io.github.novarch129.jojomod.JojoBizarreSurvival;
import io.github.novarch129.jojomod.config.JojoBizarreSurvivalConfig;
import io.github.novarch129.jojomod.network.message.server.SSyncStandCapabilityPacket;
import io.github.novarch129.jojomod.util.Util;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.PacketDistributor;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;

import static io.github.novarch129.jojomod.util.Util.Null;
import static io.github.novarch129.jojomod.util.Util.StandID.CMOON;
import static io.github.novarch129.jojomod.util.Util.StandID.MADE_IN_HEAVEN;
import static io.github.novarch129.jojomod.util.Util.StandID.*;

/**
* The {@link Capability} used for storing the player's Stand ability.
Expand All @@ -39,14 +46,16 @@ public class Stand implements IStand, ICapabilitySerializable<INBT> {
private double cooldown;
private double timeLeft = 1000;
private String diavolo = "";
private boolean ability = true;
private boolean ability = JojoBizarreSurvivalConfig.COMMON.abilityImmediatelyActive.get();
private boolean abilityActive;
private int transformed;
private boolean noClip;
private double invulnerableTicks;
private float standDamage;
private boolean charging;
private int abilityUseCount;
private BlockPos blockPos = BlockPos.ZERO;
private List<ChunkPos> affectedChunkList = new ArrayList<>();
private LazyOptional<IStand> holder = LazyOptional.of(() -> new Stand(getPlayer()));

public Stand(@Nonnull PlayerEntity player) {
Expand All @@ -65,44 +74,60 @@ public static void register() {
CapabilityManager.INSTANCE.register(IStand.class, new Capability.IStorage<IStand>() {
@Nonnull
@Override
public INBT writeNBT(Capability<IStand> capability, IStand instance, Direction side) {
CompoundNBT props = new CompoundNBT();
props.putInt("standID", instance.getStandID());
props.putInt("standAct", instance.getAct());
props.putBoolean("standOn", instance.getStandOn());
props.putDouble("cooldown", instance.getCooldown());
props.putDouble("timeLeft", instance.getTimeLeft());
props.putBoolean("ability", instance.getAbility());
props.putInt("transformed", instance.getTransformed());
props.putString("diavolo", instance.getDiavolo());
props.putBoolean("noClip", instance.getNoClip());
props.putInt("standEntityID", instance.getPlayerStand());
props.putBoolean("abilityActive", instance.getAbilityActive());
props.putDouble("invulnerableTicks", instance.getInvulnerableTicks());
props.putFloat("standDamage", instance.getStandDamage());
props.putBoolean("charging", instance.isCharging());
props.putInt("abilityUseCount", instance.getAbilityUseCount());
return props;
public INBT writeNBT(Capability<IStand> capability, IStand props, Direction side) {
CompoundNBT nbt = new CompoundNBT();
nbt.putInt("standID", props.getStandID());
nbt.putInt("standAct", props.getAct());
nbt.putBoolean("standOn", props.getStandOn());
nbt.putDouble("cooldown", props.getCooldown());
nbt.putDouble("timeLeft", props.getTimeLeft());
nbt.putBoolean("ability", props.getAbility());
nbt.putInt("transformed", props.getTransformed());
nbt.putString("diavolo", props.getDiavolo());
nbt.putBoolean("noClip", props.getNoClip());
nbt.putInt("standEntityID", props.getPlayerStand());
nbt.putBoolean("abilityActive", props.getAbilityActive());
nbt.putDouble("invulnerableTicks", props.getInvulnerableTicks());
nbt.putFloat("standDamage", props.getStandDamage());
nbt.putBoolean("charging", props.isCharging());
nbt.putInt("abilityUseCount", props.getAbilityUseCount());
nbt.putDouble("blockPosX", props.getBlockPos().getX());
nbt.putDouble("blockPosY", props.getBlockPos().getY());
nbt.putDouble("blockPosZ", props.getBlockPos().getZ());
ListNBT listNBT = new ListNBT();
props.getAffectedChunkList().forEach(pos -> {
CompoundNBT compoundNBT = new CompoundNBT();
compoundNBT.putInt("chunkX", pos.x);
compoundNBT.putInt("chunkZ", pos.z);
listNBT.add(compoundNBT);
});
nbt.put("affectedChunkList", listNBT);
return nbt;
}

@Override
public void readNBT(Capability<IStand> capability, IStand instance, Direction side, INBT nbt) {
public void readNBT(Capability<IStand> capability, IStand props, Direction side, INBT nbt) {
CompoundNBT compoundNBT = (CompoundNBT) nbt;
instance.putStandID(compoundNBT.getInt("standID"));
instance.putAct(compoundNBT.getInt("standAct"));
instance.putStandOn(compoundNBT.getBoolean("standOn"));
instance.putCooldown(compoundNBT.getDouble("cooldown"));
instance.putTimeLeft(compoundNBT.getDouble("timeLeft"));
instance.putAbility(compoundNBT.getBoolean("ability"));
instance.putTransformed(compoundNBT.getInt("transformed"));
instance.putDiavolo(compoundNBT.getString("diavolo"));
instance.putNoClip(compoundNBT.getBoolean("noClip"));
instance.putPlayerStand(compoundNBT.getInt("standEntityID"));
instance.putAbilityActive(compoundNBT.getBoolean("abilityActive"));
instance.putInvulnerableTicks(compoundNBT.getDouble("invulnerableTicks"));
instance.putStandDamage(compoundNBT.getFloat("standDamage"));
instance.putCharging(compoundNBT.getBoolean("charging"));
instance.putAbilityUseCount(compoundNBT.getInt("abilityUseCount"));
props.putStandID(compoundNBT.getInt("standID"));
props.putAct(compoundNBT.getInt("standAct"));
props.putStandOn(compoundNBT.getBoolean("standOn"));
props.putCooldown(compoundNBT.getDouble("cooldown"));
props.putTimeLeft(compoundNBT.getDouble("timeLeft"));
props.putAbility(compoundNBT.getBoolean("ability"));
props.putTransformed(compoundNBT.getInt("transformed"));
props.putDiavolo(compoundNBT.getString("diavolo"));
props.putNoClip(compoundNBT.getBoolean("noClip"));
props.putPlayerStand(compoundNBT.getInt("standEntityID"));
props.putAbilityActive(compoundNBT.getBoolean("abilityActive"));
props.putInvulnerableTicks(compoundNBT.getDouble("invulnerableTicks"));
props.putStandDamage(compoundNBT.getFloat("standDamage"));
props.putCharging(compoundNBT.getBoolean("charging"));
props.putAbilityUseCount(compoundNBT.getInt("abilityUseCount"));
props.putBlockPos(new BlockPos(compoundNBT.getDouble("blockPosX"), compoundNBT.getDouble("blockPosY"), compoundNBT.getDouble("blockPosZ")));
compoundNBT.getList("affectedChunkList", Constants.NBT.TAG_COMPOUND).forEach(inbt -> {
if (inbt instanceof CompoundNBT && ((CompoundNBT) inbt).contains("chunkX"))
props.addAffectedChunk(new ChunkPos(((CompoundNBT) inbt).getInt("chunkX"), ((CompoundNBT) inbt).getInt("chunkZ")));
});
}
}, () -> new Stand(Null()));
}
Expand Down Expand Up @@ -160,14 +185,20 @@ public void changeAct() {

@Override
public boolean hasAct() {
return getStandID() == MADE_IN_HEAVEN || getStandID() == CMOON;
return Util.StandID.STANDS_WITH_ACTS.contains(getStandID());
}

@Override
public int getMaxAct() {
switch (standID) {
case TUSK_ACT_4:
return 4;
case ECHOES_ACT_3:
case TUSK_ACT_3:
case MADE_IN_HEAVEN:
return 3;
case ECHOES_ACT_2:
case TUSK_ACT_2:
case CMOON:
return 2;
}
Expand Down Expand Up @@ -382,6 +413,44 @@ public void putAbilityUseCount(int abilityUseCount) {
this.abilityUseCount = abilityUseCount;
}

@Override
public BlockPos getBlockPos() {
return blockPos;
}

@Override
public void setBlockPos(BlockPos blockPos) {
this.blockPos = blockPos;
onDataUpdated();
}

@Override
public void putBlockPos(BlockPos blockPos) {
this.blockPos = blockPos;
}

@Override
public List<ChunkPos> getAffectedChunkList() {
return affectedChunkList;
}

@Override
public void addAffectedChunk(ChunkPos pos) {
affectedChunkList.add(pos);
onDataUpdated();
}

@Override
public void removeAffectedChunk(ChunkPos pos) {
affectedChunkList.remove(pos);
onDataUpdated();
}

@Override
public void putAffectedChunkList(List<ChunkPos> list) {
affectedChunkList = list;
}

public void clone(IStand props) {
putStandID(props.getStandID());
putAct(props.getAct());
Expand All @@ -397,6 +466,7 @@ public void clone(IStand props) {
putStandDamage(props.getStandDamage());
putCharging(props.isCharging());
putAbilityUseCount(props.getAbilityUseCount());
putAffectedChunkList(props.getAffectedChunkList());
onDataUpdated();
}

Expand All @@ -417,6 +487,7 @@ public void removeStand() {
putStandDamage(0);
putCharging(false);
putAbilityUseCount(0);
putAffectedChunkList(new ArrayList<>());
onDataUpdated();
}

Expand Down
Loading

0 comments on commit 01a79ed

Please sign in to comment.