Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from RenEvo/1.9
Browse files Browse the repository at this point in the history
Updated to minecraft 1.9
  • Loading branch information
renevo committed May 9, 2016
2 parents f2aeb60 + 0718fd5 commit 3ba6c3a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 58 deletions.
8 changes: 4 additions & 4 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_version=1.5.0
minecraft_version=1.8.9
forge_version=11.15.1.1722
mappings=snapshot_20151212
minecraft_version=1.9
forge_version=12.16.1.1896
mappings=snapshot_20160312

jei_version=2.26.0.154
jei_version=3.3.+
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Feb 15 11:56:05 PST 2016
#Mon May 09 14:58:23 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
2 changes: 1 addition & 1 deletion src/main/java/com/renevo/pcb/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.renevo.pcb;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;

public class ClientProxy extends CommonProxy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class ContainerPortableCraftBench extends net.minecraft.inventory.ContainerWorkbench {
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/renevo/pcb/GuiPortableCraftBench.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.renevo.pcb;

import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import org.lwjgl.opengl.GL11;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

public class GuiPortableCraftBench extends GuiContainer {
Expand All @@ -19,8 +18,8 @@ public GuiPortableCraftBench(InventoryPlayer playerInventory, World world, Block

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(StatCollector.translateToLocal(ItemPortableCraftBench.portableCraftBench.getUnlocalizedName() + ".name"), 8, 6, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocal(ItemPortableCraftBench.portableCraftBench.getUnlocalizedName() + ".name"), 8, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}

@Override
Expand Down
23 changes: 13 additions & 10 deletions src/main/java/com/renevo/pcb/ItemPortableCraftBench.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.renevo.pcb;

import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -14,12 +17,13 @@ public class ItemPortableCraftBench extends Item {

public static void create() {
portableCraftBench = new ItemPortableCraftBench();
GameRegistry.registerItem(portableCraftBench, "portableCraftBench");
portableCraftBench.setRegistryName("portableCraftBench");
GameRegistry.register(portableCraftBench);
GameRegistry.addShapelessRecipe(
new ItemStack(portableCraftBench),
new Object[] {
Blocks.crafting_table,
Items.string
new ItemStack(portableCraftBench),
new Object[] {
Blocks.crafting_table,
Items.string
});
}

Expand All @@ -30,15 +34,14 @@ public ItemPortableCraftBench() {
setUnlocalizedName("portableCraftBench");
setCreativeTab(CreativeTabs.tabTools);
}

@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {

public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) {
if (world.isRemote) {
return player.getCurrentEquippedItem();
return ActionResult.newResult(EnumActionResult.PASS, itemStack);
} else {
player.openGui(PortableCraftBenchMod.instance, PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID, world, 0, 0, 0);
return player.getCurrentEquippedItem();
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack);
}
}
}
22 changes: 12 additions & 10 deletions src/main/java/com/renevo/pcb/PortableCraftBenchGuiHandler.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
package com.renevo.pcb;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class PortableCraftBenchGuiHandler implements IGuiHandler {

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ItemPortableCraftBench.portableCraftBench)
if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == ItemPortableCraftBench.portableCraftBench)
return new GuiPortableCraftBench(player.inventory, world, new BlockPos(x, y, z));

if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() == ItemPortableCraftBench.portableCraftBench)
return new GuiPortableCraftBench(player.inventory, world, new BlockPos(x, y, z));

FMLLog.info("No GUI to show");

return null;
}

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ItemPortableCraftBench.portableCraftBench)
if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == ItemPortableCraftBench.portableCraftBench)
return new ContainerPortableCraftBench(player.inventory, world, new BlockPos(x, y, z));

FMLLog.info("No GUI to show");


if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() == ItemPortableCraftBench.portableCraftBench)
return new ContainerPortableCraftBench(player.inventory, world, new BlockPos(x, y, z));

return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@

@JEIPlugin
public class PortableCraftBenchPlugin implements IModPlugin {


@Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) { }

@Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry) { }

@Override
@Deprecated
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) { }

@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
{
"parent": "builtin/generated",
"parent": "item/generated",
"textures": {
"layer0": "pcb:items/portableCraftBench"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}

0 comments on commit 3ba6c3a

Please sign in to comment.