Skip to content

Commit

Permalink
Updoot to 1.12 🎺🎺
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed committed Jul 15, 2017
1 parent 86e878f commit 72d615e
Show file tree
Hide file tree
Showing 18 changed files with 185 additions and 204 deletions.
59 changes: 47 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 William Thompson (unascribed)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

buildscript {
repositories {
mavenCentral()
Expand All @@ -15,24 +39,41 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'me.tatarka:gradle-retrolambda:3.2.0'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.sf.proguard:proguard-gradle:5.3.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath 'gradle.plugin.net.minecrell:licenser:0.3'
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'me.tatarka.retrolambda'

apply from: 'project.gradle'

println("Elytra Project Skeleton v1.0.1")
if (project.ext.useElytraVersionFormat) {
def branch;
if (System.env.BRANCH_NAME) {
// Jenkins support
branch = System.env.BRANCH_NAME;
branch = branch.substring(branch.lastIndexOf('/')+1);
} else {
branch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.trim();
}
if (branch == "HEAD") {
branch = 'git rev-parse --short HEAD'.execute().in.text.trim();
}
def commits = 'git rev-list --count HEAD'.execute().in.text.trim();
def dirty = !'git diff-index HEAD'.execute().in.text.trim().isEmpty();
version = branch+'-'+project.ext.version+'.'+commits+(dirty ? '-dirty' : '');
} else {
version = project.ext.version;
}

println("Elytra Project Skeleton v1.1.0")
println("https://github.com/elytra/skel")
println()
println("Project Name: "+project.ext.projectName)
println("Version: "+project.ext.version)
println("Version: "+version)
println()
println("Package: "+project.ext.package)
println()
Expand All @@ -44,18 +85,12 @@ println("Mappings: "+project.ext.mappings)

project.ext.priv = parseConfig(file('private.properties'))

group = "com.elytradev"
group = project.ext.group
archivesBaseName = project.ext.projectName
version = project.ext.version

sourceCompatibility = 1.8
targetCompatibility = 1.8

retrolambda {
javaVersion JavaVersion.VERSION_1_6
defaultMethods true
}

repositories {
jcenter()
mavenCentral()
Expand Down
17 changes: 8 additions & 9 deletions project.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
ext.group = 'com.elytradev'
ext.package = 'com.elytradev.glasshearts'
ext.projectName = 'GlassHearts'
ext.version = '1.11.2-1.0.1'
ext.version = '1.0'
ext.useElytraVersionFormat = true

// 0.2.1 is the earliest Concrete version supported by the skeleton.
ext.concreteVersion = '0.2.1'
ext.concreteVersion = '0.3.2-SNAPSHOT'
ext.concreteModules = [ 'common', 'network', 'reflect' ]

ext.forge = '1.11.2-13.20.0.2282'
ext.mappings = 'snapshot_20170205'
ext.forge = '1.12-14.21.1.2413'
ext.mappings = 'snapshot_20170715'

ext.enforceLicenseHeaders = false

Expand All @@ -22,11 +24,8 @@ repositories {
}

dependencies {
compile 'mezz.jei:jei_1.11.2:4.2.6.235:api'
runtime 'mezz.jei:jei_1.11.2:4.2.6.235'

deobfCompile 'slimeknights.mantle:Mantle:1.11.2-1.2.0.27'
deobfCompile 'slimeknights:TConstruct:1.11.2-2.7.0.9'
compile 'mezz.jei:jei_1.12:4.7.2.76:api'
runtime 'mezz.jei:jei_1.12:4.7.2.76'
}

tasks.runServer.outputs.upToDateWhen { false }
122 changes: 71 additions & 51 deletions src/main/java/com/elytradev/glasshearts/GlassHearts.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
Expand All @@ -29,7 +30,6 @@
import com.elytradev.glasshearts.enums.EnumGemState;
import com.elytradev.glasshearts.gem.Gem;
import com.elytradev.glasshearts.init.Gems;
import com.elytradev.glasshearts.integration.tcon.TConIntegration;
import com.elytradev.glasshearts.item.ItemBlockGlassHeart;
import com.elytradev.glasshearts.item.ItemBlockOre;
import com.elytradev.glasshearts.item.ItemGem;
Expand All @@ -52,8 +52,11 @@
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
Expand All @@ -67,6 +70,7 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemGlassBottle;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -104,7 +108,6 @@
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.Mod.EventHandler;
Expand Down Expand Up @@ -195,11 +198,11 @@ public ItemStack getTabIconItem() {
}
};

private Invoker rayTrace = Invokers.findMethod(Item.class, null, new String[] {"func_77621_a", "rayTrace", "a"}, World.class, EntityPlayer.class, boolean.class);
private Invoker applyArmorCalculations = Invokers.findMethod(EntityLivingBase.class, null, new String[] { "func_70655_b", "applyArmorCalculations", "b" }, DamageSource.class, float.class);
private Invoker applyPotionDamageCalculations = Invokers.findMethod(EntityLivingBase.class, null, new String[] { "func_70672_c", "applyPotionDamageCalculations", "c" }, DamageSource.class, float.class);
private Invoker rayTrace = Invokers.findMethod(Item.class, "rayTrace", "func_77621_a", World.class, EntityPlayer.class, boolean.class);
private Invoker applyArmorCalculations = Invokers.findMethod(EntityLivingBase.class, "applyArmorCalculations", "func_70655_b", DamageSource.class, float.class);
private Invoker applyPotionDamageCalculations = Invokers.findMethod(EntityLivingBase.class, "applyPotionDamageCalculations", "func_70672_c", DamageSource.class, float.class);

private Invoker explode = Invokers.findMethod(EntityCreeper.class, null, new String[] { "func_146077_cc", "explode", "dn" });
private Invoker explode = Invokers.findMethod(EntityCreeper.class, "explode", "func_146077_cc");

private Map<EntityPlayer, PlayerHandler> playerHandlers = new WeakHashMap<>();

Expand Down Expand Up @@ -293,85 +296,111 @@ public void onPreInit(FMLPreInitializationEvent e) {
LIFEFORCE.setViscosity(750);
FluidRegistry.registerFluid(LIFEFORCE);

LIFEFORCE_BLOCK = new BlockFluidLifeforce(LIFEFORCE, Material.WATER);
LIFEFORCE.setBlock(LIFEFORCE_BLOCK);

FluidRegistry.addBucketForFluid(LIFEFORCE);

LIFEFORCE_BLOCK.setRegistryName("lifeforce_block");
GameRegistry.register(LIFEFORCE_BLOCK);


GameRegistry.registerWorldGenerator(new GenerateGems(), 2);



GameRegistry.registerTileEntity(TileEntityGlassHeart.class, "glasshearts:glass_heart");

//if (Loader.isModLoaded("tconstruct")) {
// TConIntegration.init();
//}

proxy.onPreInit();
}

@SubscribeEvent
public void onRegisterEnchantments(RegistryEvent.Register<Enchantment> e) {
SAPPING = new EnchantmentSapping();
SAPPING.setRegistryName("sapping");
GameRegistry.register(SAPPING);

e.getRegistry().register(SAPPING);
}

@SubscribeEvent
public void onRegisterItems(RegistryEvent.Register<Item> e) {
LIFEFORCE_BOTTLE = new ItemLifeforceBottle();
LIFEFORCE_BOTTLE.setRegistryName("lifeforce_bottle");
LIFEFORCE_BOTTLE.setCreativeTab(CREATIVE_TAB);
GameRegistry.register(LIFEFORCE_BOTTLE);
e.getRegistry().register(LIFEFORCE_BOTTLE);

GEM = new ItemGem();
GEM.setRegistryName("gem");
GEM.setCreativeTab(CREATIVE_TAB);
GameRegistry.register(GEM);

for (int i = 0; i < EnumGemOre.VALUES.length; i++) {
EnumGemOre gem = EnumGemOre.VALUES[i];
OreDictionary.registerOre("gem"+gem.name().charAt(0)+gem.getName().substring(1), new ItemStack(GEM, 1, i));
}
e.getRegistry().register(GEM);

STAFF = new ItemStaff();
STAFF.setRegistryName("staff");
STAFF.setCreativeTab(CREATIVE_TAB);
GameRegistry.register(STAFF);
e.getRegistry().register(STAFF);

e.getRegistry().register(new ItemBlockGlassHeart(GLASS_HEART).setRegistryName("glass_heart"));
e.getRegistry().register(new ItemBlockOre(ORE).setRegistryName("ore"));
e.getRegistry().register(new ItemBlock(PETRIFIED_LOG).setRegistryName("petrified_log"));

for (int i = 0; i < EnumGemOre.VALUES.length; i++) {
EnumGemOre gem = EnumGemOre.VALUES[i];
OreDictionary.registerOre("gem"+gem.name().charAt(0)+gem.getName().substring(1), new ItemStack(GEM, 1, i));
}
}

@SubscribeEvent
public void onRegisterBlocks(RegistryEvent.Register<Block> e) {
GLASS_HEART = new BlockGlassHeart();
GLASS_HEART.setRegistryName("glass_heart");
GLASS_HEART.setCreativeTab(CREATIVE_TAB);
GLASS_HEART.setUnlocalizedName("glasshearts.glass_heart");
GameRegistry.register(GLASS_HEART);
GameRegistry.register(new ItemBlockGlassHeart(GLASS_HEART).setRegistryName("glass_heart"));
e.getRegistry().register(GLASS_HEART);

ORE = new BlockOre();
ORE.setRegistryName("ore");
ORE.setCreativeTab(CREATIVE_TAB);
ORE.setUnlocalizedName("glasshearts.ore");
GameRegistry.register(ORE);
GameRegistry.register(new ItemBlockOre(ORE).setRegistryName("ore"));
e.getRegistry().register(ORE);

PETRIFIED_LOG = new BlockPetrifiedLog();
PETRIFIED_LOG.setRegistryName("petrified_log");
PETRIFIED_LOG.setCreativeTab(CREATIVE_TAB);
PETRIFIED_LOG.setUnlocalizedName("glasshearts.petrified_log");
GameRegistry.register(PETRIFIED_LOG);
GameRegistry.register(new ItemBlock(PETRIFIED_LOG).setRegistryName("petrified_log"));
e.getRegistry().register(PETRIFIED_LOG);

LIFEFORCE_BLOCK = new BlockFluidLifeforce(LIFEFORCE, Material.WATER);
LIFEFORCE.setBlock(LIFEFORCE_BLOCK);

LIFEFORCE_BLOCK.setRegistryName("lifeforce_block");
e.getRegistry().register(LIFEFORCE_BLOCK);
}

@SubscribeEvent
public void onRegisterSounds(RegistryEvent.Register<SoundEvent> e) {
SAP = new SoundEvent(new ResourceLocation("glasshearts", "sap"));
SAP.setRegistryName("sap");
GameRegistry.register(SAP);
e.getRegistry().register(SAP);

ATTUNE = new SoundEvent(new ResourceLocation("glasshearts", "attune"));
ATTUNE.setRegistryName("attune");
GameRegistry.register(ATTUNE);
GameRegistry.registerWorldGenerator(new GenerateGems(), 2);
GameRegistry.addRecipe(new ShapedOreRecipe(STAFF,
e.getRegistry().register(ATTUNE);
}

@SubscribeEvent
public void onRegisterRecipes(RegistryEvent.Register<IRecipe> e) {
e.getRegistry().register(new ShapedOreRecipe(null, STAFF,
" o",
" //",
"/ ",

'/', Items.BLAZE_ROD,
'o', "gemOpal"));
'o', "gemOpal").setRegistryName("opal_staff"));

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(GLASS_HEART, 1, 0),
e.getRegistry().register(new ShapedOreRecipe(null, new ItemStack(GLASS_HEART, 1, 0),
"g g",
"ggg",
" g ",

'g', "blockGlassColorless"));
'g', "blockGlassColorless").setRegistryName("glass_heart"));

String[] dyes = {
"Black",
Expand All @@ -393,22 +422,13 @@ public void onPreInit(FMLPreInitializationEvent e) {
};

for (int i = 0; i < dyes.length; i++) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(GLASS_HEART, 1, 16-i),
e.getRegistry().register(new ShapedOreRecipe(null, new ItemStack(GLASS_HEART, 1, 16-i),
"g g",
"ggg",
" g ",

'g', "blockGlass"+dyes[i]));
'g', "blockGlass"+dyes[i]).setRegistryName(dyes[i].toLowerCase(Locale.ROOT)+"_glass_heart"));
}


