Skip to content

Commit

Permalink
Merge branch '1.12.2-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gottsch committed Sep 13, 2020
2 parents b6fa5a2 + d424963 commit 24bfab5
Show file tree
Hide file tree
Showing 108 changed files with 2,113 additions and 642 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@

## Key and Locks
Hold the **Shift** key while using a key or a lock on a chest in order to use it.

## Read the [documentation](https://github.com/gottsch/gottsch-minecraft-Treasure/wiki)
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ apply plugin: 'net.minecraftforge.gradle.forge'

ext {
// Open the Git repository in the parent directory.
git = org.ajoberstar.grgit.Grgit.open(file('../'))
// git = org.ajoberstar.grgit.Grgit.open(file('../'))

// Get commit id of HEAD.
revision = git.head().id
// revision = git.head().id
// Alternative is using abbreviatedId of head() method.
// revision = git.head().abbreviatedId
}
Expand Down Expand Up @@ -53,13 +53,14 @@ sourceSets.main{
srcDirs 'src' //, 'test' //set the source folder as the /src subfolder
}
resources{
srcDirs 'src/resources'//set the resources folder as the /resources subfolder
srcDirs 'src/resources' //set the resources folder as the /resources subfolder
}
}

def gottschcore_path="../../gottsch-minecraft-GottschCore/GottschCore${mc_version}/build/libs/GottschCore-mc${mc_version}-f${forge_version}-v${gottschcore_version}.jar"
def gottschcore_path="../gottsch-minecraft-GottschCore/GottschCore${mc_version}/build/libs/GottschCore-mc${mc_version}-f${forge_version}-v${gottschcore_version}.jar"

