Skip to content

Commit

Permalink
Re-adding some stuff from 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bculkin2442 committed Feb 21, 2014
1 parent f217267 commit fa0644d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 37 deletions.
5 changes: 3 additions & 2 deletions src/main/java/tconstruct/TConstruct.java
Expand Up @@ -19,6 +19,7 @@
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.plugins.PluginController;
import tconstruct.util.EnvironmentChecks;
import tconstruct.util.TCraftingHandler;
import tconstruct.util.TEventHandler;
import tconstruct.util.TEventHandlerAchievement;
import tconstruct.util.config.DimensionBlacklist;
Expand Down Expand Up @@ -85,7 +86,7 @@ public class TConstruct
public TConstruct()
{

// logger.setParent(FMLCommonHandler.instance().getFMLLogger());
//logger.setParent(FMLCommonHandler.instance().getFMLLogger());
if (Loader.isModLoaded("Natura"))
{
logger.info("Natura, what are we going to do tomorrow night?");
Expand Down Expand Up @@ -132,7 +133,7 @@ public void preInit (FMLPreInitializationEvent event)
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator(), 0);
MinecraftForge.TERRAIN_GEN_BUS.register(new TerrainGenEventHandler());
GameRegistry.registerFuelHandler(content);
// GameRegistry.registerCraftingHandler(new TCraftingHandler());
MinecraftForge.EVENT_BUS.register(new TCraftingHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

if (PHConstruct.addToVillages)
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/tconstruct/common/TProxyCommon.java
Expand Up @@ -100,10 +100,9 @@ public void addNames ()
// As of 1.6.x, this is now handled by Minecraft itself for the most
// part.

LanguageRegistry.addName(TRepo.potionLauncher, "Potion Launcher");
LanguageRegistry.addName(TRepo.knapsack, "Knapsack");
//LanguageRegistry.addName(TRepo.potionLauncher, "Potion Launcher");
//LanguageRegistry.addName(TRepo.knapsack, "Knapsack");

LanguageRegistry.addName(TRepo.meatBlock, "Hambone");
}

public void readManuals ()
Expand Down
81 changes: 49 additions & 32 deletions src/main/java/tconstruct/util/TEventHandler.java
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
Expand All @@ -33,6 +34,7 @@
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
Expand All @@ -56,6 +58,7 @@
import tconstruct.library.tools.ToolCore;
import tconstruct.library.tools.Weapon;
import tconstruct.util.config.PHConstruct;
import tconstruct.util.player.ArmorExtended;
import tconstruct.util.player.TPlayerStats;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.Event.Result;
Expand Down Expand Up @@ -288,20 +291,21 @@ public void onLivingDrop (LivingDropsEvent event)
event.drops.add(entityitem);
}

// if
// (event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
// {
if (!event.entityLiving.isChild())
if (!event.entityLiving.isChild() && event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
{
/*
* if (event.entityLiving.getClass() == EntityCow.class) { int
* amount = random.nextInt(3) + random.nextInt(1 +
* event.lootingLevel) + random.nextInt(3) + random.nextInt(1 +
* event.lootingLevel) + 1;
*
* for (int iter = 0; iter < amount; ++iter) { addDrops(event, new
* ItemStack(Item.leather, 1)); } }
*/

if (event.entityLiving.getClass() == EntityCow.class)
{
int amount = random.nextInt(3) + random.nextInt(1 +
event.lootingLevel) + random.nextInt(3) + random.nextInt(1 +
event.lootingLevel) + 1;

for (int iter = 0; iter < amount; ++iter)
{
addDrops(event, new ItemStack(Items.leather, 1));
}
}


if (event.entityLiving.getClass() == EntityChicken.class)
{
Expand Down Expand Up @@ -360,12 +364,13 @@ public void onLivingDrop (LivingDropsEvent event)
addDrops(event, new ItemStack(Items.skull, 1, 2));
}
}
/*
* if (stack.getItem() == TRepo.breakerBlade &&
* random.nextInt(100) < 10) //Swap out for real beheading {
* addDrops(event, new ItemStack(Item.skull.itemID, 1, 2));
* }
*/

if (stack.getItem() == TRepo.cleaver &&
random.nextInt(100) < 10) //Swap out for real beheading
{
addDrops(event, new ItemStack(Items.skull, 1, 2));
}

}
}

Expand Down Expand Up @@ -608,19 +613,31 @@ public void bucketFill (FillBucketEvent evt)
}

// TODO 1.7 Fix this -- for ticking stuffs in extra armor slots
/*
* @SubscribeEvent public void livingUpdate (LivingUpdateEvent event) { if
* (event.entityLiving instanceof EntityPlayer) { EntityPlayer player =
* (EntityPlayer) event.entityLiving; TPlayerStats stats =
* TConstruct.playerTracker.getPlayerStats(player.getDisplayName());
*
* if (stats != null) { ArmorExtended armor = stats.armor; for (int i = 0; i
* < armor.getSizeInventory(); i++) { if (armor.getStackInSlot(i) != null) {
* armor.getStackInSlot(i).getItem().onUpdate(armor.getStackInSlot(i),
* player.worldObj, player, i, false);
* armor.getStackInSlot(i).getItem().onArmorTick(player.worldObj, player,
* armor.getStackInSlot(i)); } } } } }
*/

@SubscribeEvent
public void livingUpdate (LivingUpdateEvent event)
{ if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.getDisplayName());

if (stats != null)
{
ArmorExtended armor = stats.armor;
for (int i = 0; i < armor.getSizeInventory(); i++)
{
if (armor.getStackInSlot(i) != null)
{
armor.getStackInSlot(i).getItem().onUpdate(armor.getStackInSlot(i),
player.worldObj, player, i, false);
armor.getStackInSlot(i).getItem().onArmorTick(player.worldObj, player,
armor.getStackInSlot(i));
}
}
}
}
}


// Player interact event - prevent breaking of tank air blocks in creative
@SubscribeEvent
Expand Down

0 comments on commit fa0644d

Please sign in to comment.