GameRegistry.registerTileEntity(TileEntityGlassHeart.class, "glasshearts:glass_heart");

if (Loader.isModLoaded("tconstruct")) {
TConIntegration.init();
}

proxy.onPreInit();
}

@EventHandler
Expand Down Expand Up @@ -705,8 +725,8 @@ public void onJoinWorld(EntityJoinWorldEvent e) {
public void onDeath(LivingDeathEvent e) {
if (!e.getEntityLiving().world.isRemote) {
DamageSource src = e.getSource();
if (src.getEntity() instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer)src.getEntity();
if (src.getTrueSource() instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer)src.getTrueSource();
ItemStack held = p.getHeldItemMainhand();
if (configLifeforceFromPlayerKillsOnly) {
if (!(e.getEntityLiving() instanceof EntityPlayer)) return;
Expand Down Expand Up @@ -806,7 +826,7 @@ public static void sendUpdatePacket(TileEntity te, NBTTagCompound nbt) {
Chunk c = te.getWorld().getChunkFromBlockCoords(te.getPos());
SPacketUpdateTileEntity packet = new SPacketUpdateTileEntity(te.getPos(), te.getBlockMetadata(), nbt);
for (EntityPlayerMP player : te.getWorld().getPlayers(EntityPlayerMP.class, Predicates.alwaysTrue())) {
if (ws.getPlayerChunkMap().isPlayerWatchingChunk(player, c.xPosition, c.zPosition)) {
if (ws.getPlayerChunkMap().isPlayerWatchingChunk(player, c.x, c.z)) {
player.connection.sendPacket(packet);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ public TileEntity createTileEntity(World world, IBlockState state) {
return new TileEntityGlassHeart();
}


@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
for (int i = 0; i < 17; i++) {
list.add(new ItemStack(itemIn, 1, i));
list.add(new ItemStack(this, 1, i));
}
}

Expand Down
Loading

0 comments on commit 72d615e

Please sign in to comment.