Update to support new forge registry system
This commit is contained in:
parent
c8dfcb3ba5
commit
ba644982fe
14 changed files with 43 additions and 49 deletions
|
@ -89,8 +89,8 @@ if (ENV.BUILD_NUMBER) {
|
|||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12-14.21.0.2342"
|
||||
mappings = "snapshot_20170621"
|
||||
version = "1.12-14.21.0.2359"
|
||||
mappings = "snapshot_20170624"
|
||||
replace "@MODVERSION@", project.version
|
||||
useDepAts = true
|
||||
runDir = "run"
|
||||
|
|
|
@ -81,9 +81,9 @@ public class BlockDigitalChest extends BlockMachineBase {
|
|||
}
|
||||
if (itemStack != ItemStack.EMPTY && itemStack.getCount() > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,9 +85,9 @@ public class BlockQuantumChest extends BlockMachineBase {
|
|||
}
|
||||
if (itemStack != ItemStack.EMPTY && itemStack.getCount() > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BlockRefinedIronFence extends BlockFence {
|
|||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2.0F);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
|
||||
//ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ public abstract class BlockTransformer extends BaseTileBlock {
|
|||
}
|
||||
if (itemStack != ItemStack.EMPTY && itemStack.getCount() > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class GuiAutoCrafting extends GuiBase {
|
|||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
recipeSlector.func_193957_d();
|
||||
recipeSlector.tick();
|
||||
}
|
||||
|
||||
public void renderItemStack(ItemStack stack, int x, int y) {
|
||||
|
@ -167,25 +167,25 @@ public class GuiAutoCrafting extends GuiBase {
|
|||
for (int i = 0; i < 9; i++) {
|
||||
dummyInv.setInventorySlotContents(i, ItemStack.EMPTY);
|
||||
}
|
||||
this.recipeSlector.func_191856_a(this.width, this.height, this.mc, false, this.inventorySlots, dummyInv);
|
||||
this.guiLeft = this.recipeSlector.func_193011_a(false, this.width, this.xSize);
|
||||
this.recipeSlector.init(this.width, this.height, this.mc, false, this.inventorySlots, dummyInv);
|
||||
this.guiLeft = this.recipeSlector.updateScreenPosition(false, this.width, this.xSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
if (showGui) {
|
||||
this.recipeSlector.func_191861_a(mouseX, mouseY, 0.1F);
|
||||
this.recipeSlector.render(mouseX, mouseY, 0.1F);
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
this.recipeSlector.func_191864_a(this.guiLeft, this.guiTop, false, partialTicks);
|
||||
this.recipeSlector.renderGhostRecipe(this.guiLeft, this.guiTop, false, partialTicks);
|
||||
} else {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
this.recipeSlector.func_191876_c(this.guiLeft, this.guiTop, mouseX, mouseY);
|
||||
this.recipeSlector.renderTooltip(this.guiLeft, this.guiTop, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
if (!this.recipeSlector.func_191862_a(mouseX, mouseY, mouseButton)) {
|
||||
if (!this.recipeSlector.mouseClicked(mouseX, mouseY, mouseButton)) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
int mX = mouseX - getGuiLeft();
|
||||
|
@ -199,7 +199,7 @@ public class GuiAutoCrafting extends GuiBase {
|
|||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
if (!this.recipeSlector.func_191859_a(typedChar, keyCode)) {
|
||||
if (!this.recipeSlector.keyPressed(typedChar, keyCode)) {
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
}
|
||||
|
@ -207,11 +207,11 @@ public class GuiAutoCrafting extends GuiBase {
|
|||
@Override
|
||||
protected void handleMouseClick(Slot slotIn, int slotId, int mouseButton, ClickType type) {
|
||||
super.handleMouseClick(slotIn, slotId, mouseButton, type);
|
||||
this.recipeSlector.func_191874_a(slotIn);
|
||||
this.recipeSlector.slotClicked(slotIn);
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
this.recipeSlector.func_191871_c();
|
||||
this.recipeSlector.removed();
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,16 +17,16 @@ public class GuiAutoCraftingRecipeSlector extends GuiRecipeBook {
|
|||
|
||||
|
||||
@Override
|
||||
public void func_193014_a(boolean p_193014_1_, InventoryCrafting p_193014_2_) {
|
||||
super.func_193014_a(p_193014_1_, p_193014_2_);
|
||||
public void initVisuals(boolean p_193014_1_, InventoryCrafting p_193014_2_) {
|
||||
super.initVisuals(p_193014_1_, p_193014_2_);
|
||||
//Pulls the button off the screen as we dont need it
|
||||
toggleRecipesBtn = new GuiButtonToggle(0, -1000, -1000, 26, 16, false);
|
||||
toggleRecipesBtn.func_191751_a(152, 41, 28, 18, RECIPE_BOOK);
|
||||
toggleRecipesBtn.initTextureValues(152, 41, 28, 18, RECIPE_BOOK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_191856_a(int p_191856_1_, int p_191856_2_, Minecraft mc, boolean p_191856_4_, Container p_191856_5_, InventoryCrafting p_191856_6_) {
|
||||
super.func_191856_a(p_191856_1_, p_191856_2_, mc, p_191856_4_, p_191856_5_, p_191856_6_);
|
||||
public void init(int p_191856_1_, int p_191856_2_, Minecraft mc, boolean p_191856_4_, Container p_191856_5_, InventoryCrafting p_191856_6_) {
|
||||
super.init(p_191856_1_, p_191856_2_, mc, p_191856_4_, p_191856_5_, p_191856_6_);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraft.item.crafting.IRecipe;
|
|||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
|
|
@ -28,8 +28,10 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.Core;
|
||||
|
@ -409,25 +411,14 @@ public class ModBlocks {
|
|||
|
||||
public static void registerBlock(Block block, String name) {
|
||||
name = name.toLowerCase();
|
||||
block.setRegistryName(ModInfo.MOD_ID, name);
|
||||
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
|
||||
GameRegistry.register(block);
|
||||
GameRegistry.register(new ItemBlock(block), block.getRegistryName());
|
||||
RebornRegistry.registerBlock(block, new ResourceLocation(ModInfo.MOD_ID, name));
|
||||
}
|
||||
|
||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name) {
|
||||
name = name.toLowerCase();
|
||||
block.setRegistryName(ModInfo.MOD_ID, name);
|
||||
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
|
||||
GameRegistry.register(block);
|
||||
try {
|
||||
ItemBlock itemBlock = itemclass.getConstructor(Block.class).newInstance(block);
|
||||
itemBlock.setRegistryName(ModInfo.MOD_ID, name);
|
||||
GameRegistry.register(itemBlock);
|
||||
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
RebornRegistry.registerBlock(block, itemclass, new ResourceLocation(ModInfo.MOD_ID, name));
|
||||
}
|
||||
|
||||
public static void registerOreDict() {
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.item.ItemBlock;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.api.fuel.FluidPowerManager;
|
||||
import techreborn.blocks.fluid.BlockFluidBase;
|
||||
import techreborn.blocks.fluid.BlockFluidTechReborn;
|
||||
|
@ -323,8 +324,6 @@ public class ModFluids {
|
|||
}
|
||||
|
||||
public static void registerBlock(Block block, String name) {
|
||||
block.setRegistryName(name);
|
||||
GameRegistry.register(block);
|
||||
GameRegistry.register(new ItemBlock(block), block.getRegistryName());
|
||||
RebornRegistry.registerBlock(block, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -349,7 +350,7 @@ public class ModItems {
|
|||
|
||||
public static void registerItem(Item item, String name) {
|
||||
item.setRegistryName(name);
|
||||
GameRegistry.register(item);
|
||||
RebornRegistry.registerItem(item);
|
||||
if (item.getClass().isInstance(IEnergyItemInfo.class)) {
|
||||
if (!item.getClass().isInstance(IEnergyInterfaceItem.class)) {
|
||||
Core.logHelper.error(name + " was not patched with the power mixin. This is a error, the item may not work as intended.");
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.init;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
|
||||
/**
|
||||
* Created by Mark on 20/03/2016.
|
||||
|
@ -45,7 +46,9 @@ public class ModSounds {
|
|||
|
||||
private static SoundEvent getSound(String str) {
|
||||
ResourceLocation resourceLocation = new ResourceLocation("techreborn", str);
|
||||
return GameRegistry.register(new SoundEvent(resourceLocation).setRegistryName(resourceLocation));
|
||||
SoundEvent soundEvent = new SoundEvent(resourceLocation);
|
||||
soundEvent.setRegistryName(resourceLocation);
|
||||
return GameData.register_impl(soundEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -144,8 +144,8 @@ public class ItemWrench extends ItemTR {
|
|||
if (itemStack.getCount() > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
|
||||
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)) {
|
||||
if (!(((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid)
|
||||
|| !(((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid)) {
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ModInfo implements IModInfo {
|
|||
public static final String MOD_NAME = "Tech Reborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:forge;required-after:reborncore;after:jei@[3.13,);after:ic2";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:forge@[14.21.0.2359,);required-after:reborncore;after:jei@[4.7,);after:ic2";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
|
|
Loading…
Reference in a new issue