dependencies {
compile files('../../ModCommonLibs/libs/commons-cli-1.4.jar')
compile files('../ModCommonLibs/libs/commons-cli-1.4.jar')
//compile files(gottschcore_path)
shadow files(gottschcore_path)
compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ package_group=someguyssoftware.treasure2
# user alpha, beta, or v (for version)
mod_version_type=v

mod_version=1.12.0
mod_version=1.13.0

#versions
mc_version=1.12.2
forge_version=14.23.5.2768
mappings_version=snapshot_20171003
gottschcore_version=1.13.0
gottschcore_version=1.13.1
patchouli_version=1.0-20.108

# paths
Expand Down
37 changes: 22 additions & 15 deletions src/com/someguyssoftware/treasure2/Treasure.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import com.someguyssoftware.treasure2.block.TreasureBlocks;
import com.someguyssoftware.treasure2.capability.CharmCapability;
import com.someguyssoftware.treasure2.capability.CharmStorage;
import com.someguyssoftware.treasure2.capability.EffectiveMaxDamageCapability;
import com.someguyssoftware.treasure2.capability.EffectiveMaxDamageStorage;
import com.someguyssoftware.treasure2.capability.ICharmCapability;
import com.someguyssoftware.treasure2.capability.IEffectiveMaxDamageCapability;
import com.someguyssoftware.treasure2.capability.IKeyRingCapability;
import com.someguyssoftware.treasure2.capability.KeyRingCapability;
import com.someguyssoftware.treasure2.capability.KeyRingStorage;
Expand All @@ -37,7 +40,8 @@
import com.someguyssoftware.treasure2.command.SpawnWellStructureCommand;
import com.someguyssoftware.treasure2.command.SpawnWitherTreeCommand;
import com.someguyssoftware.treasure2.config.TreasureConfig;
import com.someguyssoftware.treasure2.enums.WorldGenerators;
import com.someguyssoftware.treasure2.enums.WorldGeneratorType;
import com.someguyssoftware.treasure2.eventhandler.AnvilEventHandler;
import com.someguyssoftware.treasure2.eventhandler.LogoutEventHandler;
import com.someguyssoftware.treasure2.eventhandler.MimicEventHandler;
import com.someguyssoftware.treasure2.eventhandler.PlayerEventHandler;
Expand Down Expand Up @@ -94,18 +98,19 @@
"Credits to CuddleBeak for some Keys and Locks textures.",
"Credits to mn_ti for Chinese and to DarkKnightComes for Polish translation.",
"Credits to Mythical Sausage for tutorials on house/tower designs.",
"Credits to OdinsRagnarok for Spanish translation and DarvinSlav for Russian translation." })
"Credits to OdinsRagnarok for Spanish translation and DarvinSlav for Russian translation.",
"Credits to sfs131010 for updated Chinese translation."})
public class Treasure extends AbstractMod {

// constants
public static final String MODID = "treasure2";
protected static final String NAME = "Treasure2";
protected static final String VERSION = "1.12.0";
protected static final String VERSION = "1.12.2";

public static final String UPDATE_JSON_URL = "https://raw.githubusercontent.com/gottsch/gottsch-minecraft-Treasure/master/Treasure2-1.12.2/update.json";
public static final String UPDATE_JSON_URL = "https://raw.githubusercontent.com/gottsch/gottsch-minecraft-Treasure/master/update.json";

private static final String VERSION_URL = "";
private static final BuildVersion MINECRAFT_VERSION = new BuildVersion(1, 12, 2);
private static final BuildVersion MINECRAFT_VERSION = new BuildVersion(1, 13, 0);

// latest version
private static BuildVersion latestVersion;
Expand Down Expand Up @@ -133,7 +138,7 @@ public ItemStack getTabIconItem() {
};

// forge world generators
public final static Map<WorldGenerators, ITreasureWorldGenerator> WORLD_GENERATORS = new HashMap<>();
public final static Map<WorldGeneratorType, ITreasureWorldGenerator> WORLD_GENERATORS = new HashMap<>();

// template manager
public static TreasureTemplateManager TEMPLATE_MANAGER;
Expand Down Expand Up @@ -162,13 +167,14 @@ public void preInt(FMLPreInitializationEvent event) {
super.preInt(event);

// initialize/reload the config
((TreasureConfig) getConfig()).init();
TreasureConfig.init();

// register additional events
MinecraftForge.EVENT_BUS.register(new LogoutEventHandler(getInstance()));
MinecraftForge.EVENT_BUS.register(new PlayerEventHandler(getInstance()));
MinecraftForge.EVENT_BUS.register(new WorldEventHandler(getInstance()));
MinecraftForge.EVENT_BUS.register(new MimicEventHandler(getInstance()));
MinecraftForge.EVENT_BUS.register(new MimicEventHandler(getInstance()));
MinecraftForge.EVENT_BUS.register(new AnvilEventHandler(getInstance()));

// configure logging
// create a rolling file appender
Expand All @@ -194,6 +200,7 @@ public void preInt(FMLPreInitializationEvent event) {
// add capabilities
CapabilityManager.INSTANCE.register(ICharmCapability.class, new CharmStorage(), CharmCapability::new);
CapabilityManager.INSTANCE.register(IKeyRingCapability.class, new KeyRingStorage(), KeyRingCapability::new);
CapabilityManager.INSTANCE.register(IEffectiveMaxDamageCapability.class, new EffectiveMaxDamageStorage(), EffectiveMaxDamageCapability::new);

// register custom loot functions
LootFunctionManager.registerFunction(new CharmRandomly.Serializer());
Expand Down Expand Up @@ -238,15 +245,15 @@ public void init(FMLInitializationEvent event) {
super.init(event);

// register world generators
WORLD_GENERATORS.put(WorldGenerators.SURFACE_CHEST, new SurfaceChestWorldGenerator());
WORLD_GENERATORS.put(WorldGenerators.SUBMERGED_CHEST, new SubmergedChestWorldGenerator());
WORLD_GENERATORS.put(WorldGenerators.WELL, new WellWorldGenerator());
WORLD_GENERATORS.put(WorldGenerators.WITHER_TREE, new WitherTreeWorldGenerator());
WORLD_GENERATORS.put(WorldGenerators.GEM, new GemOreWorldGenerator());
WORLD_GENERATORS.put(WorldGenerators.OASIS, new OasisWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.SURFACE_CHEST, new SurfaceChestWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.SUBMERGED_CHEST, new SubmergedChestWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.WELL, new WellWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.WITHER_TREE, new WitherTreeWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.GEM, new GemOreWorldGenerator());
WORLD_GENERATORS.put(WorldGeneratorType.OASIS, new OasisWorldGenerator());

int genWeight = 0;
for (Entry<WorldGenerators, ITreasureWorldGenerator> gen : WORLD_GENERATORS.entrySet()) {
for (Entry<WorldGeneratorType, ITreasureWorldGenerator> gen : WORLD_GENERATORS.entrySet()) {
GameRegistry.registerWorldGenerator(gen.getValue(), genWeight++);
}

Expand Down
26 changes: 13 additions & 13 deletions src/com/someguyssoftware/treasure2/block/AbstractChestBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.someguyssoftware.treasure2.chest.TreasureChestType;
import com.someguyssoftware.treasure2.enums.Rarity;
import com.someguyssoftware.treasure2.lock.LockState;
import com.someguyssoftware.treasure2.tileentity.AbstractTreasureChestTileEntity;
import com.someguyssoftware.treasure2.tileentity.ITreasureChestTileEntity;

import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
Expand Down Expand Up @@ -48,7 +48,7 @@ public abstract class AbstractChestBlock extends AbstractModContainerBlock imple
/*
* the concrete object of the tile entity
*/
private AbstractTreasureChestTileEntity tileEntity;
private ITreasureChestTileEntity tileEntity;

/*
* the type of chest
Expand All @@ -68,7 +68,7 @@ public abstract class AbstractChestBlock extends AbstractModContainerBlock imple
/**
*
*/
public AbstractChestBlock(String modID, String name, Material material, Class<? extends AbstractTreasureChestTileEntity> te, TreasureChestType type, Rarity rarity) {
public AbstractChestBlock(String modID, String name, Material material, Class<? extends ITreasureChestTileEntity> te, TreasureChestType type, Rarity rarity) {
this(modID, name, material);
setTileEntityClass(te);
setChestType(type);
Expand All @@ -85,10 +85,10 @@ public AbstractChestBlock(String modID, String name, Material material, Class<?

// set the tile entity reference
try {
setTileEntity((AbstractTreasureChestTileEntity)getTileEntityClass().newInstance());
setTileEntity((ITreasureChestTileEntity)getTileEntityClass().newInstance());
}
catch(Exception e) {
Treasure.logger.warn("Unable to create reference AbstractTreasureChestTileEntity object.");
Treasure.logger.warn("Unable to create reference ITreasureChestTileEntity object.");
}

}
Expand All @@ -108,9 +108,9 @@ protected AbstractChestBlock(String modID, String name, Material material) {
*/
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
AbstractTreasureChestTileEntity chestTileEntity = null;
ITreasureChestTileEntity chestTileEntity = null;
try {
chestTileEntity = (AbstractTreasureChestTileEntity) getTileEntityClass().newInstance();
chestTileEntity = (ITreasureChestTileEntity) getTileEntityClass().newInstance();

// setup lock states
List<LockState> lockStates = new LinkedList<>();
Expand All @@ -126,7 +126,7 @@ public TileEntity createNewTileEntity(World worldIn, int meta) {
catch(Exception e) {
e.printStackTrace();
}
return chestTileEntity;
return (TileEntity) chestTileEntity;
}

/**
Expand Down Expand Up @@ -178,11 +178,11 @@ public boolean rotateLockStates(World world, BlockPos pos, Rotate rotate) {
if (rotate != Rotate.NO_ROTATE) shouldRotate = true;
// Treasure.logger.debug("Rotate to:" + rotate);

AbstractTreasureChestTileEntity tcte = null;
ITreasureChestTileEntity tcte = null;
TileEntity te = world.getTileEntity(pos);
if (te != null && te instanceof AbstractTreasureChestTileEntity) {
if (te != null && te instanceof ITreasureChestTileEntity) {
// get the backing tile entity
tcte = (AbstractTreasureChestTileEntity) te;
tcte = (ITreasureChestTileEntity) te;
}
else {
return false;
Expand Down Expand Up @@ -304,14 +304,14 @@ public void setTileEntityClass(Class<?> tileEntityClass) {
/**
* @return the tileEntity
*/
public AbstractTreasureChestTileEntity getTileEntity() {
public ITreasureChestTileEntity getTileEntity() {
return tileEntity;
}

/**
* @param tileEntity the tileEntity to set
*/
public AbstractChestBlock setTileEntity(AbstractTreasureChestTileEntity tileEntity) {
public AbstractChestBlock setTileEntity(ITreasureChestTileEntity tileEntity) {
this.tileEntity = tileEntity;
return this;
}
Expand Down
52 changes: 52 additions & 0 deletions src/com/someguyssoftware/treasure2/block/BlackstoneBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
*
*/
package com.someguyssoftware.treasure2.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.someguyssoftware.gottschcore.block.ModBlock;
import com.someguyssoftware.treasure2.Treasure;

/**
*
* @author Mark Gottschling on Sep 8, 2020
*
*/
public class BlackstoneBlock extends ModBlock implements IWishingWellBlock {
public static Logger logger = LogManager.getLogger(BlackstoneBlock.class);

/**
*
* @param material
*/
public BlackstoneBlock(String modID, String name) {
super(modID, name, Material.ROCK);
setSoundType(SoundType.STONE);
setCreativeTab(Treasure.TREASURE_TAB);
this.setHardness(3.0F);
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(TreasureBlocks.BLACKSTONE);
}
}
9 changes: 7 additions & 2 deletions src/com/someguyssoftware/treasure2/block/TreasureBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.someguyssoftware.gottschcore.block.ModBlock;
import com.someguyssoftware.treasure2.Treasure;
import com.someguyssoftware.treasure2.chest.TreasureChestTypes;
import com.someguyssoftware.treasure2.client.gui.GuiHandler;
Expand Down Expand Up @@ -165,6 +166,7 @@ public class TreasureBlocks {
public static final Block FALLING_GRASS;
public static final Block FALLING_SAND;
public static final Block FALLING_RED_SAND;
public static final Block BLACKSTONE;

// treasures: paintings
public static final AbstractPaintingBlock PAINTING_BLOCKS_BRICKS;
Expand Down Expand Up @@ -492,6 +494,7 @@ public class TreasureBlocks {
FALLING_GRASS = new FallingGrassBlock(Treasure.MODID, TreasureConfig.FALLING_GRASS_ID);
FALLING_SAND = new FallingSandBlock(Treasure.MODID, TreasureConfig.FALLING_SAND_ID);
FALLING_RED_SAND = new FallingRedSandBlock(Treasure.MODID, TreasureConfig.FALLING_RED_SAND_ID);
BLACKSTONE = new BlackstoneBlock(Treasure.MODID, TreasureConfig.BLACKSTONE_ID);

// treasures: paintings
AxisAlignedBB[] pbs = new AxisAlignedBB[4];
Expand Down Expand Up @@ -563,7 +566,8 @@ public static void registerBlocks(final RegistryEvent.Register<Block> event) {
PAINTING_BLOCKS_WOOD, SAPPHIRE_ORE, RUBY_ORE,
FALLING_GRASS,
FALLING_SAND,
FALLING_RED_SAND
FALLING_RED_SAND,
BLACKSTONE
};

registry.registerAll(blocks);
Expand Down Expand Up @@ -626,7 +630,8 @@ public static void registerItemBlocks(final RegistryEvent.Register<Item> event)
new ItemBlock(PROXIMITY_SPAWNER),
new ItemBlock(FALLING_GRASS),
new ItemBlock(FALLING_SAND),
new ItemBlock(FALLING_RED_SAND)
new ItemBlock(FALLING_RED_SAND),
new ItemBlock(BLACKSTONE)
};

for (final ItemBlock item : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.someguyssoftware.treasure2.enums.Rarity;
import com.someguyssoftware.treasure2.printer.ChestNBTPrettyPrinter;
import com.someguyssoftware.treasure2.tileentity.AbstractTreasureChestTileEntity;
import com.someguyssoftware.treasure2.tileentity.ITreasureChestTileEntity;

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -56,7 +57,7 @@ public class TreasureChestBlock extends AbstractChestBlock {
* @param te
* @param type
*/
public TreasureChestBlock(String modID, String name, Class<? extends AbstractTreasureChestTileEntity> te,
public TreasureChestBlock(String modID, String name, Class<? extends ITreasureChestTileEntity> te,
TreasureChestType type, Rarity rarity) {
this(modID, name, Material.WOOD, te, type, rarity);
}
Expand All @@ -70,7 +71,7 @@ public TreasureChestBlock(String modID, String name, Class<? extends AbstractTre
* @param type
*/
public TreasureChestBlock(String modID, String name, Material material,
Class<? extends AbstractTreasureChestTileEntity> te, TreasureChestType type, Rarity rarity) {
Class<? extends ITreasureChestTileEntity> te, TreasureChestType type, Rarity rarity) {
super(modID, name, material, te, type, rarity);
}

Expand Down Expand Up @@ -120,7 +121,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti
oldPersistedChestDirection = Direction.fromFacing(EnumFacing.getFront(tcte.getFacing()));

// dump stack NBT
if (Treasure.logger.isDebugEnabled()) {
if (Treasure.logger.isDebugEnabled() && WorldInfo.isServerSide(worldIn)) {
dump(stack.getTagCompound(), new Coords(pos), "STACK ITEM -> CHEST NBT");
}
}
Expand Down
Loading

0 comments on commit 24bfab5

Please sign in to comment.