The long road to a pure Java port has begun. Clickable Slider is broken in this commit.

This commit is contained in:
Leon 2016-10-19 18:04:49 -04:00
parent efa395fcd4
commit c30e77e3d4
191 changed files with 1648 additions and 920 deletions

7
.gitignore vendored
View file

@ -4,12 +4,19 @@
/run
/libs
#Backup files
/BU
# Eclipse
.classpath
.project
/.settings
/bin
# Numina while porting
/src/main/java/net/machinemuse/numina
/src/main/scala/net/machinemuse/numina
# IntelliJ
/.idea
*.iml

View file

@ -15,10 +15,21 @@ buildscript {
}
}
repositories {
maven {
name = "ChickenBones"
url = "http://chickenbones.net/maven"
}
}
apply plugin: 'scala'
apply plugin: 'forge'
apply plugin: 'curseforge'
sourceCompatibility = 1.7
targetCompatibility = 1.7
// define the properties file
ext.configFile = file "project.properties"
@ -53,27 +64,63 @@ def getLibrary(filename) {
}
}
getLibrary("CoFHCore-[1.7.10]3.0.3-303-dev.jar")
getLibrary("industrialcraft-2-2.2.765-experimental-api.jar")
getLibrary("ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar")
getLibrary("GalacticraftCore-Dev-1.7-3.0.12.168.jar")
getLibrary("Railcraft_1.7.10-9.7.0.0-dev.jar") // delete outdated CoFH API from this jar to run in dev environment
getLibrary("MineFactoryReloaded-[1.7.10]2.8.0-104-dev.jar")
getLibrary("forestry_1.7.10-3.6.3.20-api.jar")
getLibrary("Thaumcraft-deobf-1.7.10-4.2.3.5.jar")
getLibrary("SmartRender-1.7.10-2.1.jar") // this version is ok to build with, but to run in dev environment, download the SmartMoving zip and use the version from that
getLibrary("RenderPlayerAPI-1.7.10-1.4.jar")
getLibrary("appliedenergistics2-rv2-stable-10-dev.jar")
getLibrary("ExtraCells-deobf-1.7.10-2.3.2b158.jar") // This one may have to be downloaded manually
getLibrary("buildcraft-7.0.21-dev.jar")
getLibrary("BluePower-1.7.10-0.2.962-universal.jar")
getLibrary("EnderIO-1.7.10-2.2.8.381-dev.jar") // May need to delete Mekanism API from this jar to run in dev environment
getLibrary("Mekanism-1.7.10-8.1.7.252.jar")
getLibrary("MrTJPCore-1.1.0.31-universal.jar")
getLibrary("ProjectRed-1.7.10-4.7.0pre8.92-Base.jar")
getLibrary("Chisel2-2.5.0.43-deobf.jar")
getLibrary("Chisel-2.9.0.3-deobf.jar")
getLibrary("compactmachines-1.7.10-1.20-dev.jar") // This is for the personal shrinking device module; needs to be built from source.
dependencies {
compile 'codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev'
compile 'codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev'
compile 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev'
}
/*
repositories {
maven {
name = "ic2"
url = "http://maven.ic2.player.to/"
}
}
dependencies {
compile 'net.industrial-craft:industrialcraft-2:2.2.826-experimental:api'
}
*/
//getLibrary("CoFHCore-[1.7.10]3.0.3-303-dev.jar")
////getLibrary("industrialcraft-2-2.2.765-experimental-api.jar")
//getLibrary("ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar")
//getLibrary("GalacticraftCore-Dev-1.7-3.0.12.168.jar")
//getLibrary("Railcraft_1.7.10-9.7.0.0-dev.jar") // delete outdated CoFH API from this jar to run in dev environment
//getLibrary("MineFactoryReloaded-[1.7.10]2.8.0-104-dev.jar")
//getLibrary("forestry_1.7.10-3.6.3.20-api.jar")
//getLibrary("Thaumcraft-deobf-1.7.10-4.2.3.5.jar")
//getLibrary("SmartRender-1.7.10-2.1.jar") // this version is ok to build with, but to run in dev environment, download the SmartMoving zip and use the version from that
//getLibrary("RenderPlayerAPI-1.7.10-1.4.jar")
////getLibrary("appliedenergistics2-rv2-stable-10-dev.jar")
//getLibrary("ExtraCells-deobf-1.7.10-2.3.2b158.jar") // This one may have to be downloaded manually
//getLibrary("buildcraft-7.0.21-dev.jar")
//getLibrary("BluePower-1.7.10-0.2.962-universal.jar")
//getLibrary("EnderIO-1.7.10-2.2.8.381-dev.jar") // May need to delete Mekanism API from this jar to run in dev environment
//getLibrary("Mekanism-1.7.10-8.1.7.252.jar")
//getLibrary("MrTJPCore-1.1.0.31-universal.jar")
//getLibrary("ProjectRed-1.7.10-4.7.0pre8.92-Base.jar")
////getLibrary("Chisel2-2.5.0.43-deobf.jar")
////getLibrary("Chisel-2.9.0.3-deobf.jar")
//getLibrary("compactmachines-1.7.10-1.20-dev.jar") // This is for the personal shrinking device module; needs to be built from source.
processResources {
// this will ensure that this task is redone when the versions change.

View file

@ -1,4 +1,4 @@
forge_version=10.13.4.1558-1.7.10
forge_version=10.13.4.1614-1.7.10
mod_version=0.11.0
minecraft_version=1.7.10
group_id=net.machinemuse

View file

@ -21,7 +21,7 @@ public interface IElectricItemManager {
/**
* Charge an item with a specified amount of energy.
*
* @param itemStack electric item's stack
* @param stack electric item's stack
* @param amount amount of energy to charge in EU
* @param tier tier of the charging device, has to be at least as high as the item to charge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
@ -33,7 +33,7 @@ public interface IElectricItemManager {
/**
* Discharge an item by a specified amount of energy
*
* @param itemStack electric item's stack
* @param stack electric item's stack
* @param amount amount of energy to discharge in EU
* @param tier tier of the discharging device, has to be at least as high as the item to discharge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
@ -46,7 +46,7 @@ public interface IElectricItemManager {
/**
* Determine the charge level for the specified item.
*
* @param itemStack ItemStack containing the electric item
* @param stack ItemStack containing the electric item
* @return charge level in EU
*/
double getCharge(ItemStack stack);
@ -56,7 +56,7 @@ public interface IElectricItemManager {
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
* BatPacks are not taken into account.
*
* @param itemStack electric item's stack
* @param stack electric item's stack
* @param amount minimum amount of energy required
* @return true if there's enough energy
*/
@ -66,7 +66,7 @@ public interface IElectricItemManager {
* Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack.
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
*
* @param itemStack electric item's stack
* @param stack electric item's stack
* @param amount amount of energy to discharge in EU
* @param entity entity holding the item
* @return true if the operation succeeded
@ -78,7 +78,7 @@ public interface IElectricItemManager {
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
* use() already contains this functionality.
*
* @param itemStack electric item's stack
* @param stack electric item's stack
* @param entity entity holding the item
*/
void chargeFromArmor(ItemStack stack, EntityLivingBase entity);
@ -86,7 +86,7 @@ public interface IElectricItemManager {
/**
* Get the tool tip to display for electric items.
*
* @param itemStack ItemStack to determine the tooltip for
* @param stack ItemStack to determine the tooltip for
* @return tool tip string or null for none
*/
String getToolTip(ItemStack stack);

View file

@ -3,5 +3,5 @@ package net.machinemuse.api;
import net.minecraft.nbt.NBTTagCompound;
public interface IPropertyModifier {
public double applyModifier(NBTTagCompound moduleTag, double value);
double applyModifier(NBTTagCompound moduleTag, double value);
}

View file

@ -19,7 +19,7 @@ public interface IBlockBreakingModule extends IPowerModule {
*/
boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player);
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player);
boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player);
public void handleBreakSpeed(PlayerEvent.BreakSpeed event);
void handleBreakSpeed(PlayerEvent.BreakSpeed event);
}

View file

@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IPlayerTickModule extends IPowerModule {
public void onPlayerTickActive(EntityPlayer player, ItemStack item);
void onPlayerTickActive(EntityPlayer player, ItemStack item);
public void onPlayerTickInactive(EntityPlayer player, ItemStack item);
void onPlayerTickInactive(EntityPlayer player, ItemStack item);
}

View file

@ -6,17 +6,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IRightClickModule extends IPowerModule {
public void onRightClick(EntityPlayer playerClicking, World world, ItemStack item);
void onRightClick(EntityPlayer playerClicking, World world, ItemStack item);
public void onItemUse(
void onItemUse(
ItemStack itemStack, EntityPlayer player, World world,
int x, int y, int z,
int side, float hitX, float hitY, float hitZ);
public boolean onItemUseFirst(
boolean onItemUseFirst(
ItemStack itemStack, EntityPlayer player, World world,
int x, int y, int z,
int side, float hitX, float hitY, float hitZ);
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int par4);
void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int par4);
}

View file

@ -0,0 +1,89 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.gui.frame.*;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MuseRect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Author: MachineMuse (Claire Semple)
* Created: 6:32 PM, 29/04/13
*
* Ported to Java by lehjr on 10/19/16.
*/
public class CosmeticGui extends MuseGui {
EntityPlayer player;
int worldx;
int worldy;
int worldz;
ItemSelectionFrame itemSelect;
ItemStack lastSelectedItem;
public CosmeticGui(EntityPlayer player, int worldx, int worldy, int worldz) {
this.player = player;
this.worldx = worldx;
this.worldy = worldy;
this.worldz = worldz;
this.xSize = 256;
this.ySize = 200;
}
/**
* Add the buttons (and other controls) to the screen.
*/
@Override
public void initGui() {
super.initGui();
itemSelect = new ItemSelectionFrame(
new MusePoint2D(absX(-0.95F), absY(-0.95F)),
new MusePoint2D(absX(-0.78F), absY(-0.025F)),
Colour.LIGHTBLUE.withAlpha(0.8F),
Colour.DARKBLUE.withAlpha(0.8F), player);
frames.add(itemSelect);
ItemModelViewFrame renderframe = new ItemModelViewFrame(
itemSelect,
new MusePoint2D(absX(-0.75F), absY(-0.95f)),
new MusePoint2D(absX(0.15F), absY(-0.025f)),
Colour.LIGHTBLUE.withAlpha(0.8F),
Colour.DARKBLUE.withAlpha(0.8F));
frames.add(renderframe);
ColourPickerFrame colourpicker = new ColourPickerFrame(
new MuseRect(absX(0.18f), absY(-0.95f),
absX(0.95f), absY(-0.025f)),
Colour.LIGHTBLUE.withAlpha(0.8F),
Colour.DARKBLUE.withAlpha(0.8F),
itemSelect);
frames.add(colourpicker);
PartManipContainer partframe = new PartManipContainer(
itemSelect, colourpicker,
new MusePoint2D(absX(-0.95F), absY(0.025f)),
new MusePoint2D(absX(+0.95F), absY(0.95f)),
Colour.LIGHTBLUE.withAlpha(0.8F),
Colour.DARKBLUE.withAlpha(0.8F));
frames.add(partframe);
TabSelectFrame tabFrame = new TabSelectFrame(
player,
new MusePoint2D(absX(-0.95F), absY(-1.05f)),
new MusePoint2D(absX(0.95F), absY(-0.95f)),
worldx, worldy, worldz);
frames.add(tabFrame);
}
@Override
public void update() {
super.update();
}
@Override
public void drawScreen(int x, int y, float z) {
super.drawScreen(x, y, z);
}
}

View file

@ -169,7 +169,7 @@ public class MuseGui extends GuiScreen {
* Returns absolute screen coordinates (int 0 to width) from a relative
* coordinate (float -1.0F to +1.0F)
*
* @param relx Relative Y coordinate
* @param rely Relative Y coordinate
* @return Absolute Y coordinate
*/
public int absY(double rely) {
@ -238,10 +238,6 @@ public class MuseGui extends GuiScreen {
}
}
/**
* @param x
* @param y
*/
protected void drawToolTip() {
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

View file

@ -37,7 +37,7 @@ public class DetailedSummaryFrame extends ScrollableFrame {
energy = 0;
armor = 0;
for(ItemStack stack : MuseItemUtils.modularItemsEquipped(player)) {
energy += ModuleManager.computeModularProperty(stack, ElectricItemUtils.MAXIMUM_ENERGY());
energy += ModuleManager.computeModularProperty(stack, ElectricItemUtils.MAXIMUM_ENERGY);
armor += ModuleManager.computeModularProperty(stack, MuseCommonStrings.ARMOR_VALUE_PHYSICAL);
armor += ModuleManager.computeModularProperty(stack, MuseCommonStrings.ARMOR_VALUE_ENERGY);
}
@ -55,7 +55,7 @@ public class DetailedSummaryFrame extends ScrollableFrame {
nexty += 10;
String formattedValue = MuseStringUtils.formatNumberFromUnits(energy, PowerModule.getUnit(ElectricItemUtils.MAXIMUM_ENERGY()));
String formattedValue = MuseStringUtils.formatNumberFromUnits(energy, PowerModule.getUnit(ElectricItemUtils.MAXIMUM_ENERGY));
String name = StatCollector.translateToLocal("gui.energyStorage");
double valueWidth = MuseRenderer.getStringWidth(formattedValue);
double allowedNameWidth = border.width() - valueWidth - margin * 2;

View file

@ -150,7 +150,7 @@ public class ModuleTweakFrame extends ScrollableFrame {
if (selectedSlider != null && itemTarget.getSelectedItem() != null && moduleTarget.getSelectedModule() != null) {
ClickableItem item = itemTarget.getSelectedItem();
IPowerModule module = moduleTarget.getSelectedModule().getModule();
MusePacket tweakRequest = new MusePacketTweakRequest(player, item.inventorySlot, module.getDataName(), selectedSlider.name(),
MusePacket tweakRequest = new MusePacketTweakRequest(player, item.inventorySlot, module.getDataName(), selectedSlider.name,
selectedSlider.value());
PacketSender.sendToServer(tweakRequest.getPacket131());
}

View file

@ -16,9 +16,9 @@ public class AdvancedBatteryModule extends PowerModuleBase {
public AdvancedBatteryModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.mvcapacitor, 1));
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY(), 100000, "J");
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY, 100000, "J");
addBaseProperty(MuseCommonStrings.WEIGHT, 2000, "g");
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY(), 400000);
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY, 400000);
addTradeoffProperty("Battery Size", MuseCommonStrings.WEIGHT, 8000);
addBaseProperty(ElectricConversions.IC2_TIER(), 1);
addTradeoffProperty("IC2 Tier", ElectricConversions.IC2_TIER(), 2);

View file

@ -16,9 +16,9 @@ public class BasicBatteryModule extends PowerModuleBase {
public BasicBatteryModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.lvcapacitor, 1));
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY(), 20000, "J");
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY, 20000, "J");
addBaseProperty(MuseCommonStrings.WEIGHT, 2000, "g");
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY(), 80000);
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY, 80000);
addTradeoffProperty("Battery Size", MuseCommonStrings.WEIGHT, 8000);
addBaseProperty(ElectricConversions.IC2_TIER(), 1);
addTradeoffProperty("IC2 Tier", ElectricConversions.IC2_TIER(), 2);

