Skip to content

Commit

Permalink
Moved to CoreGUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aroma1997 committed Dec 31, 2013
1 parent 1950629 commit cf871a3
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.logging.Level;

import aroma1997.compactwindmills.helpers.LogHelper;
import aroma1997.core.inventories.Inventories;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
Expand Down Expand Up @@ -137,17 +138,10 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer t
if (thePlayer.isSneaking()) {
return false;
}

if (world.isRemote) {
return true;
}

TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof TileEntityWindmill) {
TileEntityWindmill tileEntityCW = (TileEntityWindmill) tileEntity;
thePlayer.openGui(CompactWindmills.instance, tileEntityCW.getType()
.ordinal(), world, x, y, z);
}
if (tileEntity == null) return false;
if (world.isRemote) return true;
Inventories.openContainerTileEntity(thePlayer, tileEntity, true);
return true;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

import aroma1997.compactwindmills.rotors.WindmillRenderer;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;

Expand All @@ -30,20 +26,6 @@
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy {

@Override
public Object getClientGuiElement(int ID, EntityPlayer thePlayer, World world, int X, int Y,
int Z) {
TileEntity tileEntity = world.getBlockTileEntity(X, Y, Z);
if (tileEntity != null && tileEntity instanceof TileEntityWindmill) {
TileEntityWindmill tileEntityCW = (TileEntityWindmill) tileEntity;
return ClientGUIWindmill.GUI.makeGUI(tileEntityCW.getType(), thePlayer.inventory,
tileEntityCW);
}
else {
return null;
}
}

@Override
public void registerRotorRenderer(Configuration config) {
config.load();
Expand All @@ -54,8 +36,7 @@ public void registerRotorRenderer(Configuration config) {
if (! specialRender) {
return;
}
ClientRegistry.bindTileEntitySpecialRenderer(
aroma1997.compactwindmills.TileEntityWindmill.class, new WindmillRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWindmill.class, new WindmillRenderer());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,14 @@
package aroma1997.compactwindmills;


import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import net.minecraftforge.common.Configuration;

import cpw.mods.fml.common.network.IGuiHandler;

/**
*
* @author Aroma1997
*
*/
public class CommonProxy implements IGuiHandler {

@Override
public Object
getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer thePlayer, World world, int x, int y,
int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof TileEntityWindmill) {
TileEntityWindmill tileEntityCW = (TileEntityWindmill) tileEntity;
return new ContainerCompactWindmills(thePlayer.inventory,
tileEntityCW, tileEntityCW.getType());
}
else {
return null;
}
}
public class CommonProxy {

public void registerRotorRenderer(Configuration config) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;

import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
Expand All @@ -33,10 +32,9 @@
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = Reference.ModID, name = Reference.ModName, version = Reference.Version, dependencies = "required-after:IC2")
@Mod(modid = Reference.ModID, name = Reference.ModName, version = Reference.Version, dependencies = "required-after:IC2;required-after:Aroma1997Core")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
/**
*
Expand Down Expand Up @@ -68,7 +66,6 @@ public class CompactWindmills {

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
LogHelper.init();
if (Reference.Version == "@VERSION" + "@") {
debugMode = true;
LogHelper.log(Level.INFO, "Turning on debug mode.");
Expand Down Expand Up @@ -132,13 +129,10 @@ public void load(FMLInitializationEvent event) {
RotorType.WOOD.getItem()));
}

NetworkRegistry.instance().registerGuiHandler(this, proxy);

}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.registerRotorRenderer(config);
if (!ModLoader.isModLoaded("Aroma1997Core")) CoreReminder.init(Reference.ModName);
}
}

This file was deleted.

Loading

0 comments on commit cf871a3

Please sign in to comment.