Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Imgbot #58

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions amunra_Client.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/amunra"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="amunra"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DFORGE_FORCE_FRAME_RECALC=true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="D:\Code\amunra\run"/>
</launchConfiguration>
13 changes: 13 additions & 0 deletions amunra_Server.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/amunra"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStartServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="amunra"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DFORGE_FORCE_FRAME_RECALC=true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="D:\Code\amunra\run"/>
</launchConfiguration>
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ version = "0.4.9"
group = "de.katzenpapst.amunra" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "AmunRa-GC"
def gc_version = "3.0.12.502"
def bc_version = "7.1.22"
def bc_version = "7.1.23"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -76,12 +76,12 @@ dependencies {
compile ("com.enderio:EnderIO:1.7.10-2.3.0.429_beta:dev" ) {
transitive = false
}
compile name: "buildcraft", version: "${bc_version}", classifier: "dev"
compile name: 'buildcraft', version: "${bc_version}", classifier: "dev", ext: 'jar'

compile files("libs/MicdoodleCore-Dev-1.7-${gc_version}.jar")
compile files("libs/Galacticraft-API-1.7-${gc_version}.jar")
compile files("libs/GalacticraftCore-Dev-${gc_version}.jar")
compile files("libs/Galacticraft-Planets-Dev-${gc_version}.jar")
compile files("libs/GalacticraftCore-Dev-1.7-${gc_version}.jar")
compile files("libs/Galacticraft-Planets-Dev-1.7-${gc_version}.jar")

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@ public BlockHydroponics(String name, String sideTexture) {
super(name, sideTexture);
}



@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
entityPlayer.openGui(AmunRa.instance, GuiIds.GUI_HYDROPONICS, world, x, y, z);
return true;
// return false;
}

@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileEntityHydroponics) {
TileEntityHydroponics multiBlock = (TileEntityHydroponics) tile;
if (multiBlock.hasMaster()) {

multiBlock.updateMultiblock();

world.markBlockForUpdate(x, y, z);
}
}
super.onNeighborBlockChange(world, x, y, z, block);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2)
GCCoreUtil.drawStringCentered(status, this.xSize / 2, 70, 4210752, this.fontRendererObj);
}

GCCoreUtil.drawStringCentered("IsMaster "+tile.isMaster(), this.xSize / 2, 60, 4210752, this.fontRendererObj);
GCCoreUtil.drawStringCentered("NumBlocks "+tile.getNumBlocks(), this.xSize / 2, 70, 4210752, this.fontRendererObj);

updateTheButton(growStatus);

this.fontRendererObj.drawString(GCCoreUtil.translate("container.inventory"), 8, this.ySize - 90 + 2, 4210752);
Expand Down
35 changes: 32 additions & 3 deletions src/main/java/de/katzenpapst/amunra/item/ItemNanotool.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import de.katzenpapst.amunra.helper.InteroperabilityHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
Expand All @@ -26,7 +25,10 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
Expand Down Expand Up @@ -155,7 +157,10 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer
if(entityPlayer.isSneaking()) {
// the wrench sometimes works when sneak-rightclicking
if(this.hasEnoughEnergyAndMode(itemStack, energyCostUseBig, Mode.WRENCH)) {
if(Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {

MovingObjectPosition movingobjectposition = getPlayerLookingAt(world, entityPlayer);

if(movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) {
return super.onItemRightClick(itemStack, world, entityPlayer);
}
}
Expand All @@ -177,6 +182,27 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer
return super.onItemRightClick(itemStack, world, entityPlayer);
}

protected MovingObjectPosition getPlayerLookingAt(World world, EntityPlayer player)
{
// mostly stolen from ItemBoat
float touchDistance = 1.0F;
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * touchDistance;
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * touchDistance;
double startX = player.prevPosX + (player.posX - player.prevPosX) * (double)touchDistance;
double startY = player.prevPosY + (player.posY - player.prevPosY) * (double)touchDistance + 1.62D - (double)player.yOffset;
double startZ = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)touchDistance;
Vec3 vectorStart = Vec3.createVectorHelper(startX, startY, startZ);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float endY = MathHelper.sin(-f1 * 0.017453292F);
float endX = f4 * f5;
float endZ = f3 * f5;
double d3 = 5.0D;
Vec3 vectorEnd = vectorStart.addVector((double)endX * d3, (double)endY * d3, (double)endZ * d3);
return world.rayTraceBlocks(vectorStart, vectorEnd, true);
}

public Mode getNextMode(Mode fromMode)
{
switch(fromMode) {
Expand Down Expand Up @@ -620,7 +646,10 @@ public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer
ItemStack stack = player.inventory.getCurrentItem();

if(this.hasEnoughEnergyAndMode(stack, energyCostUseSmall, Mode.WRENCH)) {
if(Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {

MovingObjectPosition mpos = getPlayerLookingAt(world, player);

if(mpos != null && mpos.typeOfHit == MovingObjectType.BLOCK) {
return true;
}
}
Expand Down
Loading