finished fixing compiler errors
This commit is contained in:
parent
4bd4a76e20
commit
0b277d73dc
68 changed files with 829 additions and 1196 deletions
|
@ -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, int blockID, int x, int y, int z, EntityPlayer player);
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player);
|
||||
|
||||
public void handleBreakSpeed(PlayerEvent.BreakSpeed event);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package net.machinemuse.general;
|
||||
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
|
||||
|
@ -11,6 +12,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Workaround class to access static NBTTagCompound.getTagMap()
|
||||
|
@ -63,21 +65,14 @@ public class NBTTagAccessor extends NBTTagCompound {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static List<NBTTagInt> getIntValues(NBTTagCompound nbt) {
|
||||
ArrayList<NBTTagInt> a = new ArrayList<NBTTagInt>(nbt.getTags().size());
|
||||
for (Object o : nbt.getTags()) {
|
||||
if (o instanceof NBTTagInt) {
|
||||
a.add((NBTTagInt) o);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public static List<NBTTagCompound> getValues(NBTTagCompound nbt) {
|
||||
ArrayList<NBTTagCompound> a = new ArrayList<NBTTagCompound>(nbt.getTags().size());
|
||||
for (Object o : nbt.getTags()) {
|
||||
if (o instanceof NBTTagCompound) {
|
||||
a.add((NBTTagCompound) o);
|
||||
Set<String> keyset = (Set<String>) nbt.func_150296_c();
|
||||
ArrayList<NBTTagCompound> a = new ArrayList<NBTTagCompound>(keyset.size());
|
||||
for (String key : keyset) {
|
||||
NBTBase c = nbt.getTag(key);
|
||||
if (c instanceof NBTTagCompound) {
|
||||
a.add((NBTTagCompound) c);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
|
|
|
@ -5,13 +5,14 @@ import net.machinemuse.numina.render.MuseTextureUtils;
|
|||
import net.machinemuse.numina.render.RenderState;
|
||||
import net.machinemuse.utils.render.MuseRenderer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EnergyMeter extends HeatMeter {
|
||||
public void draw(double xpos, double ypos, double value) {
|
||||
MuseTextureUtils.pushTexture(MuseTextureUtils.BLOCK_TEXTURE_QUILT());
|
||||
IIcon icon = Block.waterStill.getIcon(0, 0);
|
||||
IIcon icon = Blocks.water.getIcon(0, 0);
|
||||
GL11.glLineWidth(0.5f);
|
||||
RenderState.on2D();
|
||||
RenderState.blendingOn();
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.machinemuse.numina.render.MuseTextureUtils;
|
|||
import net.machinemuse.numina.render.RenderState;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -17,7 +18,7 @@ public class HeatMeter {
|
|||
MuseTextureUtils.pushTexture(MuseTextureUtils.BLOCK_TEXTURE_QUILT());
|
||||
RenderState.blendingOn();
|
||||
RenderState.on2D();
|
||||
IIcon icon = Block.lavaStill.getIcon(0, 0);
|
||||
IIcon icon = Blocks.lava.getIcon(0, 0);
|
||||
drawFluid(xpos, ypos, value, icon);
|
||||
drawGlass(xpos, ypos);
|
||||
RenderState.off2D();
|
||||
|
@ -40,7 +41,7 @@ public class HeatMeter {
|
|||
}
|
||||
|
||||
public void drawGlass(double xpos, double ypos) {
|
||||
MuseTextureUtils.pushTexture(Config.GLASS_TEXTURE);
|
||||
MuseTextureUtils.pushTexture(Config.GLASS_TEXTURE());
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
GL11.glTexCoord2d(0, 0);
|
||||
GL11.glVertex2d(xpos, ypos);
|
||||
|
|
|
@ -7,12 +7,10 @@ import net.machinemuse.api.ModuleManager;
|
|||
import net.machinemuse.general.gui.clickable.ClickableButton;
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.gui.clickable.ClickableModule;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.numina.geometry.Colour;
|
||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||
import net.machinemuse.numina.network.MusePacket;
|
||||
import net.machinemuse.numina.network.PacketSender;
|
||||
import net.machinemuse.numina.sound.Musique;
|
||||
import net.machinemuse.powersuits.network.packets.MusePacketInstallModuleRequest;
|
||||
import net.machinemuse.powersuits.network.packets.MusePacketSalvageModuleRequest;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
|
@ -168,7 +166,7 @@ public class InstallSalvageFrame extends ScrollableFrame {
|
|||
ItemStack stack = targetItem.getSelectedItem().getItem();
|
||||
IPowerModule module = targetModule.getSelectedModule().getModule();
|
||||
if (player.capabilities.isCreativeMode || MuseItemUtils.hasInInventory(module.getInstallCost(), player.inventory)) {
|
||||
Musique.playClientSound(SoundLoader.SOUND_GUI_INSTALL, 1);
|
||||
// Musique.playClientSound(SoundLoader.SOUND_GUI_INSTALL, 1);
|
||||
// Now send request to server to make it legit
|
||||
MusePacket newpacket = new MusePacketInstallModuleRequest(
|
||||
player,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package net.machinemuse.general.gui.frame;
|
||||
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.numina.geometry.Colour;
|
||||
import net.machinemuse.numina.geometry.FlyFromPointToPoint2D;
|
||||
import net.machinemuse.numina.geometry.GradientAndArcCalculator;
|
||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||
import net.machinemuse.numina.sound.Musique;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.machinemuse.utils.render.MuseRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -118,7 +116,7 @@ public class ItemSelectionFrame extends ScrollableFrame {
|
|||
int i = 0;
|
||||
for (ClickableItem item : itemButtons) {
|
||||
if (item.hitBox(x, y)) {
|
||||
Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
// Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
selectedItemStack = i;
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.machinemuse.numina.geometry.MusePoint2D;
|
|||
import net.machinemuse.numina.render.MuseTextureUtils;
|
||||
import net.machinemuse.numina.render.RenderState;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.control.KeybindKeyHandler;
|
||||
import net.machinemuse.powersuits.control.KeybindManager;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.machinemuse.utils.render.MuseRenderer;
|
||||
|
@ -121,7 +122,7 @@ public class KeybindConfigFrame implements IGuiFrame {
|
|||
} else if (selectedClickie != null && selectedClickie instanceof ClickableKeybinding && trashKeybindButton.hitBox(x, y)) {
|
||||
KeyBinding binding = ((ClickableKeybinding) selectedClickie).getKeyBinding();
|
||||
KeyBinding.keybindArray.remove(binding);
|
||||
KeyBinding.hash.removeObject(binding.keyCode);
|
||||
KeyBinding.hash.removeObject(binding.getKeyCode());
|
||||
KeybindManager.getKeybindings().remove(selectedClickie);
|
||||
}
|
||||
selectedClickie = null;
|
||||
|
@ -280,7 +281,7 @@ public class KeybindConfigFrame implements IGuiFrame {
|
|||
} catch (Exception e) {
|
||||
name = "???";
|
||||
}
|
||||
KeyBinding keybind = new KeyBinding(name, key);
|
||||
KeyBinding keybind = new KeyBinding(name, key, KeybindKeyHandler.mps);
|
||||
ClickableKeybinding clickie = new ClickableKeybinding(keybind, newKeybindButton.getPosition().plus(new MusePoint2D(0, -20)), free);
|
||||
KeybindManager.getKeybindings().add(clickie);
|
||||
}
|
||||
|
|
|
@ -2,14 +2,12 @@ package net.machinemuse.general.gui.frame;
|
|||
|
||||
import net.machinemuse.api.IPowerModule;
|
||||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.gui.clickable.ClickableModule;
|
||||
import net.machinemuse.numina.geometry.Colour;
|
||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||
import net.machinemuse.numina.geometry.MuseRect;
|
||||
import net.machinemuse.numina.geometry.MuseRelativeRect;
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.gui.clickable.ClickableModule;
|
||||
import net.machinemuse.numina.sound.Musique;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.utils.render.MuseRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -163,7 +161,7 @@ public class ModuleSelectionFrame extends ScrollableFrame {
|
|||
int i = 0;
|
||||
for (ClickableModule module : moduleButtons) {
|
||||
if (module.hitBox(x, y)) {
|
||||
Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
// Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
selectedModule = i;
|
||||
prevSelection = module.getModule();
|
||||
break;
|
||||
|
|
|
@ -21,7 +21,7 @@ class TabSelectFrame(p: EntityPlayer, topleft: MusePoint2D, bottomright: MusePoi
|
|||
def onMouseDown(x: Double, y: Double, button: Int): Unit = {
|
||||
for (b <- buttons) {
|
||||
if (b._1.isEnabled && b._1.hitBox(x, y)) {
|
||||
p.openGui(ModularPowersuits.INSTANCE, b._2, p.worldObj, worldx, worldy, worldz)
|
||||
p.openGui(ModularPowersuits, b._2, p.worldObj, worldx, worldy, worldz)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package net.machinemuse.general.sound;
|
||||
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.SubscribeEvent;
|
||||
|
||||
public class SoundLoader {
|
||||
/**
|
||||
* Sounds
|
||||
|
@ -32,15 +28,15 @@ public class SoundLoader {
|
|||
public static final String SOUND_SWIMASSIST = SOUND_PREFIX + "SwimAssist";
|
||||
public static final String SOUND_ELECTROLYZER = SOUND_PREFIX + "WaterElectrolyzer";
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSoundLoad(SoundLoadEvent event) {
|
||||
for (String soundFile : soundFiles) {
|
||||
try {
|
||||
event.manager.addSound(soundFile);
|
||||
MuseLogger.logDebug("MMMPS registered sound: " + soundFile);
|
||||
} catch (Exception e) {
|
||||
MuseLogger.logError("Failed to register sound:" + soundFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @SubscribeEvent
|
||||
// public void onSoundLoad(SoundLoadEvent event) { // Musique
|
||||
// for (String soundFile : soundFiles) {
|
||||
// try {
|
||||
// event.addSound(soundFile);
|
||||
// MuseLogger.logDebug("MMMPS registered sound: " + soundFile);
|
||||
// } catch (Exception e) {
|
||||
// MuseLogger.logError("Failed to register sound:" + soundFile);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -57,11 +57,11 @@ public class BlockLuxCapacitor extends Block {
|
|||
// a different toolclass. par3 is the minimum level of item required to
|
||||
// break it:
|
||||
// 0=bare hands, 1=wood, 2=stone, 3=iron, 4=diamond
|
||||
MinecraftForge.setBlockHarvestLevel(this, "pickaxe", 0);
|
||||
// MinecraftForge.setBlockHarvestLevel(this, "pickaxe", 0);
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityLuxCapacitor.class, "luxCapacitor");
|
||||
|
||||
setUnlocalizedName("luxCapacitor");
|
||||
setBlockName("luxCapacitor");
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class BlockLuxCapacitor extends Block {
|
|||
double x2 = bbMax(dir.offsetX);
|
||||
double y2 = bbMax(dir.offsetY);
|
||||
double z2 = bbMax(dir.offsetZ);
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + x1, y + y1, z + z1, x + x2, y + y2, z + z2);
|
||||
return AxisAlignedBB.getBoundingBox(x + x1, y + y1, z + z1, x + x2, y + y2, z + z2);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
package net.machinemuse.powersuits.block;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.machinemuse.general.gui.MuseIcon;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
/**
|
||||
* This is the tinkertable block. It doesn't do much except look pretty
|
||||
* (eventually) and provide a way for the player to access the TinkerTable GUI.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*
|
||||
*/
|
||||
public class BlockTinkerTable extends Block {
|
||||
protected int renderType;
|
||||
public static int assignedBlockID;
|
||||
public static IIcon energyIcon;
|
||||
|
||||
public BlockTinkerTable setRenderType(int id) {
|
||||
this.renderType = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Reads all the block info from Config.
|
||||
*/
|
||||
public BlockTinkerTable() {
|
||||
// Block constructor call
|
||||
super(
|
||||
// Block ID
|
||||
assignedBlockID,
|
||||
// Material (used for various things like whether it can burn,
|
||||
// whether it requires a tool, and whether it can be moved by a
|
||||
// piston
|
||||
Material.iron);
|
||||
|
||||
// Block's internal/ID name
|
||||
// setBlockName(Config.Blocks.TinkerTable.idName);
|
||||
|
||||
// Block's creative tab
|
||||
setCreativeTab(Config.getCreativeTab());
|
||||
|
||||
// Block's hardness (base time to harvest it with the correct tool).
|
||||
// Sand = 0.5, Stone = 1.5, Ore = 3.0 Obsidian = 20
|
||||
setHardness(1.5F);
|
||||
|
||||
// Block's resistance to explosions. Stone = 10, obsidian = 2000
|
||||
setResistance(1000.0F);
|
||||
|
||||
// Sound to play when player steps on the block
|
||||
setStepSound(Block.soundMetalFootstep);
|
||||
|
||||
// How much light is stopped by this block; 0 for air, 255 for fully
|
||||
// opaque.
|
||||
setLightOpacity(0);
|
||||
|
||||
// Light level, 0-1. Gets multiplied by 15 and truncated to find the
|
||||
// actual light level for the block.
|
||||
setLightValue(0.4f);
|
||||
|
||||
// Whether to receive random ticks e.g. plants
|
||||
setTickRandomly(false);
|
||||
|
||||
// Harvest level for this block. par2 can be pickaxe, axe, or shovel, or
|
||||
// a different toolclass. par3 is the minimum level of item required to
|
||||
// break it:
|
||||
// 0=bare hands, 1=wood, 2=stone, 3=iron, 4=diamond
|
||||
MinecraftForge.setBlockHarvestLevel(this, "pickaxe", 0);
|
||||
|
||||
// Register the tile entity, which is only used for rendering at the
|
||||
// moment
|
||||
GameRegistry.registerTileEntity(TileEntityTinkerTable.class, "tinkerTable");
|
||||
|
||||
|
||||
setUnlocalizedName("tinkerTable");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(MuseIcon.ICON_PREFIX + "heatresistantplating");
|
||||
energyIcon = blockIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
player.openGui(ModularPowersuits.INSTANCE, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns some value from 0 to 30 or so for different models. Since we're
|
||||
* using a custom renderer, we pass in a completely different ID: the
|
||||
* assigned block ID. It won't conflict with other mods, since Forge looks
|
||||
* it up in a table anyway, but it's still best to have different internal
|
||||
* IDs.
|
||||
*/
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called on a block after all other blocks gets already
|
||||
* created. You can use it to reference and configure something on the block
|
||||
* that needs the others ones.
|
||||
*/
|
||||
@Override
|
||||
protected void initializeBlock() {
|
||||
}
|
||||
|
||||
/**
|
||||
* If this block doesn't render as an ordinary block it will return False
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Returns true if the given side of this block type should be
|
||||
* rendered (if it's solid or not), if the adjacent block is at the given
|
||||
* coordinates. Args: blockAccess, x, y, z, side
|
||||
*/
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this block (a) opaque and (b) a full 1m cube? This determines whether
|
||||
* or not to render the shared face of two adjacent blocks and also
|
||||
* whether the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called throughout the code as a replacement for block instanceof
|
||||
* BlockContainer Moving this to the Block base class allows for mods that
|
||||
* wish
|
||||
* to extend vinella blocks, and also want to have a tile entity on that
|
||||
* block, may.
|
||||
*
|
||||
* Return true from this function to specify this block has a tile entity.
|
||||
*
|
||||
* @param metadata
|
||||
* Metadata of the current block
|
||||
* @return True if block has a tile entity, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called throughout the code as a replacement for
|
||||
* BlockContainer.getBlockEntity Return the same thing you would from that
|
||||
* function. This will
|
||||
* fall back to BlockContainer.getBlockEntity if this block is a
|
||||
* BlockContainer.
|
||||
*
|
||||
* @param metadata
|
||||
* The Metadata of the current block
|
||||
* @return A instance of a class extending TileEntity
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityTinkerTable();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Location aware and overrideable version of the lightOpacity array, return
|
||||
* the number to subtract from the light value when it passes through
|
||||
* this block.
|
||||
*
|
||||
* This is not guaranteed to have the tile entity in place before this is
|
||||
* called, so it is Recommended that you have your tile entity call relight
|
||||
* after being placed if you rely on it for light info.
|
||||
*
|
||||
* @param world
|
||||
* The current world
|
||||
* @param x
|
||||
* X Position
|
||||
* @param y
|
||||
* Y Position
|
||||
* @param z
|
||||
* Z position
|
||||
* @return The amount of light to block, 0 for air, 255 for fully opaque.
|
||||
*/
|
||||
@Override
|
||||
public int getLightOpacity(World world, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package net.machinemuse.powersuits.block
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.machinemuse.general.gui.MuseIcon
|
||||
import net.machinemuse.powersuits.common.Config
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.IBlockAccess
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
|
||||
/**
|
||||
* This is the tinkertable block. It doesn't do much except look pretty
|
||||
* (eventually) and provide a way for the player to access the TinkerTable GUI.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*
|
||||
*/
|
||||
object BlockTinkerTable extends Block(Material.iron) {
|
||||
setCreativeTab(Config.getCreativeTab)
|
||||
setHardness(1.5F)
|
||||
setResistance(1000.0F)
|
||||
setStepSound(Block.soundTypeMetal)
|
||||
setLightOpacity(0)
|
||||
setLightLevel(0.4f)
|
||||
setTickRandomly(false)
|
||||
GameRegistry.registerTileEntity(classOf[TileEntityTinkerTable], "tinkerTable")
|
||||
setBlockName("tinkerTable")
|
||||
var energyIcon: IIcon = null
|
||||
|
||||
def setRenderType(id: Int) = {
|
||||
this.renderType = id
|
||||
this
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) def registerIcons(iconRegister: IIconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(MuseIcon.ICON_PREFIX + "heatresistantplating")
|
||||
energyIcon = blockIcon
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, par6: Int, par7: Float, par8: Float, par9: Float): Boolean = {
|
||||
if (player.isSneaking) {
|
||||
return false
|
||||
}
|
||||
player.openGui(ModularPowersuits, 0, world, x, y, z)
|
||||
true
|
||||
}
|
||||
|
||||
/**
|
||||
* returns some value from 0 to 30 or so for different models. Since we're
|
||||
* using a custom renderer, we pass in a completely different ID: the
|
||||
* assigned block ID. It won't conflict with other mods, since Forge looks
|
||||
* it up in a table anyway, but it's still best to have different internal
|
||||
* IDs.
|
||||
*/
|
||||
protected var renderType: Int = 0
|
||||
|
||||
override def getRenderType: Int = renderType
|
||||
|
||||
/**
|
||||
* This method is called on a block after all other blocks gets already
|
||||
* created. You can use it to reference and configure something on the block
|
||||
* that needs the others ones.
|
||||
*/
|
||||
protected def initializeBlock {
|
||||
}
|
||||
|
||||
/**
|
||||
* If this block doesn't render as an ordinary block it will return False
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
override def renderAsNormalBlock: Boolean = false
|
||||
|
||||
/**
|
||||
* Returns Returns true if the given side of this block type should be
|
||||
* rendered (if it's solid or not), if the adjacent block is at the given
|
||||
* coordinates. Args: blockAccess, x, y, z, side
|
||||
*/
|
||||
override def isBlockSolid(par1IBlockAccess: IBlockAccess, par2: Int, par3: Int, par4: Int, par5: Int): Boolean = true
|
||||
|
||||
/**
|
||||
* Is this block (a) opaque and (b) a full 1m cube? This determines whether
|
||||
* or not to render the shared face of two adjacent blocks and also
|
||||
* whether the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
override def isOpaqueCube: Boolean = false
|
||||
/**
|
||||
* Called throughout the code as a replacement for block instanceof
|
||||
* BlockContainer Moving this to the Block base class allows for mods that
|
||||
* wish
|
||||
* to extend vinella blocks, and also want to have a tile entity on that
|
||||
* block, may.
|
||||
*
|
||||
* Return true from this function to specify this block has a tile entity.
|
||||
*
|
||||
* @param metadata
|
||||
* Metadata of the current block
|
||||
* @return True if block has a tile entity, false otherwise
|
||||
*/
|
||||
override def hasTileEntity(metadata: Int): Boolean = true
|
||||
|
||||
/**
|
||||
* Called throughout the code as a replacement for
|
||||
* BlockContainer.getBlockEntity Return the same thing you would from that
|
||||
* function. This will
|
||||
* fall back to BlockContainer.getBlockEntity if this block is a
|
||||
* BlockContainer.
|
||||
*
|
||||
* @param metadata
|
||||
* The Metadata of the current block
|
||||
* @return A instance of a class extending TileEntity
|
||||
*/
|
||||
override def createTileEntity(world: World, metadata: Int): TileEntity = new TileEntityTinkerTable
|
||||
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
package net.machinemuse.powersuits.client;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.machinemuse.numina.network.MusePacket;
|
||||
import net.machinemuse.numina.network.MusePacketHandler;
|
||||
import net.machinemuse.numina.network.MusePacketModeChangeRequest;
|
||||
import net.machinemuse.numina.network.PacketSender;
|
||||
import net.machinemuse.numina.render.RenderGameOverlayEventHandler;
|
||||
import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
|
||||
import net.machinemuse.powersuits.block.TileEntityTinkerTable;
|
||||
import net.machinemuse.powersuits.client.render.block.RenderLuxCapacitorTESR;
|
||||
import net.machinemuse.powersuits.client.render.block.TinkerTableRenderer;
|
||||
import net.machinemuse.powersuits.client.render.entity.RenderLuxCapacitorEntity;
|
||||
import net.machinemuse.powersuits.client.render.entity.RenderPlasmaBolt;
|
||||
import net.machinemuse.powersuits.client.render.entity.RenderSpinningBlade;
|
||||
import net.machinemuse.powersuits.client.render.item.ToolRenderer;
|
||||
import net.machinemuse.powersuits.client.render.modelspec.ModelSpecXMLReader;
|
||||
import net.machinemuse.powersuits.common.CommonProxy;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits;
|
||||
import net.machinemuse.powersuits.control.KeybindKeyHandler;
|
||||
import net.machinemuse.powersuits.control.KeybindManager;
|
||||
import net.machinemuse.powersuits.entity.EntityLuxCapacitor;
|
||||
import net.machinemuse.powersuits.entity.EntityPlasmaBolt;
|
||||
import net.machinemuse.powersuits.entity.EntitySpinningBlade;
|
||||
import net.machinemuse.powersuits.event.PlayerUpdateHandler;
|
||||
import net.machinemuse.powersuits.event.RenderEventHandler;
|
||||
import net.machinemuse.powersuits.tick.ClientTickHandler;
|
||||
import net.machinemuse.utils.render.MuseShaders;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* The Client Proxy does all the things that should only be done client-side,
|
||||
* like registering client-side handlers and renderers.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
public class ClientProxy extends CommonProxy {
|
||||
private static ToolRenderer toolRenderer;
|
||||
public static KeybindKeyHandler keybindHandler;
|
||||
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
MinecraftForge.EVENT_BUS.register(new SoundLoader());
|
||||
// if (ModCompatability.isThaumCraftLoaded() && ModCompatability.enableThaumGogglesModule()) {
|
||||
// MinecraftForge.EVENT_BUS.register(new ThaumRenderEventHandler());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all the custom renderers for this mod.
|
||||
*/
|
||||
@Override
|
||||
public void registerRenderers() {
|
||||
toolRenderer = new ToolRenderer();
|
||||
MinecraftForgeClient.registerItemRenderer(ModularPowersuits.powerTool, toolRenderer);
|
||||
|
||||
int tinkTableRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
TinkerTableRenderer tinkTableRenderer = new TinkerTableRenderer(tinkTableRenderID);
|
||||
ModularPowersuits.tinkerTable.setRenderType(tinkTableRenderID);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTinkerTable.class, tinkTableRenderer);
|
||||
RenderingRegistry.registerBlockHandler(tinkTableRenderer);
|
||||
|
||||
int luxCapacitorRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderLuxCapacitorTESR luxCapacitorRenderer = new RenderLuxCapacitorTESR(luxCapacitorRenderID);
|
||||
ModularPowersuits.luxCapacitor.setRenderType(luxCapacitorRenderID);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLuxCapacitor.class, luxCapacitorRenderer);
|
||||
RenderingRegistry.registerBlockHandler(luxCapacitorRenderer);
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPlasmaBolt.class, new RenderPlasmaBolt());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpinningBlade.class, new RenderSpinningBlade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLuxCapacitor.class, new RenderLuxCapacitorEntity());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
|
||||
URL resource = ClientProxy.class.getResource(Config.RESOURCE_PREFIX + "models/modelspec.xml");
|
||||
ModelSpecXMLReader.parseFile(resource);
|
||||
URL otherResource = ClientProxy.class.getResource(Config.RESOURCE_PREFIX + "models/armor2.xml");
|
||||
ModelSpecXMLReader.parseFile(otherResource);
|
||||
|
||||
|
||||
// ModelSpecJSONWriter.writeRegistry("modelspec.json");
|
||||
try {
|
||||
MuseShaders.hBlurProgram().program();
|
||||
Config.canUseShaders = true;
|
||||
} catch (Throwable e) {
|
||||
MuseLogger.logException("Loading shaders failed!", e);
|
||||
}
|
||||
// DefaultModelSpec.loadDefaultModel();
|
||||
// ModelSpecXMLWriter.writeRegistry("modelspec.xml");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the tick handler (for on-tick behaviour) and packet handler (for
|
||||
* network synchronization and permission stuff).
|
||||
*/
|
||||
@Override
|
||||
public void registerHandlers() {
|
||||
super.registerHandlers();
|
||||
keybindHandler = new KeybindKeyHandler();
|
||||
FMLCommonHandler.instance().bus().register(keybindHandler);
|
||||
|
||||
PlayerUpdateHandler playerTickHandler = new PlayerUpdateHandler();
|
||||
MinecraftForge.EVENT_BUS.register(playerTickHandler);
|
||||
// TickRegistry.registerTickHandler(playerTickHandler, Side.SERVER);
|
||||
|
||||
ClientTickHandler clientTickHandler = new ClientTickHandler();
|
||||
FMLCommonHandler.instance().bus().register(clientTickHandler);
|
||||
|
||||
|
||||
packetHandler = MusePacketHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
KeybindManager.readInKeybinds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendModeChange(int dMode, String newMode) {
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
RenderGameOverlayEventHandler.updateSwap((int) Math.signum(dMode));
|
||||
MusePacket modeChangePacket = new MusePacketModeChangeRequest(player, newMode, player.inventory.currentItem);
|
||||
PacketSender.sendToServer(modeChangePacket);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package net.machinemuse.powersuits.client.render.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.machinemuse.numina.geometry.Colour;
|
||||
import net.machinemuse.numina.render.MuseTESR;
|
||||
import net.machinemuse.numina.render.RenderState;
|
||||
|
@ -9,8 +8,8 @@ import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
|
|||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
@ -29,14 +28,14 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
|
|||
|
||||
public static WavefrontObject getLightModel() {
|
||||
if (lightmodel == null) {
|
||||
lightmodel = (WavefrontObject) AdvancedModelLoader.loadModel(Config.RESOURCE_PREFIX + "models/lightCore.obj");
|
||||
lightmodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightCore.obj"));
|
||||
}
|
||||
return lightmodel;
|
||||
}
|
||||
|
||||
public static WavefrontObject getFrameModel() {
|
||||
if (framemodel == null) {
|
||||
framemodel = (WavefrontObject) AdvancedModelLoader.loadModel(Config.RESOURCE_PREFIX + "models/lightBase.obj");
|
||||
framemodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightBase.obj"));
|
||||
}
|
||||
return framemodel;
|
||||
}
|
||||
|
@ -44,7 +43,7 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
|
|||
@Override
|
||||
public void renderAt(TileEntity undifferentiatedtileentity, double x, double y, double z, float partialTickTime) {
|
||||
TileEntityLuxCapacitor tileentity = (TileEntityLuxCapacitor) undifferentiatedtileentity;
|
||||
this.bindTextureByName(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
|
||||
this.bindTextureByName(Config.TEXTURE_PREFIX() + "models/thusters_uvw_2.png");
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
double scale = 0.0625;
|
||||
|
@ -77,21 +76,17 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
|
|||
break;
|
||||
|
||||
}
|
||||
if (!Tessellator.instance.isDrawing) {
|
||||
getFrameModel().renderAll();
|
||||
RenderState.glowOn();
|
||||
new Colour(tileentity.red, tileentity.green, tileentity.blue, 1.0).doGL();
|
||||
getLightModel().renderAll();
|
||||
RenderState.glowOff();
|
||||
} else {
|
||||
MuseLogger.logError("Error: tessellator not flushed properly when MPS got ahold of it!");
|
||||
}
|
||||
getFrameModel().renderAll();
|
||||
RenderState.glowOn();
|
||||
new Colour(tileentity.red, tileentity.green, tileentity.blue, 1.0).doGL();
|
||||
getLightModel().renderAll();
|
||||
RenderState.glowOff();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
this.bindTextureByName(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
|
||||
this.bindTextureByName(Config.TEXTURE_PREFIX() + "models/thusters_uvw_2.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-0.5, -0.5 + -1.0 / 16.0, -0.5);
|
||||
|
||||
|
@ -115,7 +110,7 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderi
|
|||
|
||||
@Override
|
||||
public void renderAt(TileEntity tileEntity, double x, double y, double z, float partialTickTime) {
|
||||
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH);
|
||||
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH());
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderi
|
|||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH);
|
||||
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH());
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-0.5, -0.5 + -1.0 / 16.0, -0.5);
|
||||
model.doRender(null, 0, 0, 0, 0, 0);
|
||||
|
@ -65,7 +65,7 @@ public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderi
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.machinemuse.numina.render.RenderState;
|
|||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.entity.EntityLuxCapacitor;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
|
@ -17,14 +18,14 @@ public class RenderLuxCapacitorEntity extends MuseRender {
|
|||
|
||||
public static WavefrontObject getLightModel() {
|
||||
if (lightmodel == null) {
|
||||
lightmodel = (WavefrontObject) AdvancedModelLoader.loadModel(Config.RESOURCE_PREFIX + "models/lightCore.obj");
|
||||
lightmodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightCore.obj"));
|
||||
}
|
||||
return lightmodel;
|
||||
}
|
||||
|
||||
public static WavefrontObject getFrameModel() {
|
||||
if (framemodel == null) {
|
||||
framemodel = (WavefrontObject) AdvancedModelLoader.loadModel(Config.RESOURCE_PREFIX + "models/lightBase.obj");
|
||||
framemodel = (WavefrontObject) AdvancedModelLoader.loadModel(new ResourceLocation(Config.RESOURCE_PREFIX() + "models/lightBase.obj"));
|
||||
}
|
||||
return framemodel;
|
||||
}
|
||||
|
@ -32,7 +33,7 @@ public class RenderLuxCapacitorEntity extends MuseRender {
|
|||
@Override
|
||||
public void doRender(Entity undifferentiatedentity, double x, double y, double z, float yaw, float partialTickTime) {
|
||||
EntityLuxCapacitor entity = (EntityLuxCapacitor) undifferentiatedentity;
|
||||
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
|
||||
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX() + "models/thusters_uvw_2.png");
|
||||
glPushMatrix();
|
||||
glTranslated(x, y, z);
|
||||
double scale = 0.0625;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class RenderSpinningBlade extends MuseRender {
|
|||
glPushMatrix();
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_CULL_FACE);
|
||||
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX + "items/spinningblade.png");
|
||||
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX() + "items/spinningblade.png");
|
||||
glTranslated(x, y, z);
|
||||
double motionscale = Math.sqrt(entity.motionZ * entity.motionZ + entity.motionX * entity.motionX);
|
||||
glRotatef(90, 1, 0, 0);
|
||||
|
|
|
@ -370,7 +370,7 @@ public class ToolModel extends ModelBase {
|
|||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
MuseTextureUtils.pushTexture(Config.SEBK_TOOL_TEXTURE);
|
||||
MuseTextureUtils.pushTexture(Config.SEBK_TOOL_TEXTURE());
|
||||
|
||||
if (c1 != null) {
|
||||
c1.doGL();
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.machinemuse.powersuits.client.render.item;
|
|||
import net.machinemuse.numina.geometry.Colour;
|
||||
import net.machinemuse.numina.render.MuseIconUtils;
|
||||
import net.machinemuse.powersuits.client.render.entity.MuseRender;
|
||||
import net.machinemuse.powersuits.common.MPSItems;
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits;
|
||||
import net.machinemuse.powersuits.item.ItemPowerFist;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -71,7 +72,7 @@ public class ToolRenderer extends MuseRender implements IItemRenderer {
|
|||
break;
|
||||
case INVENTORY:
|
||||
RenderBlocks renderInventory = (RenderBlocks) data[0];
|
||||
MuseIconUtils.drawIconAt(0, 0, ModularPowersuits.powerTool.getIconIndex(itemStack), colour);
|
||||
MuseIconUtils.drawIconAt(0, 0, MPSItems.powerTool().getIconIndex(itemStack), colour);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
RenderBlocks renderEquipped = (RenderBlocks) data[0];
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package net.machinemuse.powersuits.common;
|
||||
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.machinemuse.numina.network.MusePacketHandler;
|
||||
import net.machinemuse.powersuits.network.packets.MPSPacketList;
|
||||
import net.machinemuse.powersuits.tick.PlayerTickHandler;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Common side of the proxy. Provides functions which
|
||||
* the ClientProxy and ServerProxy will override if the behaviour is different for client and
|
||||
* server, and keeps some common behaviour.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
public class CommonProxy {
|
||||
public static String ITEMS_PNG = "/tutorial/generic/items.png";
|
||||
public static String BLOCK_PNG = "/tutorial/generic/block.png";
|
||||
|
||||
public void registerEvents() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Only the client needs to register renderers.
|
||||
*/
|
||||
public void registerRenderers() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the server-side tickhandler and packethandler.
|
||||
*/
|
||||
public void registerHandlers() {
|
||||
playerTickHandler = new PlayerTickHandler();
|
||||
TickRegistry.registerTickHandler(playerTickHandler, Side.SERVER);
|
||||
|
||||
MPSPacketList.registerPackets();
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
}
|
||||
|
||||
public static URL getResource(String url) {
|
||||
return CommonProxy.class.getResource(url);
|
||||
}
|
||||
|
||||
public void sendModeChange(int dMode, String newMode) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import java.net.URL
|
||||
|
||||
import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
|
||||
import cpw.mods.fml.common.FMLCommonHandler
|
||||
import net.machinemuse.general.sound.SoundLoader
|
||||
import net.machinemuse.numina.general.MuseLogger
|
||||
import net.machinemuse.numina.network.{MusePacket, MusePacketHandler, MusePacketModeChangeRequest, PacketSender}
|
||||
import net.machinemuse.numina.render.RenderGameOverlayEventHandler
|
||||
import net.machinemuse.powersuits.block.{BlockTinkerTable, TileEntityLuxCapacitor, TileEntityTinkerTable}
|
||||
import net.machinemuse.powersuits.client.render.block.{RenderLuxCapacitorTESR, TinkerTableRenderer}
|
||||
import net.machinemuse.powersuits.client.render.entity.{RenderLuxCapacitorEntity, RenderPlasmaBolt, RenderSpinningBlade}
|
||||
import net.machinemuse.powersuits.client.render.item.ToolRenderer
|
||||
import net.machinemuse.powersuits.client.render.modelspec.ModelSpecXMLReader
|
||||
import net.machinemuse.powersuits.control.{KeybindKeyHandler, KeybindManager}
|
||||
import net.machinemuse.powersuits.entity.{EntityLuxCapacitor, EntityPlasmaBolt, EntitySpinningBlade}
|
||||
import net.machinemuse.powersuits.event.{ClientTickHandler, PlayerLoginHandlerThingy, PlayerUpdateHandler, RenderEventHandler}
|
||||
import net.machinemuse.utils.render.MuseShaders
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP
|
||||
import net.minecraftforge.client.MinecraftForgeClient
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
|
||||
/**
|
||||
* Common side of the proxy. Provides functions which
|
||||
* the ClientProxy and ServerProxy will override if the behaviour is different for client and
|
||||
* server, and keeps some common behaviour.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
object CommonProxy {
|
||||
def getResource(url: String): URL = {
|
||||
return classOf[CommonProxy].getResource(url)
|
||||
}
|
||||
}
|
||||
|
||||
trait CommonProxy {
|
||||
def registerEvents() {}
|
||||
|
||||
def registerRenderers() {}
|
||||
|
||||
def registerHandlers() {}
|
||||
|
||||
def postInit() {}
|
||||
|
||||
def sendModeChange(dMode: Int, newMode: String) {}
|
||||
}
|
||||
|
||||
object ClientProxy {
|
||||
private var toolRenderer: ToolRenderer = null
|
||||
var keybindHandler: KeybindKeyHandler = null
|
||||
}
|
||||
|
||||
class ClientProxy extends CommonProxy {
|
||||
override def registerEvents {
|
||||
MinecraftForge.EVENT_BUS.register(new SoundLoader)
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all the custom renderers for this mod.
|
||||
*/
|
||||
override def registerRenderers {
|
||||
MinecraftForgeClient.registerItemRenderer(MPSItems.powerTool, new ToolRenderer)
|
||||
val tinkTableRenderID: Int = RenderingRegistry.getNextAvailableRenderId
|
||||
val tinkTableRenderer: TinkerTableRenderer = new TinkerTableRenderer(tinkTableRenderID)
|
||||
BlockTinkerTable.setRenderType(tinkTableRenderID)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileEntityTinkerTable], tinkTableRenderer)
|
||||
RenderingRegistry.registerBlockHandler(tinkTableRenderer)
|
||||
val luxCapacitorRenderID: Int = RenderingRegistry.getNextAvailableRenderId
|
||||
val luxCapacitorRenderer: RenderLuxCapacitorTESR = new RenderLuxCapacitorTESR(luxCapacitorRenderID)
|
||||
MPSItems.luxCapacitor.setRenderType(luxCapacitorRenderID)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileEntityLuxCapacitor], luxCapacitorRenderer)
|
||||
RenderingRegistry.registerBlockHandler(luxCapacitorRenderer)
|
||||
RenderingRegistry.registerEntityRenderingHandler(classOf[EntityPlasmaBolt], new RenderPlasmaBolt)
|
||||
RenderingRegistry.registerEntityRenderingHandler(classOf[EntitySpinningBlade], new RenderSpinningBlade)
|
||||
RenderingRegistry.registerEntityRenderingHandler(classOf[EntityLuxCapacitor], new RenderLuxCapacitorEntity)
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler)
|
||||
val resource: URL = classOf[ClientProxy].getResource(Config.RESOURCE_PREFIX + "models/modelspec.xml")
|
||||
ModelSpecXMLReader.parseFile(resource)
|
||||
val otherResource: URL = classOf[ClientProxy].getResource(Config.RESOURCE_PREFIX + "models/armor2.xml")
|
||||
ModelSpecXMLReader.parseFile(otherResource)
|
||||
try {
|
||||
val x = MuseShaders.hBlurProgram.program // want this to initialize :s
|
||||
Config.canUseShaders = true
|
||||
}
|
||||
catch {
|
||||
case e: Throwable => {
|
||||
MuseLogger.logException("Loading shaders failed!", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the tick handler (for on-tick behaviour) and packet handler (for
|
||||
* network synchronization and permission stuff).
|
||||
*/
|
||||
override def registerHandlers {
|
||||
FMLCommonHandler.instance.bus.register(new KeybindKeyHandler)
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler)
|
||||
FMLCommonHandler.instance.bus.register(new ClientTickHandler)
|
||||
val packetHandler: MusePacketHandler.type = MusePacketHandler
|
||||
}
|
||||
|
||||
override def postInit() {
|
||||
KeybindManager.readInKeybinds()
|
||||
}
|
||||
|
||||
override def sendModeChange(dMode: Int, newMode: String) {
|
||||
val player: EntityClientPlayerMP = Minecraft.getMinecraft.thePlayer
|
||||
RenderGameOverlayEventHandler.updateSwap(Math.signum(dMode).asInstanceOf[Int])
|
||||
val modeChangePacket: MusePacket = new MusePacketModeChangeRequest(player, newMode, player.inventory.currentItem)
|
||||
PacketSender.sendToServer(modeChangePacket)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ServerProxy extends CommonProxy {
|
||||
override def registerEvents {
|
||||
FMLCommonHandler.instance().bus().register(PlayerLoginHandlerThingy)
|
||||
}
|
||||
|
||||
override def registerHandlers() {
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler)
|
||||
}
|
||||
}
|
|
@ -1,295 +0,0 @@
|
|||
package net.machinemuse.powersuits.common;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.api.IPowerModule;
|
||||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.powersuits.block.BlockLuxCapacitor;
|
||||
import net.machinemuse.powersuits.block.BlockTinkerTable;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
import net.machinemuse.powersuits.powermodule.armor.BasicPlatingModule;
|
||||
import net.machinemuse.powersuits.powermodule.armor.DiamondPlatingModule;
|
||||
import net.machinemuse.powersuits.powermodule.armor.EnergyShieldModule;
|
||||
import net.machinemuse.powersuits.powermodule.armor.HeatSinkModule;
|
||||
import net.machinemuse.powersuits.powermodule.energy.AdvancedBatteryModule;
|
||||
import net.machinemuse.powersuits.powermodule.energy.BasicBatteryModule;
|
||||
import net.machinemuse.powersuits.powermodule.energy.EliteBatteryModule;
|
||||
import net.machinemuse.powersuits.powermodule.misc.*;
|
||||
import net.machinemuse.powersuits.powermodule.movement.*;
|
||||
import net.machinemuse.powersuits.powermodule.tool.*;
|
||||
import net.machinemuse.powersuits.powermodule.weapon.BladeLauncherModule;
|
||||
import net.machinemuse.powersuits.powermodule.weapon.MeleeAssistModule;
|
||||
import net.machinemuse.powersuits.powermodule.weapon.PlasmaCannonModule;
|
||||
import net.machinemuse.powersuits.powermodule.weapon.RailgunModule;
|
||||
import net.machinemuse.utils.MuseStringUtils;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Initial attempt at storing all tweakable/configurable values in one class.
|
||||
* This got really messy really fast so it's in the process of being
|
||||
* reworked.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
public class Config {
|
||||
public static final String RESOURCE_PREFIX = "/assets/powersuits/";
|
||||
public static final String TEXTURE_PREFIX = "powersuits:textures/";
|
||||
public static final String SOUND_PREFIX = RESOURCE_PREFIX + "sound/";
|
||||
public static final String LANG_PREFIX = RESOURCE_PREFIX + "lang/";
|
||||
// public static final String SEBK_ICON_PATH =
|
||||
// "/mods/mmmPowersuits//machinemuse/sebkicons.png";
|
||||
public static final String SEBK_ARMOR_PATH = TEXTURE_PREFIX + "models/sebkarmor.png";
|
||||
public static final String SEBK_ARMORPANTS_PATH = TEXTURE_PREFIX + "models/sebkarmorpants.png";
|
||||
// public static final String WC_ICON_PATH =
|
||||
// "/resources/machinemuse/watericons.png";
|
||||
public static final String TINKERTABLE_TEXTURE_PATH = TEXTURE_PREFIX + "models/tinkertable_tx.png";
|
||||
public static final String ARMOR_TEXTURE_PATH = TEXTURE_PREFIX + "models/diffuse.png";
|
||||
public static final String BLANK_ARMOR_MODEL_PATH = TEXTURE_PREFIX + "models/blankarmor.png";
|
||||
// public static final String MUSE_ICON_PATH =
|
||||
// "/resources/machinemuse/museicons.png";
|
||||
public static final String SEBK_TOOL_TEXTURE = TEXTURE_PREFIX + "models/tool.png";
|
||||
public static final String LIGHTNING_TEXTURE = TEXTURE_PREFIX + "gui/lightning-medium.png";
|
||||
public static final String CITIZENJOE_ARMOR_PATH = TEXTURE_PREFIX + "models/joearmor.png";
|
||||
public static final String CITIZENJOE_ARMORPANTS_PATH = TEXTURE_PREFIX + "models/joearmorpants.png";
|
||||
public static final String GLASS_TEXTURE = TEXTURE_PREFIX + "gui/glass.png";
|
||||
|
||||
public static File configFolder;
|
||||
|
||||
public static int helmID;
|
||||
public static int chestID;
|
||||
public static int legsID;
|
||||
public static int bootsID;
|
||||
public static int fistID;
|
||||
|
||||
private static Configuration config;
|
||||
|
||||
/**
|
||||
* Called in the pre-init phase of initialization, informs Forge that we
|
||||
* want the following blockIDs.
|
||||
*
|
||||
* @param config The Forge configuration object which will handle such
|
||||
* requests.
|
||||
*/
|
||||
public static void init(Configuration config) {
|
||||
Config.config = config;
|
||||
config.load();
|
||||
|
||||
BlockTinkerTable.assignedBlockID = config.getBlock("Power Armor Tinker Table", 2477).getInt();
|
||||
BlockLuxCapacitor.assignedBlockID = config.getBlock("Lux Capacitor", 2478).getInt();
|
||||
|
||||
ItemComponent.assignedItemID = config.getItem("Power Armor Component", 24770).getInt();
|
||||
helmID = config.getItem("Power Armor Head", 24771).getInt();
|
||||
chestID = config.getItem("Power Armor Torso", 24772).getInt();
|
||||
legsID = config.getItem("Power Armor Legs", 24773).getInt();
|
||||
bootsID = config.getItem("Power Armor Feet", 24774).getInt();
|
||||
fistID = config.getItem("Power Tool", 24775).getInt();
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* The packet channel for this mod. We will only listen for and send packets
|
||||
* on this 'channel'. Max of 16 characters.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getNetworkChannelName() {
|
||||
return "powerSuits";
|
||||
}
|
||||
|
||||
/**
|
||||
* The default creative tab to add all these items to. This behaviour may
|
||||
* change if more items are added, but for now there are only 5 items and 1
|
||||
* block, so misc is the most appropriate target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static CreativeTabs getCreativeTab() {
|
||||
return MuseCreativeTab.instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Chance of each item being returned when salvaged.
|
||||
*
|
||||
* @return percent chance, 0.0 to 1.0
|
||||
*/
|
||||
public static double getSalvageChance() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Salvage Ratio", 0.9).getDouble(0.9);
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum amount of armor contribution allowed per armor piece. Total
|
||||
* armor when the full set is worn can never exceed 4 times this amount.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static double getMaximumArmorPerPiece() {
|
||||
// Clamp this value between 0 and 6 armor points.
|
||||
// The default of 6 will allow 24% reduction per piece.
|
||||
return Math.max(0.0, config.get(Configuration.CATEGORY_GENERAL, "Maximum Armor per Piece", 6.0).getDouble(6.0));
|
||||
}
|
||||
|
||||
public static double getMaximumFlyingSpeedmps() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Maximum flight speed (in m/s)", 25.0).getDouble(25.0);
|
||||
}
|
||||
|
||||
public static boolean useMouseWheel() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Use Mousewheel to change modes", true).getBoolean(true);
|
||||
}
|
||||
|
||||
public static void addModule(IPowerModule module) {
|
||||
ModuleManager.addModule(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all the modules in the config file into memory. Eventually. For now,
|
||||
* they are hardcoded.
|
||||
*/
|
||||
public static void loadPowerModules() {
|
||||
// loadModularProperties();
|
||||
List<IModularItem> ARMORONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso,
|
||||
ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet);
|
||||
List<IModularItem> ALLITEMS = Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso,
|
||||
ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet, ModularPowersuits.powerTool);
|
||||
List<IModularItem> HEADONLY = Collections.singletonList((IModularItem) ModularPowersuits.powerArmorHead);
|
||||
List<IModularItem> TORSOONLY = Collections.singletonList((IModularItem) ModularPowersuits.powerArmorTorso);
|
||||
List<IModularItem> LEGSONLY = Collections.singletonList((IModularItem) ModularPowersuits.powerArmorLegs);
|
||||
List<IModularItem> FEETONLY = Collections.singletonList((IModularItem) ModularPowersuits.powerArmorFeet);
|
||||
List<IModularItem> TOOLONLY = Collections.singletonList((IModularItem) ModularPowersuits.powerTool);
|
||||
|
||||
// Armor
|
||||
addModule(new BasicPlatingModule(ARMORONLY));
|
||||
addModule(new DiamondPlatingModule(ARMORONLY));
|
||||
addModule(new EnergyShieldModule(ARMORONLY));
|
||||
addModule(new HeatSinkModule(ARMORONLY));
|
||||
|
||||
// Tool
|
||||
addModule(new AxeModule(TOOLONLY));
|
||||
addModule(new PickaxeModule(TOOLONLY));
|
||||
addModule(new ShovelModule(TOOLONLY));
|
||||
addModule(new ShearsModule(TOOLONLY));
|
||||
addModule(new HoeModule(TOOLONLY));
|
||||
addModule(new LuxCapacitor(TOOLONLY));
|
||||
addModule(new OmniWrenchModule(TOOLONLY));
|
||||
addModule(new FieldTinkerModule(TOOLONLY));
|
||||
|
||||
// Weapon
|
||||
addModule(new MeleeAssistModule(TOOLONLY));
|
||||
addModule(new PlasmaCannonModule(TOOLONLY));
|
||||
addModule(new RailgunModule(TOOLONLY));
|
||||
// addModule(new SonicWeaponModule(TOOLONLY));
|
||||
addModule(new BladeLauncherModule(TOOLONLY));
|
||||
|
||||
// Energy
|
||||
addModule(new BasicBatteryModule(ALLITEMS));
|
||||
addModule(new AdvancedBatteryModule(ALLITEMS));
|
||||
addModule(new EliteBatteryModule(ALLITEMS));
|
||||
|
||||
// Movement
|
||||
addModule(new ParachuteModule(TORSOONLY));
|
||||
addModule(new GliderModule(TORSOONLY));
|
||||
addModule(new JetPackModule(TORSOONLY));
|
||||
addModule(new SprintAssistModule(LEGSONLY));
|
||||
addModule(new JumpAssistModule(LEGSONLY));
|
||||
addModule(new SwimAssistModule(LEGSONLY));
|
||||
addModule(new ClimbAssistModule(LEGSONLY));
|
||||
addModule(new JetBootsModule(FEETONLY));
|
||||
addModule(new ShockAbsorberModule(FEETONLY));
|
||||
addModule(new WaterElectrolyzerModule(HEADONLY));
|
||||
|
||||
// Vision
|
||||
//addModule(new BinocularsModule(HEADONLY));
|
||||
addModule(new NightVisionModule(HEADONLY));
|
||||
|
||||
// Special
|
||||
addModule(new FlightControlModule(HEADONLY));
|
||||
addModule(new InvisibilityModule(TORSOONLY));
|
||||
addModule(new BlinkDriveModule(TOOLONLY));
|
||||
addModule(new DiamondPickUpgradeModule(TOOLONLY));
|
||||
addModule(new AquaAffinityModule(TOOLONLY));
|
||||
addModule(new CoolingSystemModule(TORSOONLY));
|
||||
|
||||
// Cosmetic
|
||||
addModule(new TintModule(TOOLONLY));
|
||||
addModule(new TransparentArmorModule(ARMORONLY));
|
||||
addModule(new CosmeticGlowModule(ARMORONLY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Configuration getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public static boolean doAdditionalInfo() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Object additionalInfoInstructions() {
|
||||
String message = "Press SHIFT for more information.";
|
||||
message = MuseStringUtils.wrapMultipleFormatTags(message, MuseStringUtils.FormatCodes.Grey, MuseStringUtils.FormatCodes.Italic);
|
||||
return message;
|
||||
}
|
||||
|
||||
public static boolean useGraphicalMeters() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Use Graphical Meters", true).getBoolean(true);
|
||||
}
|
||||
|
||||
public static double baseMaxHeat() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Base Heat Cap", 50.0).getDouble(50.0);
|
||||
}
|
||||
|
||||
public static boolean allowConflictingKeybinds() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Allow Conflicting Keybinds", true).getBoolean(true);
|
||||
}
|
||||
|
||||
public static boolean useCustomFonts() {
|
||||
return config.get("Font", "Use Custom Font Engine", true).getBoolean(true);
|
||||
}
|
||||
|
||||
public static double fontDetail() {
|
||||
return config.get("Font", "Font Detail Multiplier", 4).getDouble(4);
|
||||
}
|
||||
|
||||
public static String fontURI() {
|
||||
// Chemical Reaction A -BRK-, retreived from http://www.fontpalace.com/
|
||||
return config.get("Font", "Font URI", Config.RESOURCE_PREFIX + "fonts/cra.ttf").getString();
|
||||
}
|
||||
|
||||
public static String fontName() {
|
||||
return config.get("Font", "Native Font Name (Overrides URI)", "").getString();
|
||||
}
|
||||
|
||||
|
||||
public static boolean fontAntiAliasing() {
|
||||
return config.get("Font", "Font Anti-Aliasing", false).getBoolean(false);
|
||||
}
|
||||
|
||||
public static int glowMultiplier() {
|
||||
return config.get("Graphics", "Bloom Multiplier", 3).getInt(3);
|
||||
}
|
||||
|
||||
public static boolean useShaders() {
|
||||
return config.get("Graphics", "Use Pixel/Vertex Shaders", true).getBoolean(true);
|
||||
}
|
||||
|
||||
public static boolean canUseShaders = false;
|
||||
|
||||
public static void setConfigFolderBase(File folder) {
|
||||
configFolder = new File(folder.getAbsolutePath() + "/machinemuse");
|
||||
}
|
||||
|
||||
}
|
237
src/main/scala/net/machinemuse/powersuits/common/Config.scala
Normal file
237
src/main/scala/net/machinemuse/powersuits/common/Config.scala
Normal file
|
@ -0,0 +1,237 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import net.machinemuse.api.IModularItem
|
||||
import net.machinemuse.api.IPowerModule
|
||||
import net.machinemuse.api.ModuleManager
|
||||
import net.machinemuse.powersuits.powermodule.armor.BasicPlatingModule
|
||||
import net.machinemuse.powersuits.powermodule.armor.DiamondPlatingModule
|
||||
import net.machinemuse.powersuits.powermodule.armor.EnergyShieldModule
|
||||
import net.machinemuse.powersuits.powermodule.armor.HeatSinkModule
|
||||
import net.machinemuse.powersuits.powermodule.energy.AdvancedBatteryModule
|
||||
import net.machinemuse.powersuits.powermodule.energy.BasicBatteryModule
|
||||
import net.machinemuse.powersuits.powermodule.energy.EliteBatteryModule
|
||||
import net.machinemuse.powersuits.powermodule.misc._
|
||||
import net.machinemuse.powersuits.powermodule.movement._
|
||||
import net.machinemuse.powersuits.powermodule.tool._
|
||||
import net.machinemuse.powersuits.powermodule.weapon.BladeLauncherModule
|
||||
import net.machinemuse.powersuits.powermodule.weapon.MeleeAssistModule
|
||||
import net.machinemuse.powersuits.powermodule.weapon.PlasmaCannonModule
|
||||
import net.machinemuse.powersuits.powermodule.weapon.RailgunModule
|
||||
import net.machinemuse.utils.MuseStringUtils
|
||||
import net.minecraft.creativetab.CreativeTabs
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
import org.lwjgl.input.Keyboard
|
||||
import java.io.File
|
||||
import java.util.Arrays
|
||||
import java.util.Collections
|
||||
import java.util.List
|
||||
|
||||
/**
|
||||
* Initial attempt at storing all tweakable/configurable values in one class.
|
||||
* This got really messy really fast so it's in the process of being
|
||||
* reworked.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
object Config {
|
||||
/**
|
||||
* Called in the pre-init phase of initialization, informs Forge that we
|
||||
* want the following blockIDs.
|
||||
*
|
||||
* @param config The Forge configuration object which will handle such
|
||||
* requests.
|
||||
*/
|
||||
def init(config: Configuration) {
|
||||
Config.config = config
|
||||
config.load
|
||||
config.save
|
||||
}
|
||||
|
||||
/**
|
||||
* The packet channel for this mod. We will only listen for and send packets
|
||||
* on this 'channel'. Max of 16 characters.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
def getNetworkChannelName: String = {
|
||||
return "powerSuits"
|
||||
}
|
||||
|
||||
/**
|
||||
* The default creative tab to add all these items to. This behaviour may
|
||||
* change if more items are added, but for now there are only 5 items and 1
|
||||
* block, so misc is the most appropriate target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
def getCreativeTab: CreativeTabs = {
|
||||
return MPSCreativeTab
|
||||
}
|
||||
|
||||
/**
|
||||
* Chance of each item being returned when salvaged.
|
||||
*
|
||||
* @return percent chance, 0.0 to 1.0
|
||||
*/
|
||||
def getSalvageChance: Double = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Salvage Ratio", 0.9).getDouble(0.9)
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum amount of armor contribution allowed per armor piece. Total
|
||||
* armor when the full set is worn can never exceed 4 times this amount.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
def getMaximumArmorPerPiece: Double = {
|
||||
return Math.max(0.0, config.get(Configuration.CATEGORY_GENERAL, "Maximum Armor per Piece", 6.0).getDouble(6.0))
|
||||
}
|
||||
|
||||
def getMaximumFlyingSpeedmps: Double = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Maximum flight speed (in m/s)", 25.0).getDouble(25.0)
|
||||
}
|
||||
|
||||
def useMouseWheel: Boolean = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Use Mousewheel to change modes", true).getBoolean(true)
|
||||
}
|
||||
|
||||
def addModule(module: IPowerModule) {
|
||||
ModuleManager.addModule(module)
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all the modules in the config file into memory. Eventually. For now,
|
||||
* they are hardcoded.
|
||||
*/
|
||||
def loadPowerModules {
|
||||
val ARMORONLY: List[IModularItem] = Arrays.asList[IModularItem](MPSItems.powerArmorHead.asInstanceOf[IModularItem], MPSItems.powerArmorTorso.asInstanceOf[IModularItem], MPSItems.powerArmorLegs.asInstanceOf[IModularItem], MPSItems.powerArmorFeet.asInstanceOf[IModularItem])
|
||||
val ALLITEMS: List[IModularItem] = Arrays.asList(MPSItems.powerArmorHead.asInstanceOf[IModularItem], MPSItems.powerArmorTorso.asInstanceOf[IModularItem], MPSItems.powerArmorLegs.asInstanceOf[IModularItem], MPSItems.powerArmorFeet.asInstanceOf[IModularItem], MPSItems.powerTool.asInstanceOf[IModularItem])
|
||||
val HEADONLY: List[IModularItem] = Collections.singletonList(MPSItems.powerArmorHead.asInstanceOf[IModularItem])
|
||||
val TORSOONLY: List[IModularItem] = Collections.singletonList(MPSItems.powerArmorTorso.asInstanceOf[IModularItem])
|
||||
val LEGSONLY: List[IModularItem] = Collections.singletonList(MPSItems.powerArmorLegs.asInstanceOf[IModularItem])
|
||||
val FEETONLY: List[IModularItem] = Collections.singletonList(MPSItems.powerArmorFeet.asInstanceOf[IModularItem])
|
||||
val TOOLONLY: List[IModularItem] = Collections.singletonList(MPSItems.powerTool.asInstanceOf[IModularItem])
|
||||
addModule(new BasicPlatingModule(ARMORONLY))
|
||||
addModule(new DiamondPlatingModule(ARMORONLY))
|
||||
addModule(new EnergyShieldModule(ARMORONLY))
|
||||
addModule(new HeatSinkModule(ARMORONLY))
|
||||
addModule(new AxeModule(TOOLONLY))
|
||||
addModule(new PickaxeModule(TOOLONLY))
|
||||
addModule(new ShovelModule(TOOLONLY))
|
||||
addModule(new ShearsModule(TOOLONLY))
|
||||
addModule(new HoeModule(TOOLONLY))
|
||||
addModule(new LuxCapacitor(TOOLONLY))
|
||||
addModule(new OmniWrenchModule(TOOLONLY))
|
||||
addModule(new FieldTinkerModule(TOOLONLY))
|
||||
addModule(new MeleeAssistModule(TOOLONLY))
|
||||
addModule(new PlasmaCannonModule(TOOLONLY))
|
||||
addModule(new RailgunModule(TOOLONLY))
|
||||
addModule(new BladeLauncherModule(TOOLONLY))
|
||||
addModule(new BasicBatteryModule(ALLITEMS))
|
||||
addModule(new AdvancedBatteryModule(ALLITEMS))
|
||||
addModule(new EliteBatteryModule(ALLITEMS))
|
||||
addModule(new ParachuteModule(TORSOONLY))
|
||||
addModule(new GliderModule(TORSOONLY))
|
||||
addModule(new JetPackModule(TORSOONLY))
|
||||
addModule(new SprintAssistModule(LEGSONLY))
|
||||
addModule(new JumpAssistModule(LEGSONLY))
|
||||
addModule(new SwimAssistModule(LEGSONLY))
|
||||
addModule(new ClimbAssistModule(LEGSONLY))
|
||||
addModule(new JetBootsModule(FEETONLY))
|
||||
addModule(new ShockAbsorberModule(FEETONLY))
|
||||
addModule(new WaterElectrolyzerModule(HEADONLY))
|
||||
addModule(new NightVisionModule(HEADONLY))
|
||||
addModule(new FlightControlModule(HEADONLY))
|
||||
addModule(new InvisibilityModule(TORSOONLY))
|
||||
addModule(new BlinkDriveModule(TOOLONLY))
|
||||
addModule(new DiamondPickUpgradeModule(TOOLONLY))
|
||||
addModule(new AquaAffinityModule(TOOLONLY))
|
||||
addModule(new CoolingSystemModule(TORSOONLY))
|
||||
addModule(new TintModule(TOOLONLY))
|
||||
addModule(new TransparentArmorModule(ARMORONLY))
|
||||
addModule(new CosmeticGlowModule(ARMORONLY))
|
||||
}
|
||||
|
||||
def getConfig: Configuration = {
|
||||
return config
|
||||
}
|
||||
|
||||
def doAdditionalInfo: Boolean = {
|
||||
if (FMLCommonHandler.instance.getEffectiveSide eq Side.CLIENT) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
def additionalInfoInstructions: AnyRef = {
|
||||
var message: String = "Press SHIFT for more information."
|
||||
message = MuseStringUtils.wrapMultipleFormatTags(message, MuseStringUtils.FormatCodes.Grey, MuseStringUtils.FormatCodes.Italic)
|
||||
return message
|
||||
}
|
||||
|
||||
def useGraphicalMeters: Boolean = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Use Graphical Meters", true).getBoolean(true)
|
||||
}
|
||||
|
||||
def baseMaxHeat: Double = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Base Heat Cap", 50.0).getDouble(50.0)
|
||||
}
|
||||
|
||||
def allowConflictingKeybinds: Boolean = {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Allow Conflicting Keybinds", true).getBoolean(true)
|
||||
}
|
||||
|
||||
def useCustomFonts: Boolean = {
|
||||
return config.get("Font", "Use Custom Font Engine", true).getBoolean(true)
|
||||
}
|
||||
|
||||
def fontDetail: Double = {
|
||||
return config.get("Font", "Font Detail Multiplier", 4).getDouble(4)
|
||||
}
|
||||
|
||||
def fontURI: String = {
|
||||
return config.get("Font", "Font URI", Config.RESOURCE_PREFIX + "fonts/cra.ttf").getString
|
||||
}
|
||||
|
||||
def fontName: String = {
|
||||
return config.get("Font", "Native Font Name (Overrides URI)", "").getString
|
||||
}
|
||||
|
||||
def fontAntiAliasing: Boolean = {
|
||||
return config.get("Font", "Font Anti-Aliasing", false).getBoolean(false)
|
||||
}
|
||||
|
||||
def glowMultiplier: Int = {
|
||||
return config.get("Graphics", "Bloom Multiplier", 3).getInt(3)
|
||||
}
|
||||
|
||||
def useShaders: Boolean = {
|
||||
return config.get("Graphics", "Use Pixel/Vertex Shaders", true).getBoolean(true)
|
||||
}
|
||||
|
||||
def setConfigFolderBase(folder: File) {
|
||||
configFolder = new File(folder.getAbsolutePath + "/machinemuse")
|
||||
}
|
||||
|
||||
final val RESOURCE_PREFIX: String = "powersuits:"
|
||||
final val TEXTURE_PREFIX: String = "powersuits:textures/"
|
||||
final val SOUND_PREFIX: String = RESOURCE_PREFIX + "sound/"
|
||||
final val LANG_PREFIX: String = RESOURCE_PREFIX + "lang/"
|
||||
final val SEBK_ARMOR_PATH: String = TEXTURE_PREFIX + "models/sebkarmor.png"
|
||||
final val SEBK_ARMORPANTS_PATH: String = TEXTURE_PREFIX + "models/sebkarmorpants.png"
|
||||
final val TINKERTABLE_TEXTURE_PATH: String = TEXTURE_PREFIX + "models/tinkertable_tx.png"
|
||||
final val ARMOR_TEXTURE_PATH: String = TEXTURE_PREFIX + "models/diffuse.png"
|
||||
final val BLANK_ARMOR_MODEL_PATH: String = TEXTURE_PREFIX + "models/blankarmor.png"
|
||||
final val SEBK_TOOL_TEXTURE: String = TEXTURE_PREFIX + "models/tool.png"
|
||||
final val LIGHTNING_TEXTURE: String = TEXTURE_PREFIX + "gui/lightning-medium.png"
|
||||
final val CITIZENJOE_ARMOR_PATH: String = TEXTURE_PREFIX + "models/joearmor.png"
|
||||
final val CITIZENJOE_ARMORPANTS_PATH: String = TEXTURE_PREFIX + "models/joearmorpants.png"
|
||||
final val GLASS_TEXTURE: String = TEXTURE_PREFIX + "gui/glass.png"
|
||||
var configFolder: File = null
|
||||
private var config: Configuration = null
|
||||
var canUseShaders: Boolean = false
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry
|
||||
|
||||
object MPSCreativeTab extends CreativeTabs(CreativeTabs.getNextID, "Modular Powersuits") {
|
||||
def getTabIconItem = MPSItems.powerArmorHead
|
||||
}
|
|
@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
|
|||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
class GuiHandler extends IGuiHandler {
|
||||
object MPSGuiHandler extends IGuiHandler {
|
||||
override def getServerGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): AnyRef = {
|
||||
ID match {
|
||||
case _ => null
|
|
@ -0,0 +1,28 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import net.machinemuse.powersuits.block.{BlockLuxCapacitor, BlockTinkerTable}
|
||||
import net.machinemuse.powersuits.item._
|
||||
|
||||
/**
|
||||
* Created by Claire Semple on 9/9/2014.
|
||||
*/
|
||||
object MPSItems {
|
||||
val powerArmorHead = ItemPowerArmorHelmet
|
||||
GameRegistry.registerItem(powerArmorHead, powerArmorHead.getUnlocalizedName)
|
||||
val powerArmorTorso = ItemPowerArmorChestplate
|
||||
GameRegistry.registerItem(powerArmorTorso, powerArmorTorso.getUnlocalizedName)
|
||||
val powerArmorLegs = ItemPowerArmorLeggings
|
||||
GameRegistry.registerItem(powerArmorLegs, powerArmorLegs.getUnlocalizedName)
|
||||
val powerArmorFeet = ItemPowerArmorBoots
|
||||
GameRegistry.registerItem(powerArmorFeet, powerArmorFeet.getUnlocalizedName)
|
||||
val powerTool = new ItemPowerFist
|
||||
GameRegistry.registerItem(powerTool, powerTool.getUnlocalizedName)
|
||||
val tinkerTable = BlockTinkerTable
|
||||
GameRegistry.registerBlock(tinkerTable, tinkerTable.getUnlocalizedName)
|
||||
val luxCapacitor = new BlockLuxCapacitor
|
||||
GameRegistry.registerBlock(luxCapacitor, luxCapacitor.getUnlocalizedName)
|
||||
val components = new ItemComponent
|
||||
components.populate()
|
||||
GameRegistry.registerItem(components, components.getUnlocalizedName)
|
||||
}
|
|
@ -12,7 +12,7 @@ import net.machinemuse.powersuits.powermodule.tool.GrafterModule;
|
|||
import net.machinemuse.powersuits.powermodule.tool.MFFSFieldTeleporterModule;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -146,60 +146,47 @@ public class ModCompatability {
|
|||
|
||||
// Thaumcraft
|
||||
if (isThaumCraftLoaded() && enableThaumGogglesModule()) {
|
||||
ModuleManager.addModule(new ThaumGogglesModule(Collections.singletonList((IModularItem) ModularPowersuits.powerArmorHead)));
|
||||
ModuleManager.addModule(new ThaumGogglesModule(Collections.singletonList((IModularItem) MPSItems.powerArmorHead())));
|
||||
}
|
||||
|
||||
//IPowerModule module = new MultimeterModule(Collections.singletonList((IModularItem) ModularPowersuits.powerTool));
|
||||
//IPowerModule module = new MultimeterModule(Collections.singletonList((IModularItem) MPSItems.powerTool()));
|
||||
|
||||
// Atomic Science
|
||||
if (isAtomicScienceLoaded()) {
|
||||
ModuleManager.addModule(new HazmatModule(Arrays.<IModularItem>asList(ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet)));
|
||||
ModuleManager.addModule(new HazmatModule(Arrays.<IModularItem>asList(MPSItems.powerArmorHead(), MPSItems.powerArmorTorso(), MPSItems.powerArmorLegs(), MPSItems.powerArmorFeet())));
|
||||
}
|
||||
|
||||
// Galacticraft
|
||||
if (isGalacticraftLoaded()) {
|
||||
ModuleManager.addModule(new AirtightSealModule(Collections.singletonList((IModularItem) ModularPowersuits.powerArmorHead)));
|
||||
ModuleManager.addModule(new AirtightSealModule(Collections.singletonList((IModularItem) MPSItems.powerArmorHead())));
|
||||
}
|
||||
|
||||
// Forestry
|
||||
if (isForestryLoaded()) {
|
||||
ModuleManager.addModule(new GrafterModule(Collections.singletonList((IModularItem) ModularPowersuits.powerTool)));
|
||||
ModuleManager.addModule(new ApiaristArmorModule(Arrays.<IModularItem>asList(ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet)));
|
||||
ModuleManager.addModule(new GrafterModule(Collections.singletonList((IModularItem) MPSItems.powerTool())));
|
||||
ModuleManager.addModule(new ApiaristArmorModule(Arrays.<IModularItem>asList(MPSItems.powerArmorHead(), MPSItems.powerArmorTorso(), MPSItems.powerArmorLegs(), MPSItems.powerArmorFeet())));
|
||||
}
|
||||
|
||||
try {
|
||||
ModuleManager.addModule(new MFFSFieldTeleporterModule(Collections.singletonList((IModularItem) ModularPowersuits.powerTool)));
|
||||
ModuleManager.addModule(new MFFSFieldTeleporterModule(Collections.singletonList((IModularItem) MPSItems.powerTool())));
|
||||
} catch (Throwable e) {
|
||||
MuseLogger.logError("Failed to get MFFS item!");
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getThermexItem(String name, int quantity) {
|
||||
try {
|
||||
ItemStack item =
|
||||
thermalexpansion.api.item.ItemRegistry.getItem(name, quantity);
|
||||
if (item != null) {
|
||||
return item;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// thermalexpansion.api.item.ItemRegistry.printItemNames();
|
||||
MuseLogger.logError("Failed to get Thermal Expansion item " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getForestryItem(String name, int quantity) {
|
||||
try {
|
||||
ItemStack item = forestry.api.core.ItemInterface.getItem(name);
|
||||
if (item != null) {
|
||||
item.stackSize = quantity;
|
||||
return item;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
MuseLogger.logError("Failed to get Forestry item " + name);
|
||||
return null;
|
||||
}
|
||||
//
|
||||
// public static ItemStack getForestryItem(String name, int quantity) {
|
||||
// try {
|
||||
// ItemStack item = forestry.api.core.ItemInterface.getItem(name);
|
||||
// if (item != null) {
|
||||
// item.stackSize = quantity;
|
||||
// return item;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// MuseLogger.logError("Failed to get Forestry item " + name);
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public static ItemStack getMFFSItem(String name, int quantity) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
Object obj = Class.forName("mods.mffs.common.ModularForceFieldSystem").getField("MFFSitemFieldTeleporter").get(null);
|
||||
|
|
|
@ -1,183 +0,0 @@
|
|||
package net.machinemuse.powersuits.common;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
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.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.machinemuse.powersuits.block.BlockLuxCapacitor;
|
||||
import net.machinemuse.powersuits.block.BlockTinkerTable;
|
||||
import net.machinemuse.powersuits.entity.EntityLuxCapacitor;
|
||||
import net.machinemuse.powersuits.entity.EntityPlasmaBolt;
|
||||
import net.machinemuse.powersuits.entity.EntitySpinningBlade;
|
||||
import net.machinemuse.powersuits.event.HarvestEventHandler;
|
||||
import net.machinemuse.powersuits.event.MovementManager;
|
||||
import net.machinemuse.powersuits.item.*;
|
||||
import net.machinemuse.utils.MuseFileUtils;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Main mod class. This is what Forge loads to get the mod up and running, both
|
||||
* server- and client-side.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
// Informs forge that this is a base mod class, and gives it some info for the
|
||||
// FML mod list. This is also where it looks to see if your client's version
|
||||
// matches the server's.
|
||||
@Mod(modid = "powersuits",
|
||||
name = "MachineMuse's Modular Powersuits",
|
||||
/* @DEPENDENCIES@ */
|
||||
version = "@MOD_VERSION@"
|
||||
)
|
||||
// Informs forge of the requirements:
|
||||
//
|
||||
// clientSideRequired means players can't connect without it. True for things
|
||||
// that add new blocks/items, false for things like bukkit plugins.
|
||||
//
|
||||
// serverSideRequired means clients can't connect to servers that don't have it.
|
||||
// This isn't a strict restriction currently but it can cause problems if the
|
||||
// mod does anything potentially incompatible in its preInit function. True for
|
||||
// things that add new blocks/items, false for things like Rei's Minimap or
|
||||
// Inventory Tweaks.
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
|
||||
public class ModularPowersuits {
|
||||
|
||||
public static ItemPowerArmorHelmet powerArmorHead;
|
||||
public static ItemPowerArmorChestplate powerArmorTorso;
|
||||
public static ItemPowerArmorLeggings powerArmorLegs;
|
||||
public static ItemPowerArmorBoots powerArmorFeet;
|
||||
public static ItemPowerFist powerTool;
|
||||
public static ItemComponent components;
|
||||
public static BlockTinkerTable tinkerTable;
|
||||
public static BlockLuxCapacitor luxCapacitor;
|
||||
|
||||
/**
|
||||
* The instance of the mod that Forge will access. Note that it has to be
|
||||
* set by hand in the preInit step.
|
||||
*/
|
||||
@Instance("ModularPowersuits")
|
||||
public static ModularPowersuits INSTANCE;
|
||||
|
||||
/**
|
||||
* Tells Forge what classes to load for the client and server proxies. These
|
||||
* execute side-specific code like registering renderers (for the client) or
|
||||
* different tick handlers (for the server).
|
||||
*/
|
||||
@SidedProxy(
|
||||
clientSide = "net.machinemuse.powersuits.client.ClientProxy",
|
||||
serverSide = "net.machinemuse.powersuits.common.ServerProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
/**
|
||||
* In the preInit step you only want to load configs, reserve block/item
|
||||
* IDs, and inform Forge if your mod has to be loaded after any others. No
|
||||
* heavy loading or registering should occur here, because it happens as
|
||||
* soon as they start Minecraft and there's no guarantee that your mod will
|
||||
* be loaded.
|
||||
*
|
||||
* @param event An event object with useful data
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
INSTANCE = this;
|
||||
File oldConfig = event.getSuggestedConfigurationFile();
|
||||
File newConfig = new File(event.getModConfigurationDirectory() + "/machinemuse/powersuits.cfg");
|
||||
if (oldConfig.exists()) {
|
||||
try {
|
||||
MuseFileUtils.copyFile(oldConfig, newConfig);
|
||||
oldConfig.delete();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
Config.init(new Configuration(newConfig));
|
||||
Config.setConfigFolderBase(event.getModConfigurationDirectory());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new HarvestEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MovementManager());
|
||||
proxy.registerEvents();
|
||||
}
|
||||
|
||||
public static Config config;
|
||||
/**
|
||||
* A static handle for the blocks and items. We only want one instance of
|
||||
* each of them.
|
||||
*/
|
||||
public static GuiHandler guiHandler = new GuiHandler();
|
||||
|
||||
/**
|
||||
* This is where all the heavy loading and registering of handlers goes.
|
||||
* This occurs when you connect to a server or open a world.
|
||||
*
|
||||
* @param event An event object with useful data
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void load(FMLInitializationEvent event) {
|
||||
powerArmorHead = new ItemPowerArmorHelmet(Config.helmID);
|
||||
GameRegistry.registerItem(powerArmorHead, powerArmorHead.getUnlocalizedName());
|
||||
powerArmorTorso = new ItemPowerArmorChestplate(Config.chestID);
|
||||
GameRegistry.registerItem(powerArmorTorso, powerArmorTorso.getUnlocalizedName());
|
||||
powerArmorLegs = new ItemPowerArmorLeggings(Config.legsID);
|
||||
GameRegistry.registerItem(powerArmorLegs, powerArmorLegs.getUnlocalizedName());
|
||||
powerArmorFeet = new ItemPowerArmorBoots(Config.bootsID);
|
||||
GameRegistry.registerItem(powerArmorFeet, powerArmorFeet.getUnlocalizedName());
|
||||
powerTool = new ItemPowerFist();
|
||||
GameRegistry.registerItem(powerTool, powerTool.getUnlocalizedName());
|
||||
tinkerTable = new BlockTinkerTable();
|
||||
GameRegistry.registerBlock(tinkerTable, tinkerTable.getUnlocalizedName());
|
||||
luxCapacitor = new BlockLuxCapacitor();
|
||||
GameRegistry.registerBlock(luxCapacitor, luxCapacitor.getUnlocalizedName());
|
||||
components = new ItemComponent();
|
||||
components.populate();
|
||||
GameRegistry.registerItem(components, components.getUnlocalizedName());
|
||||
// new ItemSnowbutt(2323);
|
||||
// Localization.loadCurrentLanguage();
|
||||
|
||||
Config.loadPowerModules();
|
||||
|
||||
// Initialize config options so they save with the file
|
||||
Config.getMaximumArmorPerPiece();
|
||||
Config.getMaximumFlyingSpeedmps();
|
||||
Config.useMouseWheel();
|
||||
Config.useGraphicalMeters();
|
||||
Config.getSalvageChance();
|
||||
Config.baseMaxHeat();
|
||||
Config.allowConflictingKeybinds();
|
||||
Config.fontURI();
|
||||
Config.fontName();
|
||||
Config.fontDetail();
|
||||
Config.fontAntiAliasing();
|
||||
Config.useCustomFonts();
|
||||
Config.glowMultiplier();
|
||||
Config.useShaders();
|
||||
|
||||
EntityRegistry.registerModEntity(EntityPlasmaBolt.class, "entityPlasmaBolt", 2477, this, 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntitySpinningBlade.class, "entitySpinningBlade", 2478, this, 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntityLuxCapacitor.class, "entityLuxCapacitor", 2479, this, 64, 20, true);
|
||||
|
||||
proxy.registerHandlers();
|
||||
proxy.registerRenderers();
|
||||
NetworkRegistry.instance().registerGuiHandler(this, guiHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stuff to do after the player connects. This is for things that need to
|
||||
* wait until the world is completely loaded before initializing.
|
||||
*
|
||||
* @param event An event object with useful data
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit();
|
||||
ModCompatability.registerModSpecificModules();
|
||||
Config.getConfig().save();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import java.io.File
|
||||
|
||||
import cpw.mods.fml.common.{Mod, SidedProxy}
|
||||
import cpw.mods.fml.common.event.{FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent}
|
||||
import cpw.mods.fml.common.network.NetworkRegistry
|
||||
import cpw.mods.fml.common.registry.EntityRegistry
|
||||
import net.machinemuse.powersuits.entity.{EntityLuxCapacitor, EntityPlasmaBolt, EntitySpinningBlade}
|
||||
import net.machinemuse.powersuits.event.{HarvestEventHandler, MovementManager}
|
||||
import net.machinemuse.powersuits.network.packets.MPSPacketList
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
|
||||
/**
|
||||
* Main mod class. This is what Forge loads to get the mod up and running, both
|
||||
* server- and client-side.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
@Mod(modid = "powersuits", name = "MachineMuse's Modular Powersuits")
|
||||
object ModularPowersuits {
|
||||
@SidedProxy(clientSide = "net.machinemuse.powersuits.client.ClientProxy", serverSide = "net.machinemuse.powersuits.common.ServerProxy")
|
||||
var proxy: CommonProxy = null
|
||||
var config: Configuration = null
|
||||
|
||||
val INSTANCE=this
|
||||
|
||||
@Mod.EventHandler def preInit(event: FMLPreInitializationEvent) {
|
||||
val newConfig: File = new File(event.getModConfigurationDirectory + "/machinemuse/powersuits.cfg")
|
||||
Config.init(new Configuration(newConfig))
|
||||
Config.setConfigFolderBase(event.getModConfigurationDirectory)
|
||||
MinecraftForge.EVENT_BUS.register(new HarvestEventHandler)
|
||||
MinecraftForge.EVENT_BUS.register(new MovementManager)
|
||||
proxy.registerEvents()
|
||||
}
|
||||
|
||||
@Mod.EventHandler def load(event: FMLInitializationEvent) {
|
||||
|
||||
Config.loadPowerModules
|
||||
Config.getMaximumArmorPerPiece
|
||||
Config.getMaximumFlyingSpeedmps
|
||||
Config.useMouseWheel
|
||||
Config.useGraphicalMeters
|
||||
Config.getSalvageChance
|
||||
Config.baseMaxHeat
|
||||
Config.allowConflictingKeybinds
|
||||
Config.fontURI
|
||||
Config.fontName
|
||||
Config.fontDetail
|
||||
Config.fontAntiAliasing
|
||||
Config.useCustomFonts
|
||||
Config.glowMultiplier
|
||||
Config.useShaders
|
||||
EntityRegistry.registerModEntity(classOf[EntityPlasmaBolt], "entityPlasmaBolt", 2477, this, 64, 20, true)
|
||||
EntityRegistry.registerModEntity(classOf[EntitySpinningBlade], "entitySpinningBlade", 2478, this, 64, 20, true)
|
||||
EntityRegistry.registerModEntity(classOf[EntityLuxCapacitor], "entityLuxCapacitor", 2479, this, 64, 20, true)
|
||||
proxy.registerHandlers()
|
||||
proxy.registerRenderers()
|
||||
MPSPacketList.registerPackets()
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, MPSGuiHandler)
|
||||
}
|
||||
|
||||
@Mod.EventHandler def postInit(event: FMLPostInitializationEvent) {
|
||||
proxy.postInit()
|
||||
ModCompatability.registerModSpecificModules()
|
||||
Config.getConfig.save
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package net.machinemuse.powersuits.common;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class MuseCreativeTab extends CreativeTabs {
|
||||
public static final String NAME = "PowerSuits";
|
||||
public static MuseCreativeTab instance;
|
||||
public static ItemStack stack;
|
||||
|
||||
public static MuseCreativeTab instance() {
|
||||
if (instance == null) {
|
||||
instance = new MuseCreativeTab(CreativeTabs.getNextID(), NAME);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public MuseCreativeTab(int id, String name) {
|
||||
super(id, name);
|
||||
LanguageRegistry.instance().addStringLocalization("itemGroup." + NAME, "en_US", "Powersuits");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
if (stack == null) {
|
||||
stack = new ItemStack(ModularPowersuits.powerArmorHead);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package net.machinemuse.powersuits.common
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler
|
||||
import net.machinemuse.powersuits.event.PlayerLoginHandlerThingy
|
||||
|
||||
/**
|
||||
* Author: MachineMuse (Claire Semple)
|
||||
* Created: 8:04 PM, 12/05/13
|
||||
*/
|
||||
class ServerProxy extends CommonProxy {
|
||||
override def registerEvents {
|
||||
FMLCommonHandler.instance().bus().register(PlayerLoginHandlerThingy)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package net.machinemuse.powersuits.control;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -14,11 +13,9 @@ import net.minecraft.client.settings.KeyBinding;
|
|||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class KeybindKeyHandler {
|
||||
static String mps = "Modular Powersuits";
|
||||
public static final String mps = "Modular Powersuits";
|
||||
public static KeyBinding openKeybindGUI = new KeyBinding("Open MPS Keybind GUI", -1, mps);
|
||||
public static KeyBinding goDownKey = new KeyBinding("Go Down (MPS Flight Control)", Keyboard.KEY_Z, mps);
|
||||
public static KeyBinding cycleToolBackward = new KeyBinding("Cycle Tool Backward (MPS)", -1, mps);
|
||||
|
@ -43,17 +40,17 @@ public class KeybindKeyHandler {
|
|||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
if(pressed) {
|
||||
if (pressed) {
|
||||
if (key == openKeybindGUI.getKeyCode()) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if (Minecraft.getMinecraft().inGameHasFocus) {
|
||||
player.openGui(ModularPowersuits.INSTANCE, 1, world, 0, 0, 0);
|
||||
player.openGui(ModularPowersuits.INSTANCE(), 1, world, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (key == openCosmeticGUI.getKeyCode()) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if (Minecraft.getMinecraft().inGameHasFocus) {
|
||||
player.openGui(ModularPowersuits.INSTANCE, 3, world, 0, 0, 0);
|
||||
player.openGui(ModularPowersuits.INSTANCE(), 3, world, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (key == goDownKey.getKeyCode()) {
|
||||
|
|
|
@ -3,10 +3,10 @@ package net.machinemuse.powersuits.control;
|
|||
import cpw.mods.fml.common.Loader;
|
||||
import net.machinemuse.api.IPowerModule;
|
||||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||
import net.machinemuse.general.gui.clickable.ClickableKeybinding;
|
||||
import net.machinemuse.general.gui.clickable.ClickableModule;
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
|
@ -38,17 +38,17 @@ public class KeybindManager {
|
|||
}
|
||||
|
||||
public static KeyBinding addKeybinding(String keybindDescription, int keycode, MusePoint2D position) {
|
||||
KeyBinding kb = new KeyBinding(keybindDescription, keycode);
|
||||
KeyBinding kb = new KeyBinding(keybindDescription, keycode, KeybindKeyHandler.mps);
|
||||
boolean free = !KeyBinding.hash.containsItem(keycode);
|
||||
getInstance().keybindings.add(new ClickableKeybinding(kb, position, free));
|
||||
return kb;
|
||||
}
|
||||
|
||||
public static String parseName(KeyBinding keybind) {
|
||||
if (keybind.keyCode < 0) {
|
||||
return "Mouse" + (keybind.keyCode + 100);
|
||||
if (keybind.getKeyCode() < 0) {
|
||||
return "Mouse" + (keybind.getKeyCode() + 100);
|
||||
} else {
|
||||
return Keyboard.getKeyName(keybind.keyCode);
|
||||
return Keyboard.getKeyName(keybind.getKeyCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class KeybindManager {
|
|||
writer = new BufferedWriter(new FileWriter(file));
|
||||
List<IPowerModule> modulesToWrite = MuseItemUtils.getPlayerInstalledModules(Minecraft.getMinecraft().thePlayer);
|
||||
for (ClickableKeybinding keybinding : getInstance().keybindings) {
|
||||
writer.write(keybinding.getKeyBinding().keyCode + ":" + keybinding.getPosition().x() + ':' + keybinding.getPosition().y() + '\n');
|
||||
writer.write(keybinding.getKeyBinding().getKeyCode() + ":" + keybinding.getPosition().x() + ':' + keybinding.getPosition().y() + '\n');
|
||||
for (ClickableModule module : keybinding.getBoundModules()) {
|
||||
writer.write(module.getModule().getDataName() + '~' + module.getPosition().x() + '~' + module.getPosition().y() + '\n');
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class KeybindManager {
|
|||
if (!KeyBinding.hash.containsItem(id)) {
|
||||
MusePoint2D position = new MusePoint2D(Double.parseDouble(exploded[1]), Double.parseDouble(exploded[2]));
|
||||
boolean free = !KeyBinding.hash.containsItem(id);
|
||||
workingKeybinding = new ClickableKeybinding(new KeyBinding(Keyboard.getKeyName(id), id), position, free);
|
||||
workingKeybinding = new ClickableKeybinding(new KeyBinding(Keyboard.getKeyName(id), id, KeybindKeyHandler.mps), position, free);
|
||||
getInstance().keybindings.add(workingKeybinding);
|
||||
} else {
|
||||
workingKeybinding = null;
|
||||
|
|
|
@ -2,14 +2,14 @@ package net.machinemuse.powersuits.entity;
|
|||
|
||||
import net.machinemuse.powersuits.block.BlockLuxCapacitor;
|
||||
import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
|
||||
import net.machinemuse.powersuits.common.MPSItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class EntityLuxCapacitor extends EntityThrowable {
|
||||
public double red;
|
||||
|
@ -66,27 +66,27 @@ public class EntityLuxCapacitor extends EntityThrowable {
|
|||
@Override
|
||||
protected void onImpact(MovingObjectPosition movingobjectposition) {
|
||||
|
||||
if (!this.isDead && movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (!this.isDead && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
ForgeDirection dir = ForgeDirection.values()[movingobjectposition.sideHit].getOpposite();
|
||||
int x = movingobjectposition.blockX - dir.offsetX;
|
||||
int y = movingobjectposition.blockY - dir.offsetY;
|
||||
int z = movingobjectposition.blockZ - dir.offsetZ;
|
||||
if (y > 0) {
|
||||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
if (blockID <= 0 || Block.blocksList[blockID] == null || Block.blocksList[blockID].isAirBlock(worldObj, x, y, z)) {
|
||||
int blockToStickTo = worldObj.getBlockId(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
|
||||
if (Block.isNormalCube(blockToStickTo)) {
|
||||
worldObj.setBlock(x, y, z, BlockLuxCapacitor.assignedBlockID, 0, 7);
|
||||
worldObj.setBlockTileEntity(x, y, z, new TileEntityLuxCapacitor(dir, red, green, blue));
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if (block == null || block.isAir(worldObj, x, y, z)) {
|
||||
Block blockToStickTo = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
|
||||
if (blockToStickTo.isNormalCube(worldObj, x, y, z)) {
|
||||
worldObj.setBlock(x, y, z, MPSItems.luxCapacitor(), 0, 7);
|
||||
worldObj.setTileEntity(x, y, z, new TileEntityLuxCapacitor(dir, red, green, blue));
|
||||
} else {
|
||||
for (ForgeDirection d : ForgeDirection.values()) {
|
||||
int xo = x + d.offsetX;
|
||||
int yo = y + d.offsetY;
|
||||
int zo = z + d.offsetZ;
|
||||
blockToStickTo = worldObj.getBlockId(xo, yo, zo);
|
||||
if (Block.isNormalCube(blockToStickTo)) {
|
||||
worldObj.setBlock(x, y, z, BlockLuxCapacitor.assignedBlockID, 0, 7);
|
||||
worldObj.setBlockTileEntity(x, y, z, new TileEntityLuxCapacitor(d, red, green, blue));
|
||||
blockToStickTo = worldObj.getBlock(xo, yo, zo);
|
||||
if (blockToStickTo.isNormalCube(worldObj, x, y, z)) {
|
||||
worldObj.setBlock(x, y, z, MPSItems.luxCapacitor(), 0, 7);
|
||||
worldObj.setTileEntity(x, y, z, new TileEntityLuxCapacitor(d, red, green, blue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class EntityPlasmaBolt extends EntityThrowable {
|
|||
event.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (int) damage);
|
||||
}
|
||||
break;
|
||||
case TILE:
|
||||
case BLOCK:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -7,14 +7,12 @@ import net.minecraft.enchantment.Enchantment;
|
|||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -84,13 +82,12 @@ public class EntitySpinningBlade extends EntityThrowable {
|
|||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition hitMOP) {
|
||||
if (hitMOP.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (hitMOP.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
World world = this.worldObj;
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
int id = world.getBlockId(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ);
|
||||
Block block = Block.blocksList[id];
|
||||
Block block = world.getBlock(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ);
|
||||
if (block instanceof IShearable) {
|
||||
IShearable target = (IShearable) block;
|
||||
if (target.isShearable(this.shootingItem, world, hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ) && !world.isRemote) {
|
||||
|
@ -108,14 +105,14 @@ public class EntitySpinningBlade extends EntityThrowable {
|
|||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
if (this.shootingEntity instanceof EntityPlayer) {
|
||||
((EntityPlayer) shootingEntity).addStat(StatList.mineBlockStatArray[id], 1);
|
||||
((EntityPlayer) shootingEntity).addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1);
|
||||
}
|
||||
}
|
||||
world.destroyBlock(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ, true);
|
||||
world.func_147480_a(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ, true); // Destroy block and drop item
|
||||
} else { // Block hit was not IShearable
|
||||
this.kill();
|
||||
}
|
||||
} else if (hitMOP.typeOfHit == EnumMovingObjectType.ENTITY && hitMOP.entityHit != this.shootingEntity) {
|
||||
} else if (hitMOP.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && hitMOP.entityHit != this.shootingEntity) {
|
||||
if (hitMOP.entityHit instanceof IShearable) {
|
||||
IShearable target = (IShearable) hitMOP.entityHit;
|
||||
Entity entity = hitMOP.entityHit;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package net.machinemuse.powersuits.tick
|
||||
package net.machinemuse.powersuits.event
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent
|
||||
import cpw.mods.fml.common.gameevent.TickEvent
|
|
@ -33,7 +33,7 @@ public class RenderEventHandler {
|
|||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution screen = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
if (Config.useShaders() && Config.canUseShaders && Minecraft.isFancyGraphicsEnabled()) {
|
||||
if (Config.useShaders() && Config.canUseShaders() && Minecraft.isFancyGraphicsEnabled()) {
|
||||
GlowBuffer.drawFullScreen(screen);
|
||||
GlowBuffer.clear();
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class RenderEventHandler {
|
|||
double maxEnergy = ElectricItemUtils.getMaxEnergy(player);
|
||||
double currHeat = MuseHeatUtils.getPlayerHeat(player);
|
||||
double maxHeat = MuseHeatUtils.getMaxHeat(player);
|
||||
if (maxEnergy > 0 && BlockTinkerTable.energyIcon != null) {
|
||||
if (maxEnergy > 0 && BlockTinkerTable.energyIcon() != null) {
|
||||
String currStr = MuseStringUtils.formatNumberShort(currEnergy);
|
||||
String maxStr = MuseStringUtils.formatNumberShort(maxEnergy);
|
||||
String currHeatStr = MuseStringUtils.formatNumberShort(currHeat);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ItemComponent extends Item {
|
|||
public static ItemStack artificialMuscle;
|
||||
|
||||
public ItemComponent() {
|
||||
super(assignedItemID);
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setCreativeTab(Config.getCreativeTab());
|
||||
|
@ -147,9 +147,9 @@ public class ItemComponent extends Item {
|
|||
* returns 16 items). For creative tab.
|
||||
*/
|
||||
@Override
|
||||
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) {
|
||||
public void getSubItems(Item item, CreativeTabs tab, List listToAddTo) {
|
||||
for (int i = 0; i < names.size(); ++i) {
|
||||
listToAddTo.add(new ItemStack(itemID, 1, i));
|
||||
listToAddTo.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import cpw.mods.fml.relauncher.Side
|
|||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.machinemuse.utils.render.MuseRenderer
|
||||
|
||||
class ItemPowerArmorBoots(id: Int) extends ItemPowerArmor(0, 3) {
|
||||
object ItemPowerArmorBoots extends ItemPowerArmor(0, 3) {
|
||||
val iconpath = MuseRenderer.ICON_PREFIX + "armorfeet"
|
||||
|
||||
setUnlocalizedName("powerArmorBoots")
|
||||
|
|
|
@ -5,7 +5,7 @@ import cpw.mods.fml.relauncher.Side
|
|||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.machinemuse.utils.render.MuseRenderer
|
||||
|
||||
class ItemPowerArmorChestplate(id: Int) extends ItemPowerArmor(0, 1) {
|
||||
object ItemPowerArmorChestplate extends ItemPowerArmor(0, 1) {
|
||||
val iconpath = MuseRenderer.ICON_PREFIX + "armortorso"
|
||||
|
||||
setUnlocalizedName("powerArmorChestplate")
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.client.renderer.texture.IIconRegister
|
|||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
class ItemPowerArmorHelmet(id: Int) extends ItemPowerArmor(0, 0)
|
||||
object ItemPowerArmorHelmet extends ItemPowerArmor(0, 0)
|
||||
//with IBreathableArmor
|
||||
//with IGoggles
|
||||
//with IRevealer
|
||||
|
|
|
@ -5,7 +5,7 @@ import cpw.mods.fml.relauncher.Side
|
|||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.machinemuse.utils.render.MuseRenderer
|
||||
|
||||
class ItemPowerArmorLeggings(id: Int) extends ItemPowerArmor(0, 2) {
|
||||
object ItemPowerArmorLeggings extends ItemPowerArmor(0, 2) {
|
||||
val iconpath = MuseRenderer.ICON_PREFIX + "armorlegs"
|
||||
|
||||
setUnlocalizedName("powerArmorLeggings")
|
||||
|
|
|
@ -81,13 +81,13 @@ with ModeChangingModularItem {
|
|||
* <p/>
|
||||
* Returns: Whether to increment player use stats with this item
|
||||
*/
|
||||
def onBlockDestroyed(stack: ItemStack, world: World, blockID: Int, x: Int, y: Int, z: Int, entity: EntityLivingBase): Boolean = {
|
||||
override def onBlockDestroyed(stack: ItemStack, world: World, block: Block, x: Int, y: Int, z: Int, entity: EntityLivingBase): Boolean = {
|
||||
entity match {
|
||||
case player: EntityPlayer =>
|
||||
import scala.collection.JavaConversions._
|
||||
for (module <- ModuleManager.getBlockBreakingModules) {
|
||||
if (ModuleManager.itemHasActiveModule(stack, module.getDataName)) {
|
||||
if (module.onBlockDestroyed(stack, world, blockID, x, y, z, player)) {
|
||||
if (module.onBlockDestroyed(stack, world, block, x, y, z, player)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ public class ApiaristArmorModule extends PowerModuleBase {
|
|||
|
||||
public ApiaristArmorModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
ItemStack stack = ModCompatability.getForestryItem("craftingMaterial", 6);
|
||||
stack.setItemDamage(3);
|
||||
addInstallCost(stack);
|
||||
// ItemStack stack = ModCompatability.getForestryItem("craftingMaterial", 6);
|
||||
// stack.setItemDamage(3);
|
||||
// addInstallCost(stack);
|
||||
addBaseProperty(APIARIST_ARMOR_ENERGY_CONSUMPTION, 10, "J");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.machinemuse.powersuits.powermodule.misc;
|
|||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
||||
import net.machinemuse.utils.MuseCommonStrings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class AirtightSealModule extends PowerModuleBase {
|
|||
|
||||
public AirtightSealModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Block.glass));
|
||||
addInstallCost(new ItemStack(Blocks.glass));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.machinemuse.utils.MuseCommonStrings;
|
|||
import net.machinemuse.utils.MuseHeatUtils;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -24,7 +25,7 @@ public class CoolingSystemModule extends PowerModuleBase implements IPlayerTickM
|
|||
|
||||
public CoolingSystemModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Item.eyeOfEnder, 4));
|
||||
addInstallCost(new ItemStack(Items.ender_eye, 4));
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.controlCircuit, 1));
|
||||
addTradeoffProperty("Power", COOLING_BONUS, 4, "%");
|
||||
addTradeoffProperty("Power", ENERGY, 10, "J/t");
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.machinemuse.powersuits.powermodule.movement;
|
|||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.api.moduletrigger.IRightClickModule;
|
||||
import net.machinemuse.numina.player.NuminaPlayerUtils;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
||||
import net.machinemuse.utils.ElectricItemUtils;
|
||||
|
@ -62,7 +63,7 @@ public class BlinkDriveModule extends PowerModuleBase implements IRightClickModu
|
|||
double range = ModuleManager.computeModularProperty(itemStack, BLINK_DRIVE_RANGE);
|
||||
double energyConsumption = ModuleManager.computeModularProperty(itemStack, BLINK_DRIVE_ENERGY_CONSUMPTION);
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > energyConsumption) {
|
||||
MusePlayerUtils.resetFloatKickTicks(player);
|
||||
NuminaPlayerUtils.resetFloatKickTicks(player);
|
||||
ElectricItemUtils.drainPlayerEnergy(player, energyConsumption);
|
||||
world.playSoundAtEntity(player, "mob.endermen.portal", 0.5F, 0.4F / ((float) Math.random() * 0.4F + 0.8F));
|
||||
// MuseLogger.logDebug("Range: " + range);
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.machinemuse.api.IModularItem;
|
|||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
|
||||
import net.machinemuse.api.moduletrigger.IToggleableModule;
|
||||
import net.machinemuse.numina.player.NuminaPlayerUtils;
|
||||
import net.machinemuse.powersuits.control.PlayerInputMap;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
||||
|
@ -55,12 +56,12 @@ public class GliderModule extends PowerModuleBase implements IToggleableModule,
|
|||
Vec3 playerHorzFacing = player.getLookVec();
|
||||
playerHorzFacing.yCoord = 0;
|
||||
playerHorzFacing.normalize();
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.username);
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.getCommandSenderName());
|
||||
boolean sneakkey = movementInput.sneakKey;
|
||||
float forwardkey = movementInput.forwardKey;
|
||||
ItemStack torso = player.getCurrentArmor(2);
|
||||
boolean hasParachute = false;
|
||||
MusePlayerUtils.resetFloatKickTicks(player);
|
||||
NuminaPlayerUtils.resetFloatKickTicks(player);
|
||||
if (torso != null && torso.getItem() instanceof IModularItem) {
|
||||
hasParachute = ModuleManager.itemHasActiveModule(torso, ParachuteModule.MODULE_PARACHUTE);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.machinemuse.powersuits.powermodule.movement;
|
|||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
|
||||
import net.machinemuse.api.moduletrigger.IToggleableModule;
|
||||
import net.machinemuse.numina.player.NuminaPlayerUtils;
|
||||
import net.machinemuse.powersuits.control.PlayerInputMap;
|
||||
import net.machinemuse.powersuits.event.MovementManager;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
|
@ -51,7 +52,7 @@ public class JumpAssistModule extends PowerModuleBase implements IToggleableModu
|
|||
|
||||
@Override
|
||||
public void onPlayerTickActive(EntityPlayer player, ItemStack item) {
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.username);
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.getCommandSenderName());
|
||||
boolean jumpkey = movementInput.jumpKey;
|
||||
if (jumpkey) {
|
||||
double multiplier = MovementManager.getPlayerJumpMultiplier(player);
|
||||
|
@ -63,7 +64,7 @@ public class JumpAssistModule extends PowerModuleBase implements IToggleableModu
|
|||
} else {
|
||||
MovementManager.setPlayerJumpTicks(player, 0);
|
||||
}
|
||||
MusePlayerUtils.resetFloatKickTicks(player);
|
||||
NuminaPlayerUtils.resetFloatKickTicks(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.machinemuse.api.IModularItem;
|
|||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
|
||||
import net.machinemuse.api.moduletrigger.IToggleableModule;
|
||||
import net.machinemuse.numina.player.NuminaPlayerUtils;
|
||||
import net.machinemuse.powersuits.control.PlayerInputMap;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
||||
|
@ -46,12 +47,12 @@ public class ParachuteModule extends PowerModuleBase implements IToggleableModul
|
|||
|
||||
@Override
|
||||
public void onPlayerTickActive(EntityPlayer player, ItemStack item) {
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.username);
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.getCommandSenderName());
|
||||
float forwardkey = movementInput.forwardKey;
|
||||
boolean sneakkey = movementInput.sneakKey;
|
||||
ItemStack torso = player.getCurrentArmor(2);
|
||||
boolean hasGlider = false;
|
||||
MusePlayerUtils.resetFloatKickTicks(player);
|
||||
NuminaPlayerUtils.resetFloatKickTicks(player);
|
||||
if (torso != null && torso.getItem() instanceof IModularItem) {
|
||||
hasGlider = ModuleManager.itemHasActiveModule(torso, GliderModule.MODULE_GLIDER);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
|||
import net.machinemuse.utils.MuseCommonStrings;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class ShockAbsorberModule extends PowerModuleBase implements IToggleableM
|
|||
super(validItems);
|
||||
addSimpleTradeoff(this, "Power", SHOCK_ABSORB_ENERGY_CONSUMPTION, "J/m", 0, 10, SHOCK_ABSORB_MULTIPLIER, "%", 0, 1);
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.servoMotor, 2));
|
||||
addInstallCost(new ItemStack(Block.cloth, 2));
|
||||
addInstallCost(new ItemStack(Blocks.wool, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,7 +59,7 @@ public class AquaAffinityModule extends PowerModuleBase implements IBlockBreakin
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
if (player.isInsideOfMaterial(Material.water) || !player.onGround) {
|
||||
ElectricItemUtils.drainPlayerEnergy(player,
|
||||
ModuleManager.computeModularProperty(stack, AQUA_AFFINITY_ENERGY_CONSUMPTION));
|
||||
|
|
|
@ -67,7 +67,7 @@ public class AxeModule extends PowerModuleBase implements IBlockBreakingModule,
|
|||
|
||||
@Override
|
||||
public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) {
|
||||
if (ironAxe.canHarvestBlock(block) || ForgeHooks.canToolHarvestBlock(block, meta, ironAxe)) {
|
||||
if (ForgeHooks.canToolHarvestBlock(block, meta, ironAxe)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, AXE_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ public class AxeModule extends PowerModuleBase implements IBlockBreakingModule,
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
Block block = Block.blocksList[blockID];
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (canHarvestBlock(stack, block, meta, player)) {
|
||||
double energyConsumption = ModuleManager.computeModularProperty(stack, AXE_ENERGY_CONSUMPTION);
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.machinemuse.utils.MuseCommonStrings;
|
|||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -22,12 +23,12 @@ import java.util.List;
|
|||
|
||||
public class DiamondPickUpgradeModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
|
||||
public static final String MODULE_DIAMOND_PICK_UPGRADE = "Diamond Drill Upgrade";
|
||||
public static final ItemStack diamondPick = new ItemStack(Item.pickaxeDiamond);
|
||||
public static final ItemStack diamondPick = new ItemStack(Items.diamond_pickaxe);
|
||||
|
||||
public DiamondPickUpgradeModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
|
||||
addInstallCost(new ItemStack(Item.diamond, 3));
|
||||
addInstallCost(new ItemStack(Items.diamond, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,8 +58,8 @@ public class DiamondPickUpgradeModule extends PowerModuleBase implements IBlockB
|
|||
|
||||
@Override
|
||||
public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) {
|
||||
if (!PickaxeModule.ironPickaxe.canHarvestBlock(block) && !ForgeHooks.canToolHarvestBlock(block, meta, PickaxeModule.ironPickaxe)) {
|
||||
if (diamondPick.canHarvestBlock(block) || ForgeHooks.canToolHarvestBlock(block, meta, diamondPick)) {
|
||||
if (!ForgeHooks.canToolHarvestBlock(block, meta, PickaxeModule.ironPickaxe)) {
|
||||
if (ForgeHooks.canToolHarvestBlock(block, meta, diamondPick)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, PickaxeModule.PICKAXE_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -68,8 +69,7 @@ public class DiamondPickUpgradeModule extends PowerModuleBase implements IBlockB
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
Block block = Block.blocksList[blockID];
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x,y,z);
|
||||
if (canHarvestBlock(stack, block, meta, player) && !PickaxeModule.harvestCheck(stack, block, meta, player)) {
|
||||
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(stack, PickaxeModule.PICKAXE_ENERGY_CONSUMPTION));
|
||||
|
|
|
@ -38,6 +38,6 @@ class FieldTinkerModule(list: java.util.List[IModularItem]) extends PowerModuleB
|
|||
def onPlayerStoppedUsing(itemStack: ItemStack, world: World, player: EntityPlayer, par4: Int) {}
|
||||
|
||||
def onRightClick(player: EntityPlayer, world: World, item: ItemStack) {
|
||||
player.openGui(ModularPowersuits.INSTANCE, 2, world, player.posX.toInt, player.posY.toInt, player.posZ.toInt)
|
||||
player.openGui(ModularPowersuits, 2, world, player.posX.toInt, player.posY.toInt, player.posZ.toInt)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class GrafterModule extends PowerModuleBase {
|
|||
|
||||
public GrafterModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(ModCompatability.getForestryItem("grafter", 1));
|
||||
// addInstallCost(ModCompatability.getForestryItem("grafter", 1));
|
||||
addBaseProperty(GRAFTER_ENERGY_CONSUMPTION, 1000, "J");
|
||||
addBaseProperty(GRAFTER_HEAT_GENERATION, 20);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
|||
import net.machinemuse.utils.ElectricItemUtils;
|
||||
import net.machinemuse.utils.MuseCommonStrings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -24,8 +25,8 @@ public class LuxCapacitor extends PowerModuleBase implements IRightClickModule {
|
|||
|
||||
public LuxCapacitor(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Item.glowstone, 1));
|
||||
addInstallCost(new ItemStack(Item.ingotIron, 2));
|
||||
addInstallCost(new ItemStack(Items.glowstone_dust, 1));
|
||||
addInstallCost(new ItemStack(Items.iron_ingot, 2));
|
||||
addBaseProperty(ENERGY, 100, "J");
|
||||
addTradeoffProperty("Red", RED, 1, "%");
|
||||
addTradeoffProperty("Green", GREEN, 1, "%");
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.machinemuse.utils.MuseCommonStrings;
|
|||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -22,13 +23,13 @@ import java.util.List;
|
|||
|
||||
public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
|
||||
public static final String MODULE_PICKAXE = "Pickaxe";
|
||||
public static final ItemStack ironPickaxe = new ItemStack(Item.pickaxeIron);
|
||||
public static final String PICKAXE_HARVEST_SPEED = "Pickaxe Harvest Speed";
|
||||
public static final String PICKAXE_ENERGY_CONSUMPTION = "Pickaxe Energy Consumption";
|
||||
public static final ItemStack ironPickaxe = new ItemStack(Items.iron_pickaxe);
|
||||
|
||||
public PickaxeModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Item.ingotIron, 3));
|
||||
addInstallCost(new ItemStack(Items.iron_ingot, 3));
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
|
||||
addBaseProperty(PICKAXE_ENERGY_CONSUMPTION, 50, "J");
|
||||
addBaseProperty(PICKAXE_HARVEST_SPEED, 8, "x");
|
||||
|
@ -67,8 +68,7 @@ public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModu
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
Block block = Block.blocksList[blockID];
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x,y,z);
|
||||
if (canHarvestBlock(stack, block, meta, player)) {
|
||||
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(stack, PICKAXE_ENERGY_CONSUMPTION));
|
||||
|
@ -84,7 +84,7 @@ public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModu
|
|||
}
|
||||
|
||||
public static boolean harvestCheck(ItemStack stack, Block block, int meta, EntityPlayer player) {
|
||||
if (ironPickaxe.canHarvestBlock(block) || ForgeHooks.canToolHarvestBlock(block, meta, ironPickaxe)) {
|
||||
if (ForgeHooks.canToolHarvestBlock(block, meta, ironPickaxe)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, PICKAXE_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class RedstoneLaser(list: java.util.List[IModularItem]) extends PowerModuleBase(
|
|||
def onPlayerStoppedUsing(itemStack: ItemStack, world: World, player: EntityPlayer, par4: Int) {}
|
||||
|
||||
def onRightClick(player: EntityPlayer, world: World, item: ItemStack) {
|
||||
player.openGui(ModularPowersuits.INSTANCE, 2, world, player.posX.toInt, player.posY.toInt, player.posZ.toInt)
|
||||
player.openGui(ModularPowersuits, 2, world, player.posX.toInt, player.posY.toInt, player.posZ.toInt)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
|
@ -32,14 +33,14 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
public class ShearsModule extends PowerModuleBase implements IBlockBreakingModule, IRightClickModule {
|
||||
public static final ItemStack shears = new ItemStack(Item.shears);
|
||||
public static final ItemStack shears = new ItemStack(Items.shears);
|
||||
public static final String MODULE_SHEARS = "Shears";
|
||||
private static final String SHEARING_ENERGY_CONSUMPTION = "Shearing Energy Consumption";
|
||||
private static final String SHEARING_HARVEST_SPEED = "Shearing Harvest Speed";
|
||||
|
||||
public ShearsModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Item.ingotIron, 2));
|
||||
addInstallCost(new ItemStack(Items.iron_ingot, 2));
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
|
||||
addBaseProperty(SHEARING_ENERGY_CONSUMPTION, 50, "J");
|
||||
addBaseProperty(SHEARING_HARVEST_SPEED, 8, "x");
|
||||
|
@ -111,7 +112,7 @@ public class ShearsModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
|
||||
@Override
|
||||
public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) {
|
||||
if (shears.canHarvestBlock(block) || ForgeHooks.canToolHarvestBlock(block, meta, shears) || shears.getStrVsBlock(block) > 1) {
|
||||
if (ForgeHooks.canToolHarvestBlock(block, meta, shears)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, SHEARING_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -120,13 +121,12 @@ public class ShearsModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
if (player.worldObj.isRemote) {
|
||||
return false;
|
||||
}
|
||||
int id = player.worldObj.getBlockId(x, y, z);
|
||||
if (Block.blocksList[id] instanceof IShearable && ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(itemstack, SHEARING_ENERGY_CONSUMPTION)) {
|
||||
IShearable target = (IShearable) Block.blocksList[id];
|
||||
if (block instanceof IShearable && ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(itemstack, SHEARING_ENERGY_CONSUMPTION)) {
|
||||
IShearable target = (IShearable) block;
|
||||
if (target.isShearable(itemstack, player.worldObj, x, y, z)) {
|
||||
ArrayList<ItemStack> drops = target.onSheared(itemstack, player.worldObj, x, y, z,
|
||||
EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
|
||||
|
@ -143,7 +143,7 @@ public class ShearsModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
}
|
||||
|
||||
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(itemstack, SHEARING_ENERGY_CONSUMPTION));
|
||||
player.addStat(StatList.mineBlockStatArray[id], 1);
|
||||
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -151,8 +151,8 @@ public class ShearsModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
|
||||
@Override
|
||||
public void handleBreakSpeed(BreakSpeed event) {
|
||||
// TOOD: MAKE NOT STUPID
|
||||
float defaultEffectiveness = shears.getStrVsBlock(event.block);
|
||||
// TODO: MAKE NOT STUPID
|
||||
float defaultEffectiveness = 8;
|
||||
double ourEffectiveness = ModuleManager.computeModularProperty(event.entityPlayer.getCurrentEquippedItem(), SHEARING_HARVEST_SPEED);
|
||||
event.newSpeed *= Math.max(defaultEffectiveness, ourEffectiveness);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.machinemuse.utils.MuseCommonStrings;
|
|||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -22,13 +23,13 @@ import java.util.List;
|
|||
|
||||
public class ShovelModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
|
||||
public static final String MODULE_SHOVEL = "Shovel";
|
||||
public static final ItemStack ironShovel = new ItemStack(Item.shovelIron);
|
||||
public static final ItemStack ironShovel = new ItemStack(Items.iron_shovel);
|
||||
public static final String SHOVEL_HARVEST_SPEED = "Shovel Harvest Speed";
|
||||
public static final String SHOVEL_ENERGY_CONSUMPTION = "Shovel Energy Consumption";
|
||||
|
||||
public ShovelModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addInstallCost(new ItemStack(Item.ingotIron, 3));
|
||||
addInstallCost(new ItemStack(Items.iron_ingot, 3));
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
|
||||
addBaseProperty(SHOVEL_ENERGY_CONSUMPTION, 50, "J");
|
||||
addBaseProperty(SHOVEL_HARVEST_SPEED, 8, "x");
|
||||
|
@ -63,7 +64,7 @@ public class ShovelModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
|
||||
@Override
|
||||
public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) {
|
||||
if (ironShovel.canHarvestBlock(block) || ForgeHooks.canToolHarvestBlock(block, meta, ironShovel)) {
|
||||
if (ForgeHooks.canToolHarvestBlock(block, meta, ironShovel)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, SHOVEL_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -72,8 +73,7 @@ public class ShovelModule extends PowerModuleBase implements IBlockBreakingModul
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, int blockID, int x, int y, int z, EntityPlayer player) {
|
||||
Block block = Block.blocksList[blockID];
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x,y,z);
|
||||
if (canHarvestBlock(stack, block, meta, player)) {
|
||||
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(stack, SHOVEL_ENERGY_CONSUMPTION));
|
||||
|
|
|
@ -111,7 +111,7 @@ public class RailgunModule extends PowerModuleBase implements IRightClickModule
|
|||
* knockback);
|
||||
}
|
||||
break;
|
||||
case TILE:
|
||||
case BLOCK:
|
||||
drawParticleStreamTo(player, world, hitMOP.hitVec.xCoord, hitMOP.hitVec.yCoord, hitMOP.hitVec.zCoord);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -54,10 +54,10 @@ public class MuseBlockUtils {
|
|||
for (int i = 2; i < 6; i++) {
|
||||
int[] coords;
|
||||
coords = getAdjacentCoordinatesForSide(x, y, z, i);
|
||||
if (world.getBlockId(coords[0], coords[1], coords[2]) == block) {
|
||||
world.setBlockMetadataWithNotify(coords[0], coords[1], coords[2], SIDE_OPPOSITE[meta], 1);
|
||||
return SIDE_OPPOSITE[meta];
|
||||
}
|
||||
// if (world.getBlockId(coords[0], coords[1], coords[2]) == block) {
|
||||
// world.setBlockMetadataWithNotify(coords[0], coords[1], coords[2], SIDE_OPPOSITE[meta], 1);
|
||||
// return SIDE_OPPOSITE[meta];
|
||||
// }
|
||||
}
|
||||
return SIDE_LEFT[meta];
|
||||
case 10:
|
||||
|
@ -113,10 +113,10 @@ public class MuseBlockUtils {
|
|||
for (int i = 2; i < 6; i++) {
|
||||
int[] coords;
|
||||
coords = getAdjacentCoordinatesForSide(x, y, z, i);
|
||||
if (world.getBlockId(coords[0], coords[1], coords[2]) == block) {
|
||||
world.setBlockMetadataWithNotify(coords[0], coords[1], coords[2], SIDE_OPPOSITE[meta], 1);
|
||||
return SIDE_OPPOSITE[meta];
|
||||
}
|
||||
// if (world.getBlockId(coords[0], coords[1], coords[2]) == block) {
|
||||
// world.setBlockMetadataWithNotify(coords[0], coords[1], coords[2], SIDE_OPPOSITE[meta], 1);
|
||||
// return SIDE_OPPOSITE[meta];
|
||||
// }
|
||||
}
|
||||
return SIDE_RIGHT[meta];
|
||||
case 10:
|
||||
|
@ -145,38 +145,38 @@ public class MuseBlockUtils {
|
|||
}
|
||||
|
||||
static {
|
||||
rotateType[Block.wood.blockID] = 7;
|
||||
rotateType[Block.dispenser.blockID] = 2;
|
||||
rotateType[Block.railPowered.blockID] = 3;
|
||||
rotateType[Block.railDetector.blockID] = 3;
|
||||
rotateType[Block.pistonStickyBase.blockID] = 2;
|
||||
rotateType[Block.pistonBase.blockID] = 2;
|
||||
rotateType[Block.stoneSingleSlab.blockID] = 8;
|
||||
rotateType[Block.stairsWoodOak.blockID] = 5;
|
||||
rotateType[Block.chest.blockID] = 9;
|
||||
rotateType[Block.furnaceIdle.blockID] = 1;
|
||||
rotateType[Block.furnaceBurning.blockID] = 1;
|
||||
rotateType[Block.signPost.blockID] = 11;
|
||||
rotateType[Block.rail.blockID] = 3;
|
||||
rotateType[Block.stairsCobblestone.blockID] = 5;
|
||||
rotateType[Block.lever.blockID] = 10;
|
||||
rotateType[Block.pumpkin.blockID] = 4;
|
||||
rotateType[Block.pumpkinLantern.blockID] = 4;
|
||||
rotateType[Block.redstoneRepeaterIdle.blockID] = 6;
|
||||
rotateType[Block.redstoneRepeaterActive.blockID] = 6;
|
||||
rotateType[Block.stairsBrick.blockID] = 5;
|
||||
rotateType[Block.stairsStoneBrick.blockID] = 5;
|
||||
rotateType[Block.stairsNetherBrick.blockID] = 5;
|
||||
rotateType[Block.woodSingleSlab.blockID] = 8;
|
||||
rotateType[Block.stairsSandStone.blockID] = 5;
|
||||
rotateType[Block.enderChest.blockID] = 1;
|
||||
rotateType[Block.stairsWoodSpruce.blockID] = 5;
|
||||
rotateType[Block.stairsWoodBirch.blockID] = 5;
|
||||
rotateType[Block.stairsWoodJungle.blockID] = 5;
|
||||
rotateType[Block.chestTrapped.blockID] = 9;
|
||||
rotateType[Block.stairsNetherQuartz.blockID] = 5;
|
||||
rotateType[Block.hopperBlock.blockID] = 2;
|
||||
rotateType[Block.railActivator.blockID] = 3;
|
||||
rotateType[Block.dropper.blockID] = 2;
|
||||
// rotateType[Block.wood.blockID] = 7;
|
||||
// rotateType[Block.dispenser.blockID] = 2;
|
||||
// rotateType[Block.railPowered.blockID] = 3;
|
||||
// rotateType[Block.railDetector.blockID] = 3;
|
||||
// rotateType[Block.pistonStickyBase.blockID] = 2;
|
||||
// rotateType[Block.pistonBase.blockID] = 2;
|
||||
// rotateType[Block.stoneSingleSlab.blockID] = 8;
|
||||
// rotateType[Block.stairsWoodOak.blockID] = 5;
|
||||
// rotateType[Block.chest.blockID] = 9;
|
||||
// rotateType[Block.furnaceIdle.blockID] = 1;
|
||||
// rotateType[Block.furnaceBurning.blockID] = 1;
|
||||
// rotateType[Block.signPost.blockID] = 11;
|
||||
// rotateType[Block.rail.blockID] = 3;
|
||||
// rotateType[Block.stairsCobblestone.blockID] = 5;
|
||||
// rotateType[Block.lever.blockID] = 10;
|
||||
// rotateType[Block.pumpkin.blockID] = 4;
|
||||
// rotateType[Block.pumpkinLantern.blockID] = 4;
|
||||
// rotateType[Block.redstoneRepeaterIdle.blockID] = 6;
|
||||
// rotateType[Block.redstoneRepeaterActive.blockID] = 6;
|
||||
// rotateType[Block.stairsBrick.blockID] = 5;
|
||||
// rotateType[Block.stairsStoneBrick.blockID] = 5;
|
||||
// rotateType[Block.stairsNetherBrick.blockID] = 5;
|
||||
// rotateType[Block.woodSingleSlab.blockID] = 8;
|
||||
// rotateType[Block.stairsSandStone.blockID] = 5;
|
||||
// rotateType[Block.enderChest.blockID] = 1;
|
||||
// rotateType[Block.stairsWoodSpruce.blockID] = 5;
|
||||
// rotateType[Block.stairsWoodBirch.blockID] = 5;
|
||||
// rotateType[Block.stairsWoodJungle.blockID] = 5;
|
||||
// rotateType[Block.chestTrapped.blockID] = 9;
|
||||
// rotateType[Block.stairsNetherQuartz.blockID] = 5;
|
||||
// rotateType[Block.hopperBlock.blockID] = 2;
|
||||
// rotateType[Block.railActivator.blockID] = 3;
|
||||
// rotateType[Block.dropper.blockID] = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ public class MuseItemUtils {
|
|||
public static boolean isSameItem(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
} else if (stack1.itemID != stack2.itemID) {
|
||||
} else if (stack1.getItem() != stack2.getItem()) {
|
||||
return false;
|
||||
} else
|
||||
return !((!stack1.isItemStackDamageable())
|
||||
|
@ -313,7 +313,7 @@ public class MuseItemUtils {
|
|||
// Then try to add the items to empty slots
|
||||
for (int i = 0; i < player.inventory.getSizeInventory() && itemsToGive.stackSize > 0; i++) {
|
||||
if (player.inventory.getStackInSlot(i) == null) {
|
||||
ItemStack destination = new ItemStack(itemsToGive.itemID, 0, itemsToGive.getItemDamage());
|
||||
ItemStack destination = new ItemStack(itemsToGive.getItem(), 0, itemsToGive.getItemDamage());
|
||||
transferStackWithChance(itemsToGive, destination, chanceOfSuccess);
|
||||
if (destination.stackSize > 0) {
|
||||
player.inventory.setInventorySlotContents(i, destination);
|
||||
|
@ -327,7 +327,7 @@ public class MuseItemUtils {
|
|||
if (MuseMathUtils.nextDouble() < chanceOfSuccess) {
|
||||
ItemStack copyStack = itemsToGive.copy();
|
||||
copyStack.stackSize = 1;
|
||||
player.dropPlayerItem(copyStack);
|
||||
player.dropPlayerItemWithRandomChoice(copyStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.machinemuse.api.IModularItem;
|
|||
import net.machinemuse.api.ModuleManager;
|
||||
import net.machinemuse.numina.general.MuseLogger;
|
||||
import net.machinemuse.numina.general.MuseMathUtils;
|
||||
import net.machinemuse.numina.player.NuminaPlayerUtils;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.control.PlayerInputMap;
|
||||
import net.machinemuse.powersuits.powermodule.movement.FlightControlModule;
|
||||
|
@ -83,7 +84,7 @@ public class MusePlayerUtils {
|
|||
|
||||
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance, playerPosition.yCoord
|
||||
+ playerLook.yCoord * reachDistance, playerPosition.zCoord + playerLook.zCoord * reachDistance);
|
||||
return world.rayTraceBlocks_do_do(playerPosition, playerViewOffset, collisionFlag, !collisionFlag);
|
||||
return world.rayTraceBlocks(playerPosition, playerViewOffset);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition doCustomRayTrace(World world, EntityPlayer player, boolean collisionFlag, double reachDistance) {
|
||||
|
@ -136,12 +137,12 @@ public class MusePlayerUtils {
|
|||
public static void teleportEntity(EntityPlayer entityPlayer, MovingObjectPosition hitMOP) {
|
||||
if (hitMOP != null && entityPlayer instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) entityPlayer;
|
||||
if (!player.playerNetServerHandler.connectionClosed) {
|
||||
if (player.playerNetServerHandler.netManager.isChannelOpen()) {
|
||||
switch (hitMOP.typeOfHit) {
|
||||
case ENTITY:
|
||||
player.setPositionAndUpdate(hitMOP.hitVec.xCoord, hitMOP.hitVec.yCoord, hitMOP.hitVec.zCoord);
|
||||
break;
|
||||
case TILE:
|
||||
case BLOCK:
|
||||
double hitx = hitMOP.hitVec.xCoord;
|
||||
double hity = hitMOP.hitVec.yCoord;
|
||||
double hitz = hitMOP.hitVec.zCoord;
|
||||
|
@ -176,7 +177,7 @@ public class MusePlayerUtils {
|
|||
}
|
||||
|
||||
public static double thrust(EntityPlayer player, double thrust, boolean flightControl) {
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.username);
|
||||
PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.getCommandSenderName());
|
||||
boolean jumpkey = movementInput.jumpKey;
|
||||
float forwardkey = movementInput.forwardKey;
|
||||
float strafekey = movementInput.strafeKey;
|
||||
|
@ -293,7 +294,7 @@ public class MusePlayerUtils {
|
|||
player.motionX *= ratio;
|
||||
player.motionZ *= ratio;
|
||||
}
|
||||
resetFloatKickTicks(player);
|
||||
NuminaPlayerUtils.resetFloatKickTicks(player);
|
||||
return thrustUsed;
|
||||
}
|
||||
|
||||
|
@ -305,12 +306,6 @@ public class MusePlayerUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void resetFloatKickTicks(EntityPlayer player) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).playerNetServerHandler.ticksForFloatKick = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static EntityPlayer toPlayer(Object data) {
|
||||
EntityPlayer player = null;
|
||||
try {
|
||||
|
@ -329,7 +324,7 @@ public class MusePlayerUtils {
|
|||
} else if (player.isInsideOfMaterial(Material.lava)) {
|
||||
return 0;
|
||||
}
|
||||
cool += ((2.0 - getBiome(player).getFloatTemperature())/2); // Algorithm that returns a value from 0.0 -> 1.0. Biome temperature is from 0.0 -> 2.0
|
||||
cool += ((2.0 - getBiome(player).getFloatTemperature((int)player.posX, (int)player.posY, (int)player.posZ))/2); // Algorithm that returns a value from 0.0 -> 1.0. Biome temperature is from 0.0 -> 2.0
|
||||
if ((int)player.posY > 128) { // If high in the air, increase cooling
|
||||
cool += 0.5;
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ public abstract class MuseRenderer {
|
|||
double jagfactor = 0.3;
|
||||
RenderState.on2D();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE);
|
||||
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE());
|
||||
RenderState.blendingOn();
|
||||
colour.doGL();
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
|
@ -322,7 +322,7 @@ public abstract class MuseRenderer {
|
|||
}
|
||||
|
||||
public static void drawLightningBetweenPoints(double x1, double y1, double z1, double x2, double y2, double z2, int index) {
|
||||
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE);
|
||||
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE());
|
||||
double u1 = index / 50.0;
|
||||
double u2 = u1 + 0.02;
|
||||
double px = (y1 - y2) * 0.125;
|
||||
|
|
Loading…
Reference in a new issue