Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 2.6.4
- Re: Improve the VOM UI [#351](https://github.com/GTModpackTeam/GTExpert-Core/pull/351)
- The AwakenedFusion category is hidden [#352](https://github.com/GTModpackTeam/GTExpert-Core/pull/352)
- Add JER Integration [#353](https://github.com/GTModpackTeam/GTExpert-Core/pull/353)

* * *

Expand Down
1 change: 1 addition & 0 deletions buildscript.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ debug_deda = false
debug_avaritia = false
debug_chisel = false
debug_gtfo = false
debug_jer = false

# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
Expand Down
6 changes: 6 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ dependencies {
runtimeOnly rfg.deobf("curse.maven:gregtech-food-option-477021:6472136")
}

// Debug JER: 0.9.2.60
compileOnly "curse.maven:just-enough-resources-jer-240630:2728585"
if (project.debug_all.toBoolean() || project.debug_jer.toBoolean()) {
runtimeOnly "curse.maven:just-enough-resources-jer-240630:2728585"
}
Comment thread
tier940 marked this conversation as resolved.
Outdated

// Boot error fix
if (project.debug_all.toBoolean() || project.debug_eio.toBoolean()) {
runtimeOnly files("libs/EnderCore-1.12.2-0.5.78-core.jar")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/github/gtexpert/core/api/util/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public enum Mods {
InventoryTweaks(Names.INVENTORY_TWEAKS),
JourneyMap(Names.JOURNEY_MAP),
JustEnoughItems(Names.JUST_ENOUGH_ITEMS),
JustEnoughResources(Names.JUST_ENOUGH_RESOURCES),
ModularUI(Names.MODULRAUI),
MixinBooter(Names.MIXINBOOTER),
NeevesAE2(Names.NEEVES_AE2),
Expand Down Expand Up @@ -128,6 +129,7 @@ public static class Names {
public static final String INVENTORY_TWEAKS = "inventorytweaks";
public static final String JOURNEY_MAP = "journeymap";
public static final String JUST_ENOUGH_ITEMS = "jei";
public static final String JUST_ENOUGH_RESOURCES = "jeresources";
public static final String MODULRAUI = "modularui";
public static final String MIXINBOOTER = "mixinbooter";
public static final String NEEVES_AE2 = "nae2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
Expand All @@ -13,6 +20,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
Expand All @@ -25,6 +33,7 @@

import com.github.gtexpert.core.api.GTEValues;
import com.github.gtexpert.core.api.unification.material.GTEMaterials;
import com.github.gtexpert.core.api.util.Mods;
import com.github.gtexpert.core.common.items.GTEMetaItems;

@Mod.EventBusSubscriber(modid = GTEValues.MODID)
Expand Down Expand Up @@ -86,4 +95,36 @@ public static void onEntityLivingFallEvent(@NotNull LivingFallEvent event) {
}
}
}

@SubscribeEvent
public static void onLivingDrops(@NotNull LivingDropsEvent event) {
if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) {
return;
}

EntityLivingBase entity = event.getEntityLiving();
if (entity.world.rand.nextFloat() >= 0.025F) {
return;
}

ItemStack drop = getSkullDrop(entity);
if (!drop.isEmpty()) {
event.getDrops().add(new EntityItem(entity.world, entity.posX, entity.posY, entity.posZ, drop));
}
}

private static ItemStack getSkullDrop(EntityLivingBase entity) {
if (entity instanceof EntityCreeper) {
return new ItemStack(Items.SKULL, 1, 4);
} else if (entity instanceof EntitySkeleton) {
return new ItemStack(Items.SKULL, 1, 0);
} else if (entity instanceof EntityZombie) {
return new ItemStack(Items.SKULL, 1, 2);
} else if (entity instanceof EntityEnderman) {
if (Mods.EnderIO.isModLoaded()) {
return Mods.EnderIO.getItem("block_enderman_skull", 1, 0);
}
}
return ItemStack.EMPTY;
}
Comment thread
tier940 marked this conversation as resolved.
Comment thread
tier940 marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.gtexpert.core.integration.jer;

import net.minecraftforge.common.config.Config;

import com.github.gtexpert.core.api.GTEValues;
import com.github.gtexpert.core.modules.GTEModules;

@Config.LangKey(GTEValues.MODID + ".config.integration.jer")
@Config(modid = GTEValues.MODID,
name = GTEValues.MODID + "/integration/" + GTEModules.MODULE_JER,
category = "JustEnoughResources")
public class JERConfigHolder {}
117 changes: 117 additions & 0 deletions src/main/java/com/github/gtexpert/core/integration/jer/JERModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package com.github.gtexpert.core.integration.jer;

import java.util.List;

import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootEntryItem;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraft.world.storage.loot.RandomValueRange;
import net.minecraft.world.storage.loot.conditions.KilledByPlayer;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.conditions.RandomChance;
import net.minecraft.world.storage.loot.functions.LootFunction;
import net.minecraft.world.storage.loot.functions.SetMetadata;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import org.jetbrains.annotations.NotNull;

import com.google.common.collect.ImmutableList;

import com.github.gtexpert.core.api.GTEValues;
import com.github.gtexpert.core.api.modules.GTEModule;
import com.github.gtexpert.core.api.util.Mods;
import com.github.gtexpert.core.integration.GTEIntegrationSubmodule;
import com.github.gtexpert.core.modules.GTEModules;

@GTEModule(
moduleID = GTEModules.MODULE_JER,
containerID = GTEValues.MODID,
modDependencies = Mods.Names.JUST_ENOUGH_RESOURCES,
name = "GTExpert JER Integration",
description = "Just Enough Resources Integration Module")
public class JERModule extends GTEIntegrationSubmodule {

private static final float SKULL_DROP_CHANCE = 0.025F;
private static final String POOL_NAME = "gtexpert_skull_drops";

@NotNull
@Override
public List<Class<?>> getEventBusSubscribers() {
return ImmutableList.of(JERModule.class);
}

@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
ResourceLocation name = event.getName();

if (name.equals(LootTableList.ENTITIES_CREEPER)) {
addSkullDrop(event, 4); // Creeper Head
} else if (name.equals(LootTableList.ENTITIES_SKELETON)) {
addSkullDrop(event, 0); // Skeleton Skull
} else if (name.equals(LootTableList.ENTITIES_ZOMBIE)) {
addSkullDrop(event, 2); // Zombie Head
} else if (name.equals(LootTableList.ENTITIES_ENDERMAN) && Mods.EnderIO.isModLoaded()) {
addEndermanSkullDrop(event);
}
}

private static void addSkullDrop(LootTableLoadEvent event, int meta) {
LootCondition[] conditions = new LootCondition[] {
new KilledByPlayer(false),
new RandomChance(SKULL_DROP_CHANCE)
};

LootFunction[] functions = new LootFunction[] {
new SetMetadata(new LootCondition[0], new RandomValueRange(meta))
};

LootEntry entry = new LootEntryItem(
Items.SKULL,
1,
0,
functions,
conditions,
GTEValues.MODID + ":skull_drop");

LootPool pool = new LootPool(
new LootEntry[] { entry },
new LootCondition[0],
new RandomValueRange(1),
new RandomValueRange(0),
POOL_NAME);

event.getTable().addPool(pool);
}

private static void addEndermanSkullDrop(LootTableLoadEvent event) {
ItemStack endermanSkull = Mods.EnderIO.getItem("block_enderman_skull", 1, 0);
if (endermanSkull.isEmpty()) return;

LootCondition[] conditions = new LootCondition[] {
new KilledByPlayer(false),
new RandomChance(SKULL_DROP_CHANCE)
};

LootEntry entry = new LootEntryItem(
endermanSkull.getItem(),
1,
0,
new LootFunction[0],
conditions,
GTEValues.MODID + ":enderman_skull_drop");

LootPool pool = new LootPool(
new LootEntry[] { entry },
new LootCondition[0],
new RandomValueRange(1),
new RandomValueRange(0),
POOL_NAME);

event.getTable().addPool(pool);
}
Comment thread
tier940 marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class GTEModules implements IModuleContainer {
// Integration modules
public static final String MODULE_JEI = "jei_integration";
public static final String MODULE_TOP = "top_integration";
public static final String MODULE_JER = "jer_integration";
public static final String MODULE_CT = "ct_integration";
public static final String MODULE_FFM = "ffm_integration";
public static final String MODULE_GENDUSTRY = "gendustry_integration";
Expand Down