Skip to content

Commit

Permalink
Added loot category editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyPants committed Dec 18, 2015
1 parent 294cf10 commit 85b972b
Show file tree
Hide file tree
Showing 10 changed files with 376 additions and 3 deletions.
1 change: 1 addition & 0 deletions resources/assets/enderstructurescreator/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ tile.blockComponentEditor.name=Component Editor
tile.blockTemplateEditor.name=Template Editor
tile.blockGeneratorEditor.name=Generator Editor
tile.blockVillagerEditor.name=Villager Generator Editor
tile.blockLootCategoryEditor.name=Loot Category Editor
tile.blockClearMarker.name=Clear Marker

item.itemComponentTool.name=Component Tool
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import crazypants.structures.creator.block.BlockClearMarker;
import crazypants.structures.creator.block.BlockComponentEditor;
import crazypants.structures.creator.block.BlockGeneratorEditor;
import crazypants.structures.creator.block.BlockLootCategoryEditor;
import crazypants.structures.creator.block.BlockTemplateEditor;
import crazypants.structures.creator.block.BlockVillagerEditor;
import crazypants.structures.creator.block.component.EditorRegister;
Expand Down Expand Up @@ -45,6 +46,7 @@ public class EnderStructuresCreator {
public static BlockTemplateEditor blockTemplateEditor;
public static BlockGeneratorEditor blockGeneratorEditor;
public static BlockVillagerEditor blockVillagerEditor;
public static BlockLootCategoryEditor blockLootCategoryEditor;

public static ItemComponentTool itemComponentTool;
public static ItemTemplateTool itemTemplateTool;
Expand All @@ -65,6 +67,7 @@ public void preInit(FMLPreInitializationEvent event) {
blockGeneratorEditor = BlockGeneratorEditor.create();
blockVillagerEditor = BlockVillagerEditor.create();
blockClearMarker = BlockClearMarker.create();
blockLootCategoryEditor = BlockLootCategoryEditor.create();

itemTagTool = ItemTagTool.create();
itemComponentTool = ItemComponentTool.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI_ID_TEMPLATE_EDITOR = 3;
public static final int GUI_ID_GENERATOR_EDITOR = 4;
public static final int GUI_ID_VILLAGER_EDITOR = 5;
public static final int GUI_ID_LOOT_EDITOR = 6;


protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import crazypants.structures.creator.PacketHandler;
import crazypants.structures.creator.block.template.packet.PacketResourceTileGui;
import crazypants.structures.creator.item.ExportManager;
import crazypants.structures.gen.io.resource.StructureResourceManager;
import net.minecraft.client.Minecraft;

public abstract class AbstractResourceDialog extends JDialog {
Expand Down Expand Up @@ -111,7 +110,7 @@ protected boolean checkClear() {

public void onDirtyChanged(boolean dirty) {
String title = getResourceUid();
title = title + StructureResourceManager.GENERATOR_EXT;
title = title + getResourceExtension();
if(dirty) {
title += "*";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package crazypants.structures.creator.block;

import com.enderio.core.common.BlockEnder;

import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.structures.creator.EnderStructuresCreator;
import crazypants.structures.creator.EnderStructuresCreatorTab;
import crazypants.structures.creator.GuiHandler;
import crazypants.structures.creator.block.generator.GuiGeneratorEditor;
import crazypants.structures.creator.block.loot.DialogLootCategeoryEditor;
import crazypants.structures.creator.block.loot.TileLootCategory;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;

public class BlockLootCategoryEditor extends BlockEnder implements IGuiHandler {

public static final String NAME = "blockLootCategoryEditor";

public static BlockLootCategoryEditor create() {

BlockLootCategoryEditor res = new BlockLootCategoryEditor();
res.init();
return res;
}

protected BlockLootCategoryEditor() {
super(NAME, TileLootCategory.class);
setCreativeTab(EnderStructuresCreatorTab.tabEnderStructures);
setLightOpacity(0);
setResistance(2000);
}

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
return null;
}

@Override
public int getRenderBlockPass() {
return 0;
}

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iIconRegister) {
blockIcon = iIconRegister.registerIcon(EnderStructuresCreator.MODID.toLowerCase() + ":" + NAME);
}

@Override
protected boolean openGui(World world, int x, int y, int z, EntityPlayer entityPlayer, int side) {
if(!world.isRemote) {
entityPlayer.openGui(EnderStructuresCreator.instance, GuiHandler.GUI_ID_LOOT_EDITOR, world, x, y, z);
}
if(world.isRemote) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileLootCategory) {
DialogLootCategeoryEditor.openDialog((TileLootCategory) te);
}
}
return true;
}

@Override
protected void init() {
super.init();
EnderStructuresCreator.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_LOOT_EDITOR, this);
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileLootCategory) {
return new EmptyContainer();
}
return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileLootCategory) {
return new GuiGeneratorEditor();
}
return null;
}

}
Loading

0 comments on commit 85b972b

Please sign in to comment.