mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-26 06:53:11 +00:00
Working on the final 1.0.2 revision
This commit is contained in:
1 parent
5e530c99c6
commit
8f345b621c
39 files changed
+1082
-42
No files matched your search
@@ -55,7 +55,7 @@ public class DraconicEvolution {
|
||||
event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack";
|
||||
event.getModMetadata().authorList = Arrays.asList("brandon3055");
|
||||
event.getModMetadata().logoFile = "banner.png";
|
||||
event.getModMetadata().url = "http://www.tolkiencraft.com/draconic-evolution/";
|
||||
event.getModMetadata().url = "http://www.brandon3055.com/";
|
||||
event.getModMetadata().version = References.VERSION + "-MC1.7.10";
|
||||
|
||||
proxy.preInit(event);
|
||||
@@ -66,8 +66,11 @@ public class DraconicEvolution {
|
||||
public void init(final FMLInitializationEvent event)
|
||||
{if(debug)
|
||||
System.out.println("init()");
|
||||
|
||||
proxy.init(event);
|
||||
|
||||
// ===
|
||||
|
||||
// ===
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
package com.brandon3055.draconicevolution.client.gui;
|
||||
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GUIUpgradeModifier extends GuiContainer {
|
||||
|
||||
public EntityPlayer player;
|
||||
private TileUpgradeModifier tile;
|
||||
private float rotation = 0;
|
||||
private float rotationSpeed = 0;
|
||||
private float targetSpeed = 0;
|
||||
|
||||
private boolean inUse = false;
|
||||
private IUpgradableItem upgradableItem = null;
|
||||
private ItemStack stack = null;
|
||||
private List<EnumUpgrade> itemUpgrades = new ArrayList<EnumUpgrade>();
|
||||
private ContainerUpgradeModifier containerEM;
|
||||
|
||||
public GUIUpgradeModifier(InventoryPlayer invPlayer, TileUpgradeModifier tile, ContainerUpgradeModifier containerEM) {
|
||||
super(containerEM);
|
||||
this.containerEM = containerEM;
|
||||
|
||||
|
||||
xSize = 176;
|
||||
ySize = 190;
|
||||
|
||||
this.tile = tile;
|
||||
this.player = invPlayer.player;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
ResourceHandler.bindResource("textures/gui/UpgradeModifier.png");
|
||||
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 38, guiTop + 6, 3, 106, 100, 50);
|
||||
drawTexturedModalRect(guiLeft + 38, guiTop + 56, 3, 106, 100, 50);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(guiLeft + 38, guiTop + 6, 0);
|
||||
GL11.glTranslatef(50, 50, 0);
|
||||
GL11.glRotatef(rotation + (f * rotationSpeed), 0, 0, 1);
|
||||
GL11.glTranslatef(-50, -50, 0);
|
||||
drawTexturedModalRect(0, 0, 38, 6, 100, 100);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (!inUse)drawSlots();
|
||||
else renderUpgrades(x, y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
drawCenteredString(fontRendererObj, tile.getBlockType().getLocalizedName(), xSize/2, -9, 0x00FFFF);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private int coreSlots = 0;
|
||||
private int coreTier = 0;
|
||||
private int usedSlots = 0;
|
||||
private boolean[] coreInInventory = new boolean[4];
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
if (tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IUpgradableItem)
|
||||
{
|
||||
stack = tile.getStackInSlot(0);
|
||||
upgradableItem = (IUpgradableItem) stack.getItem();
|
||||
itemUpgrades = upgradableItem.getUpgrades();
|
||||
inUse = true;
|
||||
coreSlots = upgradableItem.getUpgradeCap();
|
||||
coreTier = upgradableItem.getMaxTier();
|
||||
usedSlots = 0;
|
||||
coreInInventory[0] = player.inventory.hasItem(ModItems.draconicCore);
|
||||
coreInInventory[1] = player.inventory.hasItem(ModItems.wyvernCore);
|
||||
coreInInventory[2] = player.inventory.hasItem(ModItems.awakenedCore);
|
||||
coreInInventory[3] = player.inventory.hasItem(ModItems.chaoticCore);
|
||||
|
||||
for (EnumUpgrade upgrade : upgradableItem.getUpgrades()) {
|
||||
for (Integer i : upgrade.getCoresApplied(stack)) usedSlots += i;
|
||||
}
|
||||
|
||||
}
|
||||
else inUse = false;
|
||||
|
||||
if (inUse) targetSpeed = 5F;
|
||||
else targetSpeed = 0F;
|
||||
|
||||
if (rotationSpeed < targetSpeed) rotationSpeed += 0.05F;
|
||||
else if (rotationSpeed > targetSpeed) rotationSpeed -= 0.05F;
|
||||
if (targetSpeed == 0 && rotationSpeed < 0) rotationSpeed = 0;
|
||||
rotation += rotationSpeed;
|
||||
}
|
||||
|
||||
private void drawSlots() {
|
||||
ResourceHandler.bindResource("textures/gui/Widgets.png");
|
||||
|
||||
int xPos = guiLeft + ((xSize - 162) / 2);
|
||||
int yPos = guiTop + 110;
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
drawTexturedModalRect(xPos + x*18, yPos + y*18, 138, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < 9; x++) {
|
||||
drawTexturedModalRect(xPos + x*18, yPos + 56, 138, 0, 18, 18);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 47, 138, 0, 18, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
for (EnumUpgrade upgrade : itemUpgrades)
|
||||
{
|
||||
int xIndex = itemUpgrades.indexOf(upgrade);
|
||||
int spacing = (xSize-6) / itemUpgrades.size();
|
||||
int xPos = guiLeft + (xIndex * spacing) + ((spacing - 23) / 2) + 4;
|
||||
int yPos = guiTop + 90;
|
||||
|
||||
|
||||
int[] appliedCores = upgrade.getCoresApplied(tile.getStackInSlot(0));
|
||||
|
||||
for (int i = 0; i <= coreTier; i++)
|
||||
{
|
||||
//Check + buttons
|
||||
if (/*coreInInventory[i] && */coreSlots > usedSlots && GuiHelper.isInRect(xPos, yPos+33 + i*18, 8, 8, x, y)){
|
||||
containerEM.sendObjectToServer(null, upgrade.index, i*2);
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
//Check - buttons
|
||||
if (appliedCores[i] > -1 && GuiHelper.isInRect(xPos + 16, yPos+33 + i*18, 8, 8, x, y)){
|
||||
containerEM.sendObjectToServer(null, upgrade.index, 1 + i*2);
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderUpgrades(int x, int y){
|
||||
//First Draw
|
||||
for (EnumUpgrade upgrade : itemUpgrades)
|
||||
{
|
||||
int xIndex = itemUpgrades.indexOf(upgrade);
|
||||
int spacing = (xSize-6) / itemUpgrades.size();
|
||||
int xPos = guiLeft + (xIndex * spacing) + ((spacing - 23) / 2) + 4;
|
||||
int yPos = guiTop + 90;
|
||||
|
||||
ResourceHandler.bindResource("textures/gui/UpgradeModifier.png");
|
||||
|
||||
drawTexturedModalRect(xPos, yPos, 0, 190, 24, 24);
|
||||
drawTexturedModalRect(xPos+3, yPos+3, upgrade.index * 18, 220, 18, 18);
|
||||
|
||||
int[] appliedCores = upgrade.getCoresApplied(tile.getStackInSlot(0));
|
||||
|
||||
for (int i = 0; i <= coreTier; i++) {
|
||||
drawTexturedModalRect(xPos+3, yPos+24 + i*18, 24 + i*18, 190, 18, 18);
|
||||
drawTexturedModalRect(xPos+3, yPos+24 + i*18, 24 + i*18, 190, 18, 18);
|
||||
|
||||
//Draw + buttons
|
||||
if (coreSlots > usedSlots){
|
||||
boolean hovering = GuiHelper.isInRect(xPos, yPos+33 + i*18, 8, 8, x, y);
|
||||
if (!coreInInventory[i]) drawTexturedModalRect(xPos, yPos+33 + i*18, 24, 208, 8, 8);
|
||||
else drawTexturedModalRect(xPos, yPos+33 + i*18, 32 + (hovering ? 8 : 0), 208, 8, 8);
|
||||
}
|
||||
|
||||
//Draw - buttons
|
||||
if (appliedCores[i] > 0){
|
||||
boolean hovering = GuiHelper.isInRect(xPos + 16, yPos+33 + i*18, 8, 8, x, y);
|
||||
drawTexturedModalRect(xPos + 16, yPos+33 + i*18, 56 + (hovering ? 8 : 0), 208, 8, 8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for (int i = 0; i <= coreTier; i++) drawCenteredString(fontRendererObj, String.valueOf(appliedCores[i]), xPos + 12, yPos + 29 + i*18, 0xFFFFFF);
|
||||
}
|
||||
|
||||
//Second Draw
|
||||
for (EnumUpgrade upgrade : itemUpgrades)
|
||||
{
|
||||
int xIndex = itemUpgrades.indexOf(upgrade);
|
||||
int spacing = (xSize-6) / itemUpgrades.size();
|
||||
int xPos = guiLeft + (xIndex * spacing) + ((spacing - 23) / 2) + 4;
|
||||
int yPos = guiTop + 90;
|
||||
int[] appliedCores = upgrade.getCoresApplied(tile.getStackInSlot(0));
|
||||
|
||||
if (GuiHelper.isInRect(xPos, yPos, 24, 24, x, y)){
|
||||
List list = new ArrayList();
|
||||
list.add(upgrade.getLocalizedName());
|
||||
drawHoveringText(list, x, y, fontRendererObj);
|
||||
}
|
||||
|
||||
for (int i = 0; i <= coreTier; i++) {
|
||||
//Draw Button Text (add)
|
||||
if (coreSlots > usedSlots && GuiHelper.isInRect(xPos, yPos+33 + i*18, 8, 8, x, y)) {
|
||||
List list = new ArrayList<String>();
|
||||
if (coreInInventory[i]) list.add(StatCollector.translateToLocal("gui.de.addCore.txt"));
|
||||
else list.add(StatCollector.translateToLocal("gui.de.noCoresInInventory" + i + ".txt"));
|
||||
drawHoveringText(list, x, y, fontRendererObj);
|
||||
}
|
||||
|
||||
//Draw Button Text (remove)
|
||||
if (appliedCores[i] > 1 && GuiHelper.isInRect(xPos + 16, yPos+33 + i*18, 8, 8, x, y)) {
|
||||
List list = new ArrayList<String>();
|
||||
if (coreInInventory[i]) list.add(StatCollector.translateToLocal("gui.de.removeCore.txt"));
|
||||
drawHoveringText(list, x, y, fontRendererObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
public static final int GUIID_TOOL_CONFIG = 12;
|
||||
public static final int GUIID_FLOW_GATE = 13;
|
||||
public static final int GUIID_REACTOR = 14;
|
||||
public static final int GUIID_UPGRADE_MODIFIER = 15;
|
||||
public static final int GUIID_CONTAINER_TEMPLATE = 100;
|
||||
|
||||
public GuiHandler() {
|
||||
@@ -96,7 +97,12 @@ public class GuiHandler implements IGuiHandler {
|
||||
break;
|
||||
case GUIID_TOOL_CONFIG:
|
||||
return new ContainerAdvTool(player.inventory, new InventoryTool(player, null));
|
||||
|
||||
case GUIID_UPGRADE_MODIFIER:
|
||||
TileEntity containerTemp = world.getTileEntity(x, y, z);
|
||||
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
|
||||
return new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// case GUIID_CONTAINER_TEMPLATE:
|
||||
@@ -178,6 +184,12 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new GUIToolConfig(player, new ContainerAdvTool(player.inventory, new InventoryTool(player, null)));
|
||||
case GUIID_FLOW_GATE:
|
||||
return world.getTileEntity(x, y, z) instanceof TileGate ? new GUIFlowGate((TileGate)world.getTileEntity(x, y, z)) : null;
|
||||
case GUIID_UPGRADE_MODIFIER:
|
||||
TileEntity containerTemp = world.getTileEntity(x, y, z);
|
||||
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
|
||||
return new GUIUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp, new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp));
|
||||
}
|
||||
break;
|
||||
|
||||
// case GUIID_CONTAINER_TEMPLATE:
|
||||
// TileEntity containerTemp = world.getTileEntity(x, y, z);
|
||||
|
||||
+18
-19
@@ -136,25 +136,24 @@ public class GUIReactor extends GUIBase {
|
||||
text.add(reactor.convertedFuel + " / " + (reactor.convertedFuel + reactor.reactorFuel)); //todo refine or remove
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
else if (GuiHelper.isInRect(53, 15, 140, 18, mouseX-guiLeft, mouseY-guiTop)){
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
else if (GuiHelper.isInRect(53, 40, 140, 18, mouseX-guiLeft, mouseY-guiTop)){
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
else if (GuiHelper.isInRect(53, 65, 140, 18, mouseX-guiLeft, mouseY-guiTop)){
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacGenRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
else if (GuiHelper.isInRect(53, 88, 140, 18, mouseX-guiLeft, mouseY-guiTop)){
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacInputRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
else if (GuiHelper.isInRect(53, 113, 140, 18, mouseX-guiLeft, mouseY-guiTop)){
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
|
||||
if (showStats) {
|
||||
if (GuiHelper.isInRect(53, 15, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
} else if (GuiHelper.isInRect(53, 40, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
} else if (GuiHelper.isInRect(53, 65, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacGenRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
} else if (GuiHelper.isInRect(53, 88, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacInputRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
} else if (GuiHelper.isInRect(53, 113, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), 200));
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -208,4 +208,9 @@ public class GUIToolConfig extends GUIBase {
|
||||
this.editingItem = stack;
|
||||
container.updateInventoryStack(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+5
@@ -72,4 +72,9 @@ public class GUIToolInventory extends GUIBase {
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
fontRendererObj.drawString(inventoryName, guiLeft + 5, guiTop + 5, 0x555555);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -135,7 +135,7 @@ public class ClientEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) {
|
||||
if (ConfigHandler.useOriginal3DArmorModel) return;
|
||||
if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel) return;
|
||||
if (event.stack != null && (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor))
|
||||
{
|
||||
ItemArmor itemarmor = (ItemArmor)event.stack.getItem();
|
||||
|
||||
+4
-2
@@ -129,8 +129,10 @@ public class RenderBowModel implements IItemRenderer
|
||||
GL11.glTranslated(0, 0, 1.5);
|
||||
}
|
||||
else if (type == IItemRenderer.ItemRenderType.ENTITY){
|
||||
GL11.glRotatef(-34.5F, 0, 1, 0);
|
||||
GL11.glTranslated(-1.1, 0, -0.2);
|
||||
GL11.glScaled(0.8, 0.8, 0.8);
|
||||
GL11.glTranslated(0.25, 0.7, 0.2);
|
||||
GL11.glRotatef(130, 0, 0, 1);
|
||||
GL11.glRotatef(-90, 1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer");
|
||||
GameRegistry.registerTileEntity(TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector");
|
||||
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
|
||||
GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
|
||||
if (DraconicEvolution.debug) {
|
||||
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
|
||||
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ModBlocks {
|
||||
public static BlockDE reactorStabilizer;
|
||||
public static BlockDE reactorEnergyInjector;
|
||||
public static BlockDE chaosCrystal;
|
||||
public static BlockDE enhancementModifier;
|
||||
public static Block safetyFlame;
|
||||
public static Block chaosShardAtmos = new ChaosShardAtmos().setBlockName(References.RESOURCESPREFIX+"chaosShardAtmos").setBlockTextureName(References.RESOURCESPREFIX+"transparency");
|
||||
|
||||
@@ -88,6 +89,7 @@ public class ModBlocks {
|
||||
reactorStabilizer = new ReactorStabilizer();
|
||||
reactorEnergyInjector = new ReactorEnergyInjector();
|
||||
chaosCrystal = new ChaosCrystal();
|
||||
enhancementModifier = new UpgradeModifier();
|
||||
|
||||
longRangeDislocator = new LongRangeDislocator();
|
||||
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 23/12/2015.
|
||||
*/
|
||||
public class UpgradeModifier extends BlockCustomDrop {
|
||||
public UpgradeModifier() {
|
||||
super(Material.iron);
|
||||
this.setBlockName("upgradeModifier");
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.375f, 1f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
// blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileUpgradeModifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) {
|
||||
if (!world.isRemote) {
|
||||
FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_UPGRADE_MODIFIER, world, x, y, z);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+10
@@ -48,6 +48,16 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock{
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "energy_storage_core");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
|
||||
+2
-2
@@ -1,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.multiblock;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -8,9 +10,7 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
+2
@@ -15,6 +15,8 @@ import net.minecraft.inventory.Container;
|
||||
/**This class is for syncing values to bug for ICrafting*/
|
||||
public abstract class ContainerDataSync extends Container {
|
||||
|
||||
//TODO WTF? Was i sleep coding when i wrote this? In 1.8 re write this as a common container class for all mod containers and use a dedicated sender/receiver method for each data type i want to send (Unless i think of something better between now and then)
|
||||
|
||||
/**
|
||||
* Sends two ints to the client-side Container. Normally the first int identifies which variable to update, and the second contains the new
|
||||
* value.
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerUpgradeModifier extends ContainerDataSync
|
||||
{
|
||||
private static final Item[] CORES_INDEX = {ModItems.draconicCore, ModItems.wyvernCore, ModItems.awakenedCore, ModItems.chaoticCore};
|
||||
private TileUpgradeModifier tile;
|
||||
private EntityPlayer player;
|
||||
private boolean slotsActive = true;
|
||||
|
||||
public ContainerUpgradeModifier(InventoryPlayer invPlayer, TileUpgradeModifier tile) {
|
||||
this.tile = tile;
|
||||
this.player = invPlayer.player;
|
||||
|
||||
for (int x = 0; x < 9; x++) {
|
||||
addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 167));
|
||||
}
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 111 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotUpgradable(tile, 0, 80, 48));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
icrafting.sendProgressBarUpdate(this, 0, 0);
|
||||
}
|
||||
updateSlotState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int index, int value) {
|
||||
super.updateProgressBar(index, value);
|
||||
if (index == 0) updateSlotState();
|
||||
}
|
||||
|
||||
private void updateSlotState(){
|
||||
if (tile.getStackInSlot(0) != null && slotsActive) {
|
||||
for (Object o : inventorySlots) {
|
||||
if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot)o).xDisplayPosition += 1000;
|
||||
}
|
||||
slotsActive = false;
|
||||
}
|
||||
else if (tile.getStackInSlot(0) == null && !slotsActive) {
|
||||
for (Object o : inventorySlots) {
|
||||
if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot)o).xDisplayPosition -= 1000;
|
||||
}
|
||||
slotsActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return tile.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int i)
|
||||
{
|
||||
// Slot slot = getSlot(i);
|
||||
//
|
||||
// if (slot != null && slot.getHasStack())
|
||||
// {
|
||||
// ItemStack stack = slot.getStack();
|
||||
// ItemStack result = stack.copy();
|
||||
//
|
||||
// if (i >= 36){
|
||||
// if (!mergeItemStack(stack, 0, 36, false)){
|
||||
// return null;
|
||||
// }
|
||||
// }else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// if (stack.stackSize == 0) {
|
||||
// slot.putStack(null);
|
||||
// }else{
|
||||
// slot.onSlotChanged();
|
||||
// }
|
||||
//
|
||||
// slot.onPickupFromSlot(player, stack);
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isStackValidForInventory(ItemStack stack, int slot){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void receiveSyncData(int index, int value) {
|
||||
EnumUpgrade upgrade = EnumUpgrade.getUpgradeByIndex(index);
|
||||
int coreTier = value/2;
|
||||
boolean addCore = value % 2 == 0;
|
||||
ItemStack stack = tile.getStackInSlot(0);
|
||||
if (upgrade == null || stack == null || !(stack.getItem() instanceof IUpgradableItem) || coreTier < 0 || coreTier > 3 || (upgrade.getCoresApplied(stack)[coreTier] <= 0 && !addCore)) return;
|
||||
handleCoreTransaction(upgrade, coreTier, addCore, (IUpgradableItem)stack.getItem(), stack);
|
||||
}
|
||||
|
||||
|
||||
private void handleCoreTransaction(EnumUpgrade upgrade, int coreTier, boolean addCoreElseRemove, IUpgradableItem upgradableItem, ItemStack stack) {
|
||||
int coreSlots = upgradableItem.getUpgradeCap();
|
||||
int totalCores = 0;
|
||||
int[] coresApplied = upgrade.getCoresApplied(stack);
|
||||
for (EnumUpgrade u : upgradableItem.getUpgrades()) totalCores += u.getCoresApplied(stack)[coreTier];
|
||||
|
||||
if (addCoreElseRemove)
|
||||
{
|
||||
if (!player.inventory.hasItem(CORES_INDEX[coreTier]) || totalCores >= coreSlots) return;
|
||||
coresApplied[coreTier]++;
|
||||
player.inventory.consumeInventoryItem(CORES_INDEX[coreTier]);
|
||||
upgrade.setCoresApplied(stack, coresApplied);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (coresApplied[coreTier] <= 0) return;
|
||||
coresApplied[coreTier]--;
|
||||
upgrade.setCoresApplied(stack, coresApplied);
|
||||
if (!player.inventory.addItemStackToInventory(new ItemStack(CORES_INDEX[coreTier]))) {
|
||||
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(CORES_INDEX[coreTier]));
|
||||
if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotUpgradable extends Slot {
|
||||
|
||||
public SlotUpgradable(IInventory inventory1, int slot, int x, int y) {
|
||||
super(inventory1, slot, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack != null && stack.getItem() instanceof IUpgradableItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -20,6 +21,7 @@ public class Nugget extends ItemDE {
|
||||
public Nugget() {
|
||||
this.setUnlocalizedName("nugget");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
|
||||
ModItems.register(this);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.List;
|
||||
|
||||
public class Tclogo extends ItemDE {
|
||||
@@ -142,6 +144,19 @@ public class Tclogo extends ItemDE {
|
||||
LogHelper.info("45622".hashCode());
|
||||
|
||||
|
||||
File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt");
|
||||
|
||||
try {
|
||||
FileWriter writer = new FileWriter(file);
|
||||
for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+",");
|
||||
writer.close();
|
||||
LogHelper.info("Done");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
int xCoord = 0;
|
||||
int yCoord = 0;
|
||||
int zCoord = 0;
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
if (stack.getItem() == ModItems.draconicHelm) {
|
||||
if (world.isRemote) return;
|
||||
if (this.getEnergyStored(stack) >= 5000 && clearNegativeEffects(player)) this.extractEnergy(stack, 5000, false);
|
||||
if (player.worldObj.getBlockLightValue((int)Math.floor(player.posX), (int) player.posY, (int)Math.floor(player.posZ)) < 5 && ItemNBTHelper.getBoolean(stack, "ArmorNVActive", false))
|
||||
if (player.worldObj.getBlockLightValue((int)Math.floor(player.posX), (int) player.posY + 1, (int)Math.floor(player.posZ)) < 5 && ItemNBTHelper.getBoolean(stack, "ArmorNVActive", false))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(16, 419, 0, true));
|
||||
}
|
||||
|
||||
@@ -69,6 +69,16 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) {
|
||||
// World world = player.worldObj;
|
||||
|
||||
+20
-1
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
|
||||
@@ -8,7 +9,6 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -115,4 +115,23 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
|
||||
GL11.glTranslated(0, 0.4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_STAFF_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
List<EnumUpgrade> list = super.getUpgrades();
|
||||
list.add(EnumUpgrade.ATTACK_AOE);
|
||||
list.add(EnumUpgrade.ATTACK_DAMAGE);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -31,9 +32,10 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak {
|
||||
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak, IUpgradableItem {
|
||||
|
||||
protected int capacity = References.DRACONICCAPACITY;
|
||||
protected int maxReceive = References.DRACONICTRANSFER;
|
||||
@@ -254,4 +256,20 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende
|
||||
GL11.glTranslated(0.35, -0.4, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.DIG_AOE);}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
+9
@@ -73,6 +73,15 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
|
||||
@@ -80,6 +80,15 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
|
||||
@@ -72,7 +72,15 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRender
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_WYVERN_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
|
||||
@@ -74,6 +74,15 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_WYVERN_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
|
||||
+14
-2
@@ -1,8 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MaterialLiquid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -24,6 +25,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,7 +33,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Created by Brandon on 2/01/2015.
|
||||
*/
|
||||
public abstract class MiningTool extends ToolBase {//todo add custom information to sub classes, Update documentation and add doc for hud
|
||||
public abstract class MiningTool extends ToolBase implements IUpgradableItem {//todo add custom information to sub classes, Update documentation and add doc for hud
|
||||
|
||||
|
||||
public MiningTool(ToolMaterial material) {
|
||||
@@ -275,6 +277,16 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
|
||||
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x,y,z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
add(EnumUpgrade.DIG_SPEED);
|
||||
add(EnumUpgrade.DIG_AOE);
|
||||
add(EnumUpgrade.DIG_DEPTH);
|
||||
add(EnumUpgrade.RF_CAPACITY);
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -143,6 +143,11 @@ public class ToolHandler {
|
||||
|
||||
public static void damageEntityBasedOnHealth(Entity entity, EntityPlayer player, float dmgMult) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem)){
|
||||
LogHelper.error("[ToolHandler.java:147] WTF? I don't get it... Player "+player.getCommandSenderName()+" whacked something with a DE weapon but that they are not holding? Ok someone is messing with my shit...");
|
||||
return;
|
||||
}
|
||||
|
||||
float baseAttack = getDamageAgainstEntity(stack, entity);
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
|
||||
+22
-1
@@ -8,6 +8,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -31,7 +32,7 @@ import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DraconicBow extends ItemBow implements IInventoryTool
|
||||
public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableItem
|
||||
{
|
||||
public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" };
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -242,4 +243,24 @@ public class DraconicBow extends ItemBow implements IInventoryTool
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return new ArrayList<ItemConfigField>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
add(EnumUpgrade.DRAW_SPEED);
|
||||
add(EnumUpgrade.ARROW_SPEED);
|
||||
add(EnumUpgrade.ARROW_DAMAGE);
|
||||
add(EnumUpgrade.RF_CAPACITY);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
+21
-1
@@ -10,6 +10,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.google.common.collect.Multimap;
|
||||
@@ -36,7 +37,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DraconicSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak {
|
||||
public class DraconicSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak, IUpgradableItem {
|
||||
protected int capacity = References.DRACONICCAPACITY;
|
||||
protected int maxReceive = References.DRACONICTRANSFER;
|
||||
protected int maxExtract = References.DRACONICTRANSFER * 50;
|
||||
@@ -220,4 +221,23 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
GL11.glTranslated(-0.8, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
add(EnumUpgrade.RF_CAPACITY);
|
||||
add(EnumUpgrade.ATTACK_AOE);
|
||||
add(EnumUpgrade.ATTACK_DAMAGE);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_DRACONIC_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
+21
-1
@@ -8,6 +8,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -31,7 +32,7 @@ import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WyvernBow extends ItemBow implements IInventoryTool {
|
||||
public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableItem {
|
||||
|
||||
public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" };
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -209,5 +210,24 @@ public class WyvernBow extends ItemBow implements IInventoryTool {
|
||||
return new ArrayList<ItemConfigField>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
add(EnumUpgrade.DRAW_SPEED);
|
||||
add(EnumUpgrade.ARROW_SPEED);
|
||||
add(EnumUpgrade.ARROW_DAMAGE);
|
||||
add(EnumUpgrade.RF_CAPACITY);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_WYVERN_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+21
-1
@@ -11,6 +11,7 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -37,7 +38,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak {
|
||||
public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak, IUpgradableItem{
|
||||
|
||||
protected int capacity = References.WYVERNCAPACITY;
|
||||
protected int maxReceive = References.WYVERNTRANSFER;
|
||||
@@ -227,5 +228,24 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
GL11.glTranslated(0.2, 0, -0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades() {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
add(EnumUpgrade.RF_CAPACITY);
|
||||
add(EnumUpgrade.ATTACK_AOE);
|
||||
add(EnumUpgrade.ATTACK_DAMAGE);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpgradeCap() {
|
||||
return References.MAX_WYVERN_UPGRADES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ public final class References {
|
||||
public static final int ENERGYPERBLOCK = 80;
|
||||
public static final int ENERGYPERATTACK = 250;
|
||||
|
||||
public static final int MAX_WYVERN_UPGRADES = 3;
|
||||
public static final int MAX_DRACONIC_UPGRADES = 6;
|
||||
public static final int MAX_STAFF_UPGRADES = 12;
|
||||
|
||||
//======================Render IDs========================//
|
||||
public static int idTeleporterStand = -1;
|
||||
public static int idPortal = -1;
|
||||
|
||||
@@ -11,3 +11,5 @@ public class VersionHandler
|
||||
|
||||
public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : "");
|
||||
}
|
||||
|
||||
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 23/12/2015.
|
||||
*/
|
||||
public class TileUpgradeModifier extends TileEntity implements ISidedInventory {
|
||||
ItemStack[] items = new ItemStack[1];
|
||||
|
||||
//==============================================LOGIC=======================================================//
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//==========================================SYNCHRONIZATION==================================================//
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
this.writeToNBT(tagCompound);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
//==============================================INVENTORY====================================================//
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return items[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int count) {
|
||||
ItemStack itemstack = getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
if (itemstack.stackSize <= count) {
|
||||
setInventorySlotContents(i, null);
|
||||
} else {
|
||||
itemstack = itemstack.splitStack(count);
|
||||
if (itemstack.stackSize == 0) {
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
ItemStack item = getStackInSlot(i);
|
||||
if (item != null) setInventorySlotContents(i, null);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
items[i] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack item, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack item, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================================================//
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound)
|
||||
{
|
||||
NBTTagCompound[] tag = new NBTTagCompound[items.length];
|
||||
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
tag[i] = new NBTTagCompound();
|
||||
|
||||
if (items[i] != null)
|
||||
{
|
||||
tag[i] = items[i].writeToNBT(tag[i]);
|
||||
}
|
||||
|
||||
compound.setTag("Item" + i, tag[i]);
|
||||
}
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
NBTTagCompound[] tag = new NBTTagCompound[items.length];
|
||||
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
tag[i] = compound.getCompoundTag("Item" + i);
|
||||
items[i] = ItemStack.loadItemStackFromNBT(tag[i]);
|
||||
}
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 23/12/2015.
|
||||
*/
|
||||
public interface IUpgradableItem {
|
||||
|
||||
/**@return a list of upgrades for this item.*/
|
||||
public List<EnumUpgrade> getUpgrades();
|
||||
|
||||
/**@return the maximum number of upgrades for this item*/
|
||||
public int getUpgradeCap();
|
||||
|
||||
/**@return the max upgrade tier allowed for this item
|
||||
* 0 = Draconic Core
|
||||
* 1 = Wyvern Core
|
||||
* 2 = Awakened Core
|
||||
* 3 = Chaotic Core*/
|
||||
public int getMaxTier();
|
||||
|
||||
public static enum EnumUpgrade {
|
||||
RF_CAPACITY(0, "RFCapacity"),
|
||||
DIG_SPEED(1, "DigSpeed"),
|
||||
DIG_AOE(2, "DigAOE"),
|
||||
DIG_DEPTH(3, "DigDepth"),
|
||||
ATTACK_DAMAGE(4, "AttackDamage"),
|
||||
ATTACK_AOE(5, "AttackAOE"),
|
||||
ARROW_DAMAGE(6, "ArrowDamage"),
|
||||
DRAW_SPEED(7, "DrawSpeed"),
|
||||
ARROW_SPEED(8, "ArrowSpeed"),
|
||||
SHIELD_CAPACITY(9, "ShieldCapacity"),
|
||||
SHIELD_RECOVERY(10, "ShieldRecovery"),
|
||||
MOVE_SPEED(11, "MoveSpeed"),
|
||||
JUMP_BOOST(12, "JumpBoost");
|
||||
|
||||
public int index;
|
||||
public String name;
|
||||
private final String COMPOUND_NAME = "Upgrades";
|
||||
|
||||
private EnumUpgrade(int index, String name) {
|
||||
this.index = index;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**Get the number of cores applied to this upgrade
|
||||
* @return an int[4] containing the number of cores that have been applied
|
||||
* in order from index 0 which is the number od draconic cores to index 3 which is the number of chaotic cores
|
||||
* with wyvern and awakened in between*/
|
||||
public int[] getCoresApplied(ItemStack stack){
|
||||
if (stack == null) return new int[] {0, 0, 0, 0};
|
||||
NBTTagCompound compound = ItemNBTHelper.getCompound(stack);
|
||||
if (!compound.hasKey(COMPOUND_NAME)) return new int[] {0, 0, 0, 0};
|
||||
NBTTagCompound upgrades = compound.getCompoundTag(COMPOUND_NAME);
|
||||
if (upgrades.hasKey(name) && upgrades.getIntArray(name).length == 4) return upgrades.getIntArray(name);
|
||||
return new int[] {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
/**Sets the number of each core type applied
|
||||
* takes an ItemStack and an int[4]*/
|
||||
public void setCoresApplied(ItemStack stack, int[] cores){
|
||||
if (cores.length != 4){
|
||||
LogHelper.error("[EnumUpgrade] Error applying upgrades to stack.");
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound compound = ItemNBTHelper.getCompound(stack);
|
||||
NBTTagCompound upgrades;
|
||||
if (compound.hasKey(COMPOUND_NAME)) upgrades = compound.getCompoundTag(COMPOUND_NAME);
|
||||
else upgrades = new NBTTagCompound();
|
||||
upgrades.setIntArray(name, cores);
|
||||
compound.setTag(COMPOUND_NAME, upgrades);
|
||||
}
|
||||
|
||||
public String getLocalizedName() { return StatCollector.translateToLocal("gui.de."+name+".txt"); }
|
||||
|
||||
public static EnumUpgrade getUpgradeByIndex(int index) {
|
||||
for (EnumUpgrade upgrade : EnumUpgrade.values()) {
|
||||
if (upgrade.index == index) return upgrade;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user