View file

@ -16,9 +16,9 @@ public class EliteBatteryModule extends PowerModuleBase {
public EliteBatteryModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.hvcapacitor, 1));
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY(), 750000, "J");
addBaseProperty(ElectricItemUtils.MAXIMUM_ENERGY, 750000, "J");
addBaseProperty(MuseCommonStrings.WEIGHT, 2000, "g");
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY(), 4250000);
addTradeoffProperty("Battery Size", ElectricItemUtils.MAXIMUM_ENERGY, 4250000);
addTradeoffProperty("Battery Size", MuseCommonStrings.WEIGHT, 8000);
addBaseProperty(ElectricConversions.IC2_TIER(), 1);
addTradeoffProperty("IC2 Tier", ElectricConversions.IC2_TIER(), 2);

View file

@ -0,0 +1,53 @@
package net.machinemuse.powersuits.powermodule.misc;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import java.util.List;
/**
* Author: MachineMuse (Claire Semple)
* Created: 1:08 AM, 4/24/13
*
* Ported to Java by lehjr on 10/11/16.
*/
public class BinocularsModule extends PowerModuleBase implements IToggleableModule {
public static final String BINOCULARS_MODULE = "Binoculars";
public static final String FOV_MULTIPLIER = "Field of View";
public BinocularsModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.laserHologram, 1));
addBaseProperty(BinocularsModule.FOV_MULTIPLIER, 0.5);
addTradeoffProperty("FOV multiplier", BinocularsModule.FOV_MULTIPLIER, 9.5, "%");
}
@Override
public String getCategory() {
return MuseCommonStrings.CATEGORY_VISION;
}
@Override
public String getDataName() {
return BinocularsModule.BINOCULARS_MODULE;
}
@Override
public String getUnlocalizedName() {
return "binoculars";
}
@Override
public String getDescription() {
return "With the problems that have been plaguing Optifine lately, you've decided to take that Zoom ability into your own hands.";
}
@Override
public String getTextureFile() {
return "binoculars";
}
}

Some files were not shown because too many files have changed in this diff Show more