Skip to content

Commit

Permalink
Moves the pokecube entities over to entity
Browse files Browse the repository at this point in the history
this keeps them in a more standard location, and moves them out of "item"

This also contains the second part of cooldown storage for them
  • Loading branch information
Thutmose committed Dec 5, 2022
1 parent 0727439 commit aadcb9e
Show file tree
Hide file tree
Showing 22 changed files with 703 additions and 696 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
import pokecube.core.PokecubeItems;
import pokecube.core.ai.brain.BrainUtils;
import pokecube.core.ai.npc.Activities;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import pokecube.core.eventhandlers.EventsHandler;
import pokecube.core.handlers.PokecubePlayerDataHandler;
import pokecube.core.handlers.playerdata.PokecubePlayerCustomData;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.items.pokecubes.PokecubeManager;
import thut.api.Tracker;
import thut.api.maths.Vector3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import pokecube.api.entity.pokemob.IPokemob;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import pokecube.core.items.pokecubes.PokecubeManager;

@Cancelable
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pokecube/api/items/IPokecube.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pokecube.api.events.pokemobs.CaptureEvent.Post;
import pokecube.api.events.pokemobs.CaptureEvent.Pre;
import pokecube.core.PokecubeCore;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import thut.api.maths.Vector3;

public interface IPokecube
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pokecube.core.PokecubeCore;
import pokecube.core.ai.brain.BrainUtils;
import pokecube.core.ai.tasks.combat.CombatTask;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import pokecube.core.moves.MovesUtils;
import thut.api.Tracker;
import thut.api.entity.ai.IAICombat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
import pokecube.core.client.render.mobs.RenderPokemob;
import pokecube.core.database.Database;
import pokecube.core.database.pokedex.PokedexEntryLoader;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import pokecube.core.impl.capabilities.DefaultPokemob;
import pokecube.core.init.ClientSetupHandler;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.items.pokecubes.PokecubeManager;
import pokecube.core.moves.animations.MoveAnimationHelper;
import pokecube.core.network.pokemobs.PacketBattleTargets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import pokecube.api.items.IPokecube;
import pokecube.core.PokecubeItems;
import pokecube.core.client.render.mobs.RenderPokecube.ModelPokecube;
import pokecube.core.entity.pokecubes.EntityPokecube;
import pokecube.core.impl.PokecubeMod;
import pokecube.core.items.pokecubes.EntityPokecube;
import pokecube.core.items.pokecubes.PokecubeManager;
import thut.api.Tracker;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pokecube/core/commands/Pokerecall.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import pokecube.api.entity.pokemob.ai.GeneralStates;
import pokecube.api.entity.pokemob.ai.LogicStates;
import pokecube.core.PokecubeCore;
import pokecube.core.entity.pokecubes.EntityPokecubeBase;
import pokecube.core.eventhandlers.EventsHandler;
import pokecube.core.eventhandlers.PCEventsHandler;
import pokecube.core.items.pokecubes.EntityPokecubeBase;
import pokecube.core.items.pokecubes.PokecubeManager;
import pokecube.core.items.pokecubes.helper.SendOutManager;
import pokecube.core.utils.PokemobTracker;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pokecube.core.items.pokecubes;
package pokecube.core.entity.pokecubes;

import java.util.ArrayList;
import java.util.Map;
Expand Down Expand Up @@ -31,6 +31,7 @@
import pokecube.core.handlers.PokecubePlayerDataHandler;
import pokecube.core.handlers.playerdata.PokecubePlayerCustomData;
import pokecube.core.init.EntityTypes;
import pokecube.core.items.pokecubes.PokecubeManager;
import pokecube.core.items.pokecubes.helper.CaptureManager;
import pokecube.core.items.pokecubes.helper.SendOutManager;
import pokecube.core.network.packets.PacketPokecube;
Expand Down Expand Up @@ -87,7 +88,7 @@ public boolean isValid(final Entity in, final long resetTime, short resetKey)
// If reset key does not match, invalidate the entry.
if (s.resetKey != resetKey)
{
map.remove(in.getStringUUID());
this.map.remove(in.getStringUUID());
return false;
}
// If this is the case, then this mob is not re-battleable.
Expand Down Expand Up @@ -244,14 +245,14 @@ public InteractionResult interact(final Player player, final InteractionHand han
CollectList collected = PokecubePlayerDataHandler.getCustomDataValue(name, "loot_pokecubes");
collected.validate(this, resetKey);
ItemStack loot = ItemStack.EMPTY;
boolean did = false;
if (!this.lootStacks.isEmpty())
{
loot = this.lootStacks.get(ThutCore.newRandom().nextInt(this.lootStacks.size()));
if (!loot.isEmpty())
{
PacketPokecube.sendMessage(player, this.getId(),
Tracker.instance().getTick() + this.resetTime);
Tools.giveItem(player, loot.copy());
did = true;
}
}
else if (this.lootTable != null)
Expand All @@ -262,8 +263,10 @@ else if (this.lootTable != null)
for (final ItemStack itemstack : loottable
.getRandomItems(lootcontext$builder.create(loottable.getParamSet())))
if (!itemstack.isEmpty()) Tools.giveItem(player, itemstack.copy());
PacketPokecube.sendMessage(player, this.getId(), Tracker.instance().getTick() + this.resetTime);
did = true;
}
if (did)
PacketPokecube.sendMessage(player, this.getId(), Tracker.instance().getTick() + this.resetTime);
return InteractionResult.SUCCESS;
}
Tools.giveItem(player, this.getItem());
Expand All @@ -288,7 +291,7 @@ public void readAdditionalSaveData(final CompoundTag nbt)
for (int i = 0; i < ListNBT.size(); i++) this.addLoot(LootEntry.createFromNBT(ListNBT.getCompound(i)));
}
final String lootTable = nbt.getString("lootTable");
if (!lootTable.isEmpty()) this.lootTable = new ResourceLocation(lootTable);
if (!lootTable.isBlank()) this.lootTable = new ResourceLocation(lootTable);
}

public void shoot(final Vector3 direction, final float velocity)
Expand Down Expand Up @@ -372,7 +375,7 @@ public void addAdditionalSaveData(final CompoundTag nbt)
entry.writeToNBT(CompoundNBT);
ListNBT.add(CompoundNBT);
}
if (!this.loot.isEmpty()) nbt.put("loot", ListNBT);
nbt.put("loot", ListNBT);
if (this.lootTable != null) nbt.putString("lootTable", this.lootTable.toString());
else nbt.putString("lootTable", "");
}
Expand Down
Loading

0 comments on commit aadcb9e

Please sign in to comment.