Skip to content

Commit

Permalink
Fix almost everything
Browse files Browse the repository at this point in the history
Only thing still broken is the Closed Pipe trigger texture
  • Loading branch information
multiplemonomials committed Apr 8, 2016
1 parent d6d8e23 commit c10cd85
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 30 deletions.
15 changes: 15 additions & 0 deletions AP Client 1.8 Template.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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="/AdditionalPipesBC"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--username=&lt;username&gt; --password=&lt;password&gt;"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AdditionalPipesBC"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.lwjgl.librarypath=${env_var:userprofile}${env_var:HOME}\.gradle\caches\minecraft\net\minecraft\minecraft_natives\1.8.9"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:AdditionalPipesBC/minecraft}"/>
</launchConfiguration>
1 change: 0 additions & 1 deletion AdditionalPipesBC_Client.launch

This file was deleted.

1 change: 0 additions & 1 deletion AdditionalPipesBC_Server.launch

This file was deleted.

11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ archivesBaseName = "additionalpipes"

minecraft {
version = "1.8.9-11.15.1.1764"
runDir = "eclipse/assets"
runDir = "minecraft"
mappings = "stable_20"

}

repositories {
ivy {
name "BuildCraft"
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
}
}

dependencies {
deobf files('lib/buildcraft-7.2.0-dev.jar')
compile name: 'buildcraft', version: "7.2.5", classifier: "dev", ext: 'jar'
}

sourceSets {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/buildcraft/additionalpipes/AdditionalPipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
Expand Down Expand Up @@ -75,6 +74,7 @@
import buildcraft.transport.PipeTransportFluids;
import buildcraft.transport.PipeTransportPower;
import buildcraft.transport.pipes.PipeFluidsGold;
import buildcraft.transport.pipes.PipeFluidsIron;
import buildcraft.transport.pipes.PipePowerGold;
import buildcraft.transport.pipes.PipePowerIron;

Expand Down Expand Up @@ -179,7 +179,7 @@ public void init(FMLInitializationEvent event)
Log.info("Registering chunk load handler");
ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkLoadingHandler());
chunkLoadViewer = new ChunkLoadViewDataProxy(APConfiguration.chunkSightRange);
FMLCommonHandler.instance().bus().register(chunkLoadViewer);
MinecraftForge.EVENT_BUS.register(chunkLoadViewer);

proxy.registerKeyHandler();

Expand Down Expand Up @@ -406,8 +406,7 @@ private void loadPipes() {
pipePowerSwitch = PipeCreator.createPipeAndRecipe(1, PipeSwitchPower.class, new Object[] {pipeItemsSwitch, Items.redstone }, true);

//set fluid capacity to the average between iron and gold
//int switchFluidCapacity = (PipeTransportFluids.fluidCapacities.get(PipeFluidsGold.class) + PipeTransportFluids.fluidCapacities.get(PipeFluidsIron.class))/ 2;
int switchFluidCapacity = PipeTransportFluids.fluidCapacities.get(PipeFluidsGold.class);
int switchFluidCapacity = (PipeTransportFluids.fluidCapacities.get(PipeFluidsGold.class) + PipeTransportFluids.fluidCapacities.get(PipeFluidsIron.class))/ 2;

PipeTransportFluids.fluidCapacities.put(PipeSwitchFluids.class, switchFluidCapacity);
pipeLiquidsSwitch = PipeCreator.createPipeAndRecipe(1, PipeSwitchFluids.class, new Object[] {pipeItemsSwitch, BuildCraftTransport.pipeWaterproof }, true);
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/buildcraft/additionalpipes/gates/APTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.additionalpipes.AdditionalPipes;
import buildcraft.additionalpipes.utils.Log;
import buildcraft.api.statements.IStatement;
import buildcraft.api.statements.StatementManager;

public abstract class APTrigger implements IStatement {

protected String id;
protected String id; //used as unique key in BC registry
protected String descriptionKey; //used for description translations
protected ResourceLocation texture;

@SideOnly(Side.CLIENT)
Expand All @@ -24,9 +28,11 @@ public abstract class APTrigger implements IStatement {
*/
public APTrigger(String idWithoutPrefix)
{
this.id = "additionalpipes:" + idWithoutPrefix;
descriptionKey = "trigger." + idWithoutPrefix;

this.id = "additionalpipes:" + descriptionKey;
StatementManager.statements.put(this.id, this);
texture = new ResourceLocation("additionalpipes:textures/items/" + idWithoutPrefix);
texture = new ResourceLocation(AdditionalPipes.MODID, "textures/items/triggers/" + idWithoutPrefix);

MinecraftForge.EVENT_BUS.register(this);
}
Expand All @@ -35,6 +41,8 @@ public APTrigger(String idWithoutPrefix)
@SideOnly(Side.CLIENT)
public void stitchTextures(TextureStitchEvent.Pre event) {
sprite = event.map.getTextureExtry(texture.toString());

Log.debug("resource location: " + texture.toString());
}

@Override
Expand All @@ -48,5 +56,11 @@ public String getUniqueTag()
{
return id;
}

@Override
public String getDescription()
{
return StatCollector.translateToLocal(descriptionKey);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package buildcraft.additionalpipes.gates;

import net.minecraft.util.StatCollector;
import buildcraft.additionalpipes.pipes.PipeItemsClosed;
import buildcraft.additionalpipes.utils.Log;
import buildcraft.api.statements.IStatement;
Expand All @@ -13,14 +12,10 @@ public class TriggerPipeClosed extends APTrigger implements ITriggerInternal {

public TriggerPipeClosed()
{
super("trigger.pipeclosed");
super("pipeClosed");
}

@Override
public String getDescription()
{
return StatCollector.translateToLocal("gate.pipeClosed");
}


@Override
public boolean isTriggerActive(IStatementContainer statement, IStatementParameter[] parameters)
Expand Down
21 changes: 18 additions & 3 deletions src/main/java/buildcraft/additionalpipes/pipes/APPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,24 @@ public IIconProvider getIconProvider()
* @param fromSide the side that the item should come from.
*/
protected void injectItem(ItemStack toInject, EnumFacing fromSide)
{
Vec3 entPos = Utils.convertMiddle(container.getPos().offset(fromSide)).add(Utils.convert(fromSide, -0.6));

{
Vec3 entPos = Utils.convertMiddle(container.getPos()).add(Utils.convert(fromSide.getOpposite(), -0.5));


TravelingItem entity = TravelingItem.make(entPos, toInject);
((PipeTransportItems) transport).injectItem(entity, fromSide.getOpposite());
}

/**
* Inject an item into the pipe. Don't call this if the pipe isn't an item pipe!
*
* @param toInject the ItemStack to inject
* @param fromSide the side that the item should come from.
*/
protected void injectItemAtCenter(ItemStack toInject, EnumFacing fromSide)
{
Vec3 entPos = Utils.convertMiddle(container.getPos());

TravelingItem entity = TravelingItem.make(entPos, toInject);
((PipeTransportItems) transport).injectItem(entity, fromSide.getOpposite());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import buildcraft.core.lib.RFBattery;
import buildcraft.core.lib.inventory.InvUtils;
import buildcraft.core.lib.utils.Utils;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyReceiver;

public class PipeItemsAdvancedWood extends APPipe<PipeTransportAdvancedWood> implements IEnergyHandler
public class PipeItemsAdvancedWood extends APPipe<PipeTransportAdvancedWood> implements IEnergyReceiver
{

protected RFBattery battery = new RFBattery(640, 640, 0);
Expand Down Expand Up @@ -233,4 +233,10 @@ public int getMaxEnergyStored(EnumFacing from)
return battery.getMaxEnergyStored();
}

@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate)
{
return battery.receiveEnergy(maxReceive, simulate);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void eventHandler(PipeEventItem.Entered event)

//can no longer set position of TravelingItems as of BC 7.2, so we have to make a new one

EnumFacing newOrientation = otherPipe.getOpenOrientation().getOpposite();
EnumFacing newOrientation = otherPipe.getOpenOrientation();

otherPipe.injectItem(event.item.getItemStack(), newOrientation);
otherPipe.injectItemAtCenter(event.item.getItemStack(), newOrientation);

Log.debug(event.item + " from " + getPosition() + " to " + otherPipe.getPosition() + ": " + newOrientation.getName2());
event.cancelled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.additionalpipes.APConfiguration;
import buildcraft.transport.PipeTransportFluids;

public class PipeLiquidsWaterPump extends APPipe<PipeTransportFluids> {
Expand All @@ -27,7 +28,7 @@ public void updateEntity()
super.updateEntity();
if(getWorld().getBlockState(container.getPos().down()).getBlock() == water)
{
transport.fill(EnumFacing.DOWN, new FluidStack(FluidRegistry.WATER, 100), true);
transport.fill(EnumFacing.DOWN, new FluidStack(FluidRegistry.WATER, APConfiguration.waterPumpWaterPerTick), true);

}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/additionalpipes/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gui.NBT=Tag
gui.metadata=Meta
gui.acceptUnsorted=Accept Unsorted

gate.pipeClosed=Pipe Closed (Storing Items)
trigger.pipeClosed=Pipe Closed (Storing Items)

key.lasers=Show chunk load boundaries

Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/assets/additionalpipes/lang/ja_JP.lang
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ gui.tab.south=南
gui.tab.east=東
gui.tab.west=西

gui.match=
trigger.pipeClosed=パイプ閉まっている

gui.match=一致
gui.NBT=タグ
gui.metadata= メタデータ
gui.acceptUnsorted=分けられなかった

itemGroup.buildcraft.apcreativetab=Additional Pipes
itemGroup.buildcraft.apcreativetab=Additional Pipes (別枠パイプ)

key.lasers=Chunk load boundaries

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/additionalpipes/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gui.pipeItemsPriorityInsertion=Приоритетная вводящая тру
gui.PipeItemsAdvancedWood=Продвинутая деревянная труба
gui.jeweled_pipe=Драгоценная труба

gate.pipeClosed=Труба закрыта (Накапливает предметы)
trigger.pipeClosed=Труба закрыта (Накапливает предметы)
gate.phasedSignalRed=Красный переключаемый сигнал
gate.phasedSignalBlue=Синий переключаемый сигнал
gate.phasedSignalGreen=Зелёный переключаемый сигнал
Expand Down

0 comments on commit c10cd85

Please sign in to comment.