mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
adding the config options from the tinkered constructor fork (#73)
* config option for invulnerability of dropped tools and base EntityItem despawn time * config option to drop life canisters on death * Added config option for dagger damage multiplier when thrown, default = 3x * emulate vanilla behavior by default --------- Co-authored-by: Alex Ponebshek <[email protected]>
This commit is contained in:
1 parent
531e33765e
commit
3e2ba6ac16
8 files changed
+66
-18
No files matched your search
@@ -6,8 +6,10 @@ import java.util.Random;
|
||||
import mantle.pulsar.config.ForgeCFG;
|
||||
import mantle.pulsar.control.PulseManager;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -58,6 +60,7 @@ import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkCheckHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -182,6 +185,8 @@ public class TConstruct {
|
||||
MinecraftForge.EVENT_BUS.register(playerTracker);
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(TConstruct.instance, proxy);
|
||||
|
||||
if (PHConstruct.globalDespawn != 6000) MinecraftForge.EVENT_BUS.register(new Spawntercepter());
|
||||
|
||||
pulsar.preInit(event);
|
||||
|
||||
if (PHConstruct.achievementsEnabled) {
|
||||
@@ -276,4 +281,19 @@ public class TConstruct {
|
||||
if (mapping.name.equals("TConstruct:TankAir")) mapping.ignore();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Spawntercepter {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntitySpawn(EntityJoinWorldEvent event) {
|
||||
// return if config is zero to keep vanilla functionality
|
||||
if (PHConstruct.globalDespawn == 0) return;
|
||||
if (event.entity instanceof EntityItem) {
|
||||
EntityItem ourGuy = (EntityItem) event.entity;
|
||||
if (ourGuy.lifespan == 6000) {
|
||||
ourGuy.lifespan = PHConstruct.globalDespawn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user