Initial work on Auto crafting table.

This commit is contained in:
modmuss50 2017-06-20 18:54:45 +01:00
parent 2c9e08bd63
commit 3071d19db0
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
9 changed files with 198 additions and 7 deletions

View file

@ -89,8 +89,8 @@ if (ENV.BUILD_NUMBER) {
}
minecraft {
version = "1.12-14.21.0.2335"
mappings = "snapshot_20170615"
version = "1.12-14.21.0.2340"
mappings = "snapshot_20170620"
replace "@MODVERSION@", project.version
useDepAts = true
runDir = "run"
@ -141,6 +141,9 @@ processResources
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
// Move access transformers to META-INF
rename '(.+_at.cfg)', 'META-INF/$1'
}
@ -148,6 +151,9 @@ task deobfJar(type: Jar) {
from sourceSets.main.output
exclude "**/*.psd"
classifier = 'dev'
manifest {
attributes 'FMLAT': 'techreborn_at.cfg'
}
}
@ -161,6 +167,9 @@ jar {
// exclude 'META-INF', 'META-INF/**', '**/*.java'
// }
// }
manifest {
attributes 'FMLAT': 'techreborn_at.cfg'
}
}
task apiJar(type: Jar) {

View file

@ -24,15 +24,34 @@
package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.Core;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAutoCraftingTable;
public class BlockElectricCraftingTable extends BlockMachineBase {
public class BlockAutoCraftingTable extends BlockMachineBase {
public BlockElectricCraftingTable(Material material) {
public BlockAutoCraftingTable() {
super();
setUnlocalizedName("techreborn.electriccraftingtable");
setCreativeTab(TechRebornCreativeTab.instance);
}
}
@Override
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileAutoCraftingTable();
}
@Override
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, EGui.AUTO_CRAFTING_TABLE.ordinal(), world, x, y, z);
}
return true;
}
}

View file

@ -64,7 +64,8 @@ public enum EGui {
SCRAPBOXINATOR(true),
LOW_VOLTAGE_SU(true),
HIGH_VOLTAGE_SU(true),
MEDIUM_VOLTAGE_SU(true);
MEDIUM_VOLTAGE_SU(true),
AUTO_CRAFTING_TABLE(true);
private final boolean containerBuilder;

View file

@ -31,6 +31,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import techreborn.client.container.*;
import techreborn.client.gui.*;
import techreborn.client.gui.autocrafting.GuiAutoCrafting;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.*;
@ -150,6 +151,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiThermalGenerator(player, (TileThermalGenerator) tile);
case VACUUM_FREEZER:
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
case AUTO_CRAFTING_TABLE:
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
default:
break;

View file

@ -0,0 +1,90 @@
package techreborn.client.gui.autocrafting;
import net.minecraft.client.gui.GuiButtonImage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import techreborn.client.gui.GuiBase;
import techreborn.tiles.TileAutoCraftingTable;
import java.io.IOException;
/**
* Created by modmuss50 on 20/06/2017.
*/
public class GuiAutoCrafting extends GuiBase {
GuiAutoCraftingRecipeSlector recipeSlector = new GuiAutoCraftingRecipeSlector();
private GuiButtonImage recipeButton;
boolean showGui = true;
InventoryCrafting dummyInv;
public GuiAutoCrafting(EntityPlayer player, TileAutoCraftingTable tile) {
super(player, tile, tile.createContainer(player));
}
@Override
public void updateScreen() {
super.updateScreen();
recipeSlector.func_193957_d();
}
@Override
public void initGui() {
super.initGui();
dummyInv = new InventoryCrafting(new Container() {
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
return false;
}
}, 3, 3);
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);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if (showGui) {
this.recipeSlector.func_191861_a(mouseX, mouseY, partialTicks);
super.drawScreen(mouseX, mouseY, partialTicks);
this.recipeSlector.func_191864_a(this.guiLeft, this.guiTop, false, partialTicks);
} else {
super.drawScreen(mouseX, mouseY, partialTicks);
}
this.recipeSlector.func_191876_c(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 (!showGui || !this.recipeSlector.func_191878_b()) {
super.mouseClicked(mouseX, mouseY, mouseButton);
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (!this.recipeSlector.func_191859_a(typedChar, keyCode)) {
super.keyTyped(typedChar, keyCode);
}
}
@Override
protected void handleMouseClick(Slot slotIn, int slotId, int mouseButton, ClickType type) {
super.handleMouseClick(slotIn, slotId, mouseButton, type);
this.recipeSlector.func_191874_a(slotIn);
}
public void onGuiClosed() {
this.recipeSlector.func_191871_c();
super.onGuiClosed();
}
}

View file

@ -0,0 +1,16 @@
package techreborn.client.gui.autocrafting;
import net.minecraft.client.gui.recipebook.GuiRecipeBook;
import net.minecraft.client.gui.recipebook.RecipeList;
import net.minecraft.item.crafting.IRecipe;
/**
* Created by modmuss50 on 20/06/2017.
*/
public class GuiAutoCraftingRecipeSlector extends GuiRecipeBook {
@Override
public void func_193945_a(IRecipe recipe, RecipeList recipes) {
System.out.println(recipe.getRecipeOutput().getDisplayName());
}
}

View file

@ -119,6 +119,7 @@ public class ModBlocks {
public static Block LV_TRANSFORMER;
public static Block MV_TRANSFORMER;
public static Block HV_TRANSFORMER;
public static Block AUTO_CRAFTING_TABLE;
public static BlockOre ORE;
public static BlockOre2 ORE2;
@ -378,6 +379,10 @@ public class ModBlocks {
registerBlock(HV_TRANSFORMER, "hv_transformer");
GameRegistry.registerTileEntity(TileHVTransformer.class, "TileHVTransformerTR");
AUTO_CRAFTING_TABLE = new BlockAutoCraftingTable();
registerBlock(AUTO_CRAFTING_TABLE, "auto_crafting_table");
GameRegistry.registerTileEntity(TileAutoCraftingTable.class, "TileAutoCraftingTableTR");
IRON_FURNACE = new BlockIronFurnace();
registerBlock(IRON_FURNACE, "iron_furnace");
GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR");

View file

@ -0,0 +1,47 @@
package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
/**
* Created by modmuss50 on 20/06/2017.
*/
public class TileAutoCraftingTable extends TilePowerAcceptor implements IContainerProvider {
public TileAutoCraftingTable() {
super();
}
@Override
public double getBaseMaxPower() {
return 0;
}
@Override
public double getBaseMaxOutput() {
return 0;
}
@Override
public double getBaseMaxInput() {
return 0;
}
@Override
public boolean canAcceptEnergy(EnumFacing enumFacing) {
return false;
}
@Override
public boolean canProvideEnergy(EnumFacing enumFacing) {
return false;
}
@Override
public BuiltContainer createContainer(EntityPlayer player) {
return new ContainerBuilder("autocraftingTable").player(player.inventory).inventory().hotbar().addInventory().create();
}
}

View file

@ -0,0 +1 @@
public net.minecraft.client.gui.recipebook.GuiRecipeBook func_193945_a(Lnet/minecraft/item/crafting/IRecipe;Lnet/minecraft/client/gui/recipebook/RecipeList;)V # func_193945_a