Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
update for 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Jan 11, 2023
1 parent da5aad3 commit b878230
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 104 deletions.
15 changes: 6 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,18 @@ repositories {
name "CurseForge"
url "https://www.cursemaven.com"
}
maven {
name "CraftTweaker"
url "https://maven.blamejared.com"
}
}

dependencies {

// Hard-Deps
deobfCompile "curse.maven:gregtech-ce-unofficial-557242:3949406"
deobfCompile "curse.maven:gregtech-ce-unofficial-557242:4325257"
deobfCompile "curse.maven:codechicken-lib-1-8-242818:2779848"
deobfCompile "curse.maven:mixin-booter-419286:3321174"
deobfCompile "curse.maven:mixin-booter-419286:4090558"

// Useful stuff
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.554"
compile "curse.maven:crafttweaker-239197:3935788"
deobfCompile "curse.maven:groovyscript-687577:4286298"
deobfCompile "curse.maven:jei-238222:3040523"
deobfCompile "curse.maven:jeid-296289:2919737"
runtime "curse.maven:the-one-probe-245211:2667280"
Expand All @@ -66,8 +63,8 @@ dependencies {
deobfCompile "curse.maven:ex-nihilo-creatio-274456:2817545"
deobfCompile "curse.maven:opencomputers-223008:2828357"
deobfCompile "curse.maven:tfcraft-302973:3268988"
deobfCompile "curse.maven:ae2-extended-life-570458:3632074"
deobfProvided "curse.maven:gregtech-food-option-477021:4023986"
deobfCompile "curse.maven:ae2-extended-life-570458:4323863"
deobfProvided "curse.maven:gregtech-food-option-477021:4325343"

// May get some form of compatibility in the future
//deobfCompile "curse.maven:mcjtylib-233105:2745846"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.enderio.core.common.interfaces;

import net.minecraft.item.ItemStack;

import javax.annotation.Nonnull;

public interface IOverlayRenderAware {

public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);

}
9 changes: 0 additions & 9 deletions src/main/java/gregification/base/BaseModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import gregtech.api.items.metaitem.MetaItem;
import gregtech.api.items.metaitem.StandardMetaItem;
import gregtech.common.items.MetaTool;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Module.Root(name = "Gregification: Base")
Expand All @@ -13,11 +12,6 @@ public class BaseModule implements Module {
// - Forestry Module: 0-999
public static MetaItem<?> baseMetaItem;

// Base MetaTool
// Current ID Ranges:
// - Forestry Module: 0-9
public static MetaTool baseMetaTool;

@Override
public boolean isModuleActive() {
return true;
Expand All @@ -27,8 +21,5 @@ public boolean isModuleActive() {
public void preInit(FMLPreInitializationEvent event) {
baseMetaItem = new StandardMetaItem();
baseMetaItem.setRegistryName("gf_meta_item");

baseMetaTool = new MetaTool() {@Override public void registerSubItems() {}};
baseMetaTool.setRegistryName("gf_meta_tool");
}
}
29 changes: 17 additions & 12 deletions src/main/java/gregification/modules/forestry/ForestryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
import gregification.modules.forestry.frames.GTFrameType;
import gregification.modules.forestry.frames.GTItemFrame;
import gregification.modules.forestry.recipes.*;
import gregification.modules.forestry.tools.ToolScoop;
import gregification.modules.forestry.tools.ScoopBehavior;
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.items.metaitem.MetaItem;
import gregtech.api.items.toolitem.ToolMetaItem;
import gregtech.api.items.toolitem.IGTTool;
import gregtech.api.items.toolitem.ItemGTTool;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.properties.OreProperty;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.common.items.ToolItems;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipe;
Expand Down Expand Up @@ -67,7 +70,7 @@ public class ForestryModule implements Module {
public static MetaItem<?>.MetaValueItem ELECTRODE_RUBBER;
public static MetaItem<?>.MetaValueItem ELECTRODE_TIN;

public static ToolMetaItem<?>.MetaToolValueItem SCOOP;
public static IGTTool SCOOP;

@Override
public boolean isModuleActive() {
Expand Down Expand Up @@ -96,6 +99,17 @@ public void preInit(FMLPreInitializationEvent event) {
logger.error("GT Frames is enabled, but Forestry Apiculture module is disabled. Skipping GT Frames...");
}
}

// Initialize GT Scoop
if (ForestryConfig.gtScoop) {
logger.info("Registering GT Scoop");
SCOOP = ToolItems.register(ItemGTTool.Builder.of(GTValues.MODID, "scoop")
.toolStats(b -> b
.cannotAttack().attackSpeed(-2.4F)
.behaviors(ScoopBehavior.INSTANCE))
.toolClasses("scoop")
.oreDict("toolScoop"));
}
}

@Override
Expand Down Expand Up @@ -179,15 +193,6 @@ public void registerItems(RegistryEvent.Register<Item> event) {
ELECTRODE_RUBBER = BaseModule.baseMetaItem.addItem(14, "electrode.rubber");
}
}

// Register GT Scoop
if (ForestryConfig.gtScoop) {
logger.info("Registering GT Scoop");
SCOOP = (ToolMetaItem<?>.MetaToolValueItem) BaseModule.baseMetaTool.addItem(1, "tool.scoop")
.setToolStats(new ToolScoop())
.setFullRepairCost(3)
.addOreDict("craftingToolScoop");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import gregification.modules.forestry.ForestryUtils;
import gregification.modules.forestry.bees.GTDropType;
import gregtech.api.GTValues;
import gregtech.api.recipes.ModHandler;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
Expand All @@ -22,6 +21,7 @@
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.unification.stack.UnificationEntry;
import gregtech.common.items.MetaItems;
import gregtech.loaders.recipe.handlers.ToolRecipeHandler;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -212,7 +212,7 @@ public static void init() {
}

private static void processScoop(OrePrefix prefix, Material material, ToolProperty property) {
ModHandler.addShapedRecipe(String.format("scoop_%s", material), ForestryModule.SCOOP.getStackForm(material),
ToolRecipeHandler.addToolRecipe(material, ForestryModule.SCOOP, false,
"SWS", "SSS", "xSh",
'S', new UnificationEntry(OrePrefix.stick, material),
'W', new ItemStack(Blocks.WOOL, 1, GTValues.W));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,45 @@
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IEntityButterfly;
import gregification.base.ModIDs;
import gregtech.api.items.metaitem.stats.IItemBehaviour;
import gregtech.api.util.GTUtility;
import gregtech.api.items.toolitem.behavior.IToolBehavior;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Loader;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class ScoopBehavior implements IItemBehaviour {
public class ScoopBehavior implements IToolBehavior {

private final int cost;
public static final ScoopBehavior INSTANCE = new ScoopBehavior();

public ScoopBehavior(int cost) {
this.cost = cost;
}
private ScoopBehavior() {/**/}

@Override
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer player, Entity entity) {
return Loader.isModLoaded(ModIDs.MODID_FR) && processButterflyCatch(itemStack, player, entity);
}

private boolean processButterflyCatch(ItemStack itemStack, EntityPlayer player, Entity entity) {
if (entity instanceof IEntityButterfly) {
if (player.world.isRemote) {
return true;
}
if (player.capabilities.isCreativeMode || GTUtility.doDamageItem(itemStack, this.cost, false)) {
IEntityButterfly butterfly = (IEntityButterfly) entity;
IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary();
species.getRoot().getBreedingTracker(entity.world, player.getGameProfile()).registerCatch(butterfly.getButterfly());
player.world.spawnEntity(new EntityItem(player.world, entity.posX, entity.posY, entity.posZ,
species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY)));
entity.setDead();
}
return true;
}
return false;
public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) {
if (!Loader.isModLoaded(ModIDs.MODID_FR)) return;
if (!(target instanceof IEntityButterfly)) return;
if (!(attacker instanceof EntityPlayer)) return;
if (attacker.world == null || attacker.world.isRemote) return;

IEntityButterfly butterfly = (IEntityButterfly) target;
EntityPlayer player = (EntityPlayer) attacker;

IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary();
species.getRoot().getBreedingTracker(target.world, player.getGameProfile()).registerCatch(butterfly.getButterfly());
player.world.spawnEntity(new EntityItem(player.world, target.posX, target.posY, target.posZ,
species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY)));
target.setDead();
}

@Override
public void addInformation(ItemStack itemStack, List<String> lines) {
lines.add(I18n.format("behaviour.scoop"));
public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flag) {
tooltip.add(I18n.format("item.gt.tool.behavior.scoop"));
}
}
36 changes: 0 additions & 36 deletions src/main/java/gregification/modules/forestry/tools/ToolScoop.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/assets/gregification/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,5 @@ item.gt.honey_drop.lapis.name=Lapis Coolant Drop
item.gt.honey_drop.biomass.name=Biomass Drop
item.gt.honey_drop.ethanol.name=Ethanol Drop

metaitem.tool.scoop.name=%s Scoop
behaviour.scoop=Catches Butterflies on Left-Click
item.gt.tool.scoop.name=%s Scoop
item.gt.tool.behavior.scoop=§dArborist: §fCatches Butterflies on Left-Click
3 changes: 1 addition & 2 deletions src/main/resources/assets/gregification/lang/ru_ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ metaitem.electrode.orchid.name=Орхидейный электрод
metaitem.electrode.rubber.name=Прорезиненный электрод
metaitem.electrode.tin.name=Оловянный электрод

metaitem.tool.scoop.name=%s совок
behaviour.scoop=Ловит бабочек на левый клик
item.gt.tool.scoop.name=%s совок
3 changes: 1 addition & 2 deletions src/main/resources/assets/gregification/lang/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ metaitem.electrode.orchid.name=兰花电子管元件
metaitem.electrode.rubber.name=橡胶电子管元件
metaitem.electrode.tin.name=锡电子管元件

metaitem.tool.scoop.name=%s捕虫网
behaviour.scoop=左键以捕捉蝴蝶
item.gt.tool.scoop.name=%s捕虫网

0 comments on commit b878230

Please sign in to comment.