Skip to content

Commit

Permalink
Merge branch '1.14' into 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Thutmose committed May 24, 2020
2 parents 8bd91a1 + 74abdcb commit 8952290
Show file tree
Hide file tree
Showing 179 changed files with 4,055 additions and 2,805 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Unconfirmed
assignees: ''

---

Expand Down
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

Expand Down
18 changes: 13 additions & 5 deletions src/main/java/pokecube/adventures/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ public class Config extends ConfigData
private static final String BAG = "bag";

@Configure(category = Config.TRAINER)
public boolean npcsAreTrainers = true;
public boolean npcsAreTrainers = true;

@Configure(category = Config.TRAINER)
public int trainerCooldown = 5000;
@Configure(category = Config.TRAINER)
public int trainerCooldown = 5000;
public int trainerSightRange = 8;
@Configure(category = Config.TRAINER)
public int trainerSightRange = 8;
public int trainerBattleDelay = 50;
@Configure(category = Config.TRAINER)
public int trainerBattleDelay = 50;
public int trainerSendOutDelay = 50;
@Configure(category = Config.TRAINER)
public int trainerSendOutDelay = 50;
public int trainerAgroRate = 20;

@Configure(category = Config.TRAINER)
public boolean trainerslevel = true;
@Configure(category = Config.TRAINER)
Expand Down Expand Up @@ -128,6 +132,8 @@ public class Config extends ConfigData
public String afaCostFunctionShiny = "(d^3)/10";
@Configure(category = Config.MACHINE)
public int afaMaxEnergy = 3200;
@Configure(category = Config.MACHINE)
public int afaTickRate = 5;

@Configure(category = Config.BAG, type = Type.SERVER)
public boolean bagsHoldEverything = false;
Expand All @@ -154,6 +160,8 @@ public void onUpdated()
DaycareTile.initParser(this.dayCarePowerPerExp, this.dayCareExpFunction);
AfaTile.initParser(this.afaCostFunction, this.afaCostFunctionShiny);
this.dayCareTickRate = Math.max(1, this.dayCareTickRate);
this.afaTickRate = Math.max(1, this.afaTickRate);
this.trainerAgroRate = Math.max(1, this.trainerAgroRate);

if (this.autoAddFossilDNA) for (final Entry<String, ItemFossil> fossil : ItemGenerator.fossils.entrySet())
{
Expand Down
83 changes: 56 additions & 27 deletions src/main/java/pokecube/adventures/PokecubeAdv.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.brain.memory.MemoryModuleType;
import net.minecraft.entity.merchant.villager.VillagerProfession;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.village.PointOfInterestType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.TextureStitchEvent;
Expand All @@ -25,8 +28,12 @@
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import pokecube.adventures.advancements.Triggers;
import pokecube.adventures.ai.brain.MemoryTypes;
import pokecube.adventures.ai.poi.PointsOfInterest;
import pokecube.adventures.ai.poi.Professions;
import pokecube.adventures.blocks.BlockEventHandler;
import pokecube.adventures.blocks.afa.AfaBlock;
import pokecube.adventures.blocks.afa.AfaContainer;
import pokecube.adventures.blocks.afa.AfaTile;
import pokecube.adventures.blocks.commander.CommanderBlock;
import pokecube.adventures.blocks.commander.CommanderTile;
Expand Down Expand Up @@ -99,6 +106,7 @@ public static void registerContainers(final RegistryEvent.Register<ContainerType
event.getRegistry().register(ClonerContainer.TYPE.setRegistryName(PokecubeAdv.MODID, "cloner"));
event.getRegistry().register(ExtractorContainer.TYPE.setRegistryName(PokecubeAdv.MODID, "extractor"));
event.getRegistry().register(SplicerContainer.TYPE.setRegistryName(PokecubeAdv.MODID, "splicer"));
event.getRegistry().register(AfaContainer.TYPE.setRegistryName(PokecubeAdv.MODID, "afa"));
event.getRegistry().register(BagContainer.TYPE.setRegistryName(PokecubeAdv.MODID, "bag"));
}

Expand All @@ -110,6 +118,12 @@ public static void registerEntities(final RegistryEvent.Register<EntityType<?>>
event.getRegistry().register(LeaderNpc.TYPE.setRegistryName(PokecubeAdv.MODID, "leader"));
}

@SubscribeEvent
public static void registerMemories(final RegistryEvent.Register<MemoryModuleType<?>> event)
{
MemoryTypes.register(event);
}

@SubscribeEvent
public static void registerItems(final RegistryEvent.Register<Item> event)
{
Expand Down Expand Up @@ -157,6 +171,18 @@ public static void registerRecipes(final RegistryEvent.Register<IRecipeSerialize
PoweredProcess.init(event);
}

@SubscribeEvent
public static void registerPOIs(final RegistryEvent.Register<PointOfInterestType> event)
{
PointsOfInterest.register(event);
}

@SubscribeEvent
public static void registerProfessions(final RegistryEvent.Register<VillagerProfession> event)
{
Professions.register(event);
}

@SubscribeEvent
public static void registerTiles(final RegistryEvent.Register<TileEntityType<?>> event)
{
Expand Down Expand Up @@ -210,32 +236,36 @@ public static void textureStitch(final TextureStitchEvent.Pre event)
public static final Map<PokeType, Item> BADGES = Maps.newHashMap();
public static final Map<Item, PokeType> BADGEINV = Maps.newHashMap();

static void init()
static
{
PokecubeAdv.AFA = new AfaBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.COMMANDER = new CommanderBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.DAYCARE = new DaycareBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.CLONER = new ClonerBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.EXTRACTOR = new ExtractorBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.SPLICER = new SplicerBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.SIPHON = new SiphonBlock(Block.Properties.create(Material.IRON).variableOpacity());
PokecubeAdv.WARPPAD = new WarppadBlock(Block.Properties.create(Material.IRON));
PokecubeAdv.EXPSHARE = new Item(new Item.Properties().group(PokecubeItems.POKECUBEITEMS));
PokecubeAdv.LINKER = new Linker(new Item.Properties().group(PokecubeItems.POKECUBEITEMS));
PokecubeAdv.BAG = new BagItem(new Item.Properties().group(PokecubeItems.POKECUBEITEMS));
PokecubeAdv.TRAINEREDITOR = new TrainerEditor(new Item.Properties().group(PokecubeItems.POKECUBEITEMS));
}

private static void init()
{
PokecubeAdv.AFA = new AfaBlock(Block.Properties.create(Material.IRON).variableOpacity()).setRegistryName(
PokecubeAdv.MODID, "afa");
PokecubeAdv.COMMANDER = new CommanderBlock(Block.Properties.create(Material.IRON).variableOpacity())
.setRegistryName(PokecubeAdv.MODID, "commander");
PokecubeAdv.DAYCARE = new DaycareBlock(Block.Properties.create(Material.IRON).variableOpacity())
.setRegistryName(PokecubeAdv.MODID, "daycare");
PokecubeAdv.CLONER = new ClonerBlock(Block.Properties.create(Material.IRON).variableOpacity()).setRegistryName(
PokecubeAdv.MODID, "cloner");
PokecubeAdv.EXTRACTOR = new ExtractorBlock(Block.Properties.create(Material.IRON).variableOpacity())
.setRegistryName(PokecubeAdv.MODID, "extractor");
PokecubeAdv.SPLICER = new SplicerBlock(Block.Properties.create(Material.IRON).variableOpacity())
.setRegistryName(PokecubeAdv.MODID, "splicer");
PokecubeAdv.SIPHON = new SiphonBlock(Block.Properties.create(Material.IRON).variableOpacity()).setRegistryName(
PokecubeAdv.MODID, "siphon");
PokecubeAdv.WARPPAD = new WarppadBlock(Block.Properties.create(Material.IRON).variableOpacity())
.setRegistryName(PokecubeAdv.MODID, "warppad");
PokecubeAdv.EXPSHARE = new Item(new Item.Properties().group(PokecubeItems.POKECUBEITEMS)).setRegistryName(
PokecubeAdv.MODID, "exp_share");
PokecubeAdv.LINKER = new Linker(new Item.Properties().group(PokecubeItems.POKECUBEITEMS)).setRegistryName(
PokecubeAdv.MODID, "linker");
PokecubeAdv.BAG = new BagItem(new Item.Properties().group(PokecubeItems.POKECUBEITEMS)).setRegistryName(
PokecubeAdv.MODID, "bag");
PokecubeAdv.TRAINEREDITOR = new TrainerEditor(new Item.Properties().group(PokecubeItems.POKECUBEITEMS))
.setRegistryName(PokecubeAdv.MODID, "trainer_editor");
PokecubeAdv.AFA.setRegistryName(PokecubeAdv.MODID, "afa");
PokecubeAdv.COMMANDER.setRegistryName(PokecubeAdv.MODID, "commander");
PokecubeAdv.DAYCARE.setRegistryName(PokecubeAdv.MODID, "daycare");
PokecubeAdv.CLONER.setRegistryName(PokecubeAdv.MODID, "cloner");
PokecubeAdv.EXTRACTOR.setRegistryName(PokecubeAdv.MODID, "extractor");
PokecubeAdv.SPLICER.setRegistryName(PokecubeAdv.MODID, "splicer");
PokecubeAdv.SIPHON.setRegistryName(PokecubeAdv.MODID, "siphon");
PokecubeAdv.WARPPAD.setRegistryName(PokecubeAdv.MODID, "warppad");
PokecubeAdv.EXPSHARE.setRegistryName(PokecubeAdv.MODID, "exp_share");
PokecubeAdv.LINKER.setRegistryName(PokecubeAdv.MODID, "linker");
PokecubeAdv.BAG.setRegistryName(PokecubeAdv.MODID, "bag");
PokecubeAdv.TRAINEREDITOR.setRegistryName(PokecubeAdv.MODID, "trainer_editor");

// Initialize advancement triggers
Triggers.init();
Expand All @@ -249,7 +279,7 @@ static void init()
public final static CommonProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(),
() -> () -> new CommonProxy());

private static final String NETVERSION = "1.0.0";
private static final String NETVERSION = "1.0.1";
// Handler for network stuff.
public static final PacketHandler packets = new PacketHandler(new ResourceLocation(PokecubeAdv.MODID, "comms"),
PokecubeAdv.NETVERSION);
Expand All @@ -258,7 +288,6 @@ static void init()

public PokecubeAdv()
{
// Initialize items and blocks
PokecubeAdv.init();

FMLJavaModLoadingContext.get().getModEventBus().addListener(PokecubeAdv.proxy::setup);
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/pokecube/adventures/ai/brain/MemoryTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package pokecube.adventures.ai.brain;

import java.util.Optional;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.brain.memory.MemoryModuleType;
import net.minecraftforge.event.RegistryEvent.Register;
import pokecube.adventures.PokecubeAdv;

public class MemoryTypes
{
public static final MemoryModuleType<LivingEntity> BATTLETARGET = new MemoryModuleType<>(Optional.empty());

public static void register(final Register<MemoryModuleType<?>> event)
{
event.getRegistry().register(MemoryTypes.BATTLETARGET.setRegistryName(PokecubeAdv.MODID, "battle_target"));
}
}
40 changes: 40 additions & 0 deletions src/main/java/pokecube/adventures/ai/poi/PointsOfInterest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package pokecube.adventures.ai.poi;

import java.util.Set;

import com.google.common.collect.Sets;

import net.minecraft.block.BlockState;
import net.minecraft.village.PointOfInterestType;
import net.minecraftforge.event.RegistryEvent.Register;
import pokecube.adventures.PokecubeAdv;
import pokecube.core.PokecubeItems;

public class PointsOfInterest
{
public static Set<BlockState> LABMACHINES = Sets.newHashSet();

public static PointOfInterestType GENELAB;
public static PointOfInterestType HEALER;

public static void register(final Register<PointOfInterestType> event)
{
PointsOfInterest.LABMACHINES.addAll(PokecubeAdv.EXTRACTOR.getStateContainer().getValidStates());
PointsOfInterest.LABMACHINES.addAll(PokecubeAdv.SPLICER.getStateContainer().getValidStates());
PointsOfInterest.LABMACHINES.addAll(PokecubeAdv.CLONER.getStateContainer().getValidStates());

PointsOfInterest.GENELAB = new PointOfInterestType("pokecube_adventures:gene_lab", PointsOfInterest.LABMACHINES,
1, null, 2);
PointsOfInterest.HEALER = new PointOfInterestType("pokecube_adventures:healer", Sets.newHashSet(
PokecubeItems.HEALER.getStateContainer().getValidStates()), 1, null, 2);
System.out.println(Sets.newHashSet(PokecubeItems.HEALER.getStateContainer().getValidStates()));
System.out.println(PointsOfInterest.LABMACHINES);

event.getRegistry().register(PointsOfInterest.GENELAB.setRegistryName("pokecube_adventures:gene_lab"));
event.getRegistry().register(PointsOfInterest.HEALER.setRegistryName("pokecube_adventures:healer"));

PointOfInterestType.func_221052_a(PointsOfInterest.GENELAB);
PointOfInterestType.func_221052_a(PointsOfInterest.HEALER);
}

}
26 changes: 26 additions & 0 deletions src/main/java/pokecube/adventures/ai/poi/Professions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pokecube.adventures.ai.poi;

import com.google.common.collect.ImmutableSet;

import net.minecraft.entity.merchant.villager.VillagerProfession;
import net.minecraftforge.event.RegistryEvent.Register;
import pokecube.core.entity.npc.NpcType;

public class Professions
{
public static VillagerProfession HEALER;
public static VillagerProfession PROFESSOR;

public static void register(final Register<VillagerProfession> event)
{
Professions.HEALER = new VillagerProfession("pokecube_adventures:healer", PointsOfInterest.HEALER, ImmutableSet
.of(), ImmutableSet.of());
Professions.PROFESSOR = new VillagerProfession("pokecube_adventures:professor", PointsOfInterest.GENELAB,
ImmutableSet.of(), ImmutableSet.of());
event.getRegistry().register(Professions.HEALER.setRegistryName("pokecube_adventures:healer"));
event.getRegistry().register(Professions.PROFESSOR.setRegistryName("pokecube_adventures:professor"));

NpcType.HEALER.setProfession(Professions.HEALER);
NpcType.PROFESSOR.setProfession(Professions.PROFESSOR);
}
}
Loading

0 comments on commit 8952290

Please sign in to comment.