merged with BuildCraft-5.1.x
This commit is contained in:
commit
9827966140
10 changed files with 185 additions and 35 deletions
|
@ -15,7 +15,7 @@ Do not submit pull requests which solely "fix" formatting. As these kinds of cha
|
|||
Please only submit "code cleanup", if the changes actually have a substantial impact on readability.
|
||||
|
||||
### Reporting issues
|
||||
* Do not open an issue if you're not planning to fix it, intead open a thread on http://mod-buildcraft.com/forums/index.php?board=2.0
|
||||
* Do not open an issue if you're not planning to fix it, instead open a thread on http://mod-buildcraft.com/forums/index.php?board=2.0
|
||||
* Before reporting an issue, please check that it has not been reported before.
|
||||
* Issues are for bugs/crashes, please do not use them to ask general questions.
|
||||
* Always include the version you are having trouble with. Or if you're building from source, which source you're building.
|
||||
|
|
|
@ -232,3 +232,30 @@ tip.PipeItemsEmzuli=Gate controlled extraction pipe
|
|||
tip.PipePowerWood=Power Input Pipe
|
||||
tip.PipePowerIron=Selectable Limiter Pipe
|
||||
tip.PipeStructureCobblestone=Support pipe
|
||||
|
||||
achievement.woodenGearAchievement=A bit rough around the edges
|
||||
achievement.woodenGearAchievement.desc=Craft a wooden gear
|
||||
achievement.stoneGearAchievement=Hard as a rock
|
||||
achievement.stoneGearAchievement.desc=Upgrade a wooden gear to a stone gear
|
||||
achievement.ironGearAchievement=Is it stainless?
|
||||
achievement.ironGearAchievement.desc=Upgrade a stone gear to a iron gear
|
||||
achievement.goldGearAchievement=No, it isn't made of honey
|
||||
achievement.goldGearAchievement.desc=Upgrade a iron gear to a gold gear
|
||||
achievement.diamondGearAchievement=Shiny!
|
||||
achievement.diamondGearAchievement.desc=Upgrade a gold gear to a diamond gear
|
||||
achievement.wrenchAchievement=Just hit it!
|
||||
achievement.wrenchAchievement.desc=Make a wrench
|
||||
achievement.aLotOfCraftingAchievement=A lot of crafting
|
||||
achievement.aLotOfCraftingAchievement.desc=Craft a auto workbench
|
||||
achievement.straightDownAchievement=Straight down
|
||||
achievement.straightDownAchievement.desc=Make a mining well in the world
|
||||
achievement.chunkDestroyerAchievement=Chunk destroyer
|
||||
achievement.chunkDestroyerAchievement.desc=Craft a quarry
|
||||
achievement.fasterFillingAchievement=Faster filling
|
||||
achievement.fasterFillingAchievement.desc=Make a filler
|
||||
achievement.timeForSomeLogicAchievement=Time for some logic
|
||||
achievement.timeForSomeLogicAchievement.desc=Craft an assembly table
|
||||
achievement.refineAndRedefineAchievement=Refine and redefine
|
||||
achievement.refineAndRedefineAchievement.desc=Make a refinery
|
||||
achievement.tinglyLaserAchievement=Tingly laser
|
||||
achievement.tinglyLaserAchievement.desc=Craft a laser
|
||||
|
|
|
@ -15,21 +15,23 @@ import java.nio.IntBuffer;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
@ -82,6 +84,7 @@ import buildcraft.core.triggers.TriggerInventoryLevel;
|
|||
import buildcraft.core.triggers.TriggerMachine;
|
||||
import buildcraft.core.triggers.TriggerRedstoneInput;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
import buildcraft.core.utils.CraftingHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
|
@ -173,6 +176,21 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
@Instance("BuildCraft|Core")
|
||||
public static BuildCraftCore instance;
|
||||
|
||||
public static Achievement woodenGearAchievement;
|
||||
public static Achievement stoneGearAchievement;
|
||||
public static Achievement ironGearAchievement;
|
||||
public static Achievement goldGearAchievement;
|
||||
public static Achievement diamondGearAchievement;
|
||||
public static Achievement wrenchAchievement;
|
||||
public static Achievement aLotOfCraftingAchievement;
|
||||
public static Achievement straightDownAchievement;
|
||||
public static Achievement chunkDestroyerAchievement;
|
||||
public static Achievement fasterFillingAchievement;
|
||||
public static Achievement timeForSomeLogicAchievement;
|
||||
public static Achievement refineAndRedefineAchievement;
|
||||
public static Achievement tinglyLaserAchievement;
|
||||
public static AchievementPage BuildcraftAchievements;
|
||||
|
||||
@EventHandler
|
||||
public void loadConfiguration(FMLPreInitializationEvent evt) {
|
||||
|
||||
|
@ -310,16 +328,18 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
|
||||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new CraftingHandler());
|
||||
|
||||
CoreProxy.proxy.initializeRendering();
|
||||
CoreProxy.proxy.initializeEntityRendering();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
for (Object o : Block.blockRegistry) {
|
||||
Block block = (Block) o;
|
||||
|
||||
if (block instanceof BlockFluidBase || block instanceof IFluidBlock || block instanceof IPlantable) {
|
||||
if (block instanceof BlockFluidBase || block instanceof BlockLiquid || block instanceof IPlantable) {
|
||||
BuildCraftAPI.softBlocks.add(block);
|
||||
}
|
||||
}
|
||||
|
@ -426,4 +446,24 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
diffZ = pos.get(2);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent event) {
|
||||
woodenGearAchievement = new Achievement("achievement.woodenGear", "woodenGearAchievement", 0, 0,woodenGearItem, null).registerStat();
|
||||
stoneGearAchievement = new Achievement("achievement.stoneGear", "stoneGearAchievement", 2, 0, stoneGearItem, woodenGearAchievement).registerStat();
|
||||
ironGearAchievement = new Achievement("achievement.ironGear", "ironGearAchievement", 4, 0, ironGearItem, stoneGearAchievement).registerStat();
|
||||
goldGearAchievement = new Achievement("achievement.goldGear", "goldGearAchievement", 6, 0, goldGearItem, ironGearAchievement).registerStat();
|
||||
diamondGearAchievement = new Achievement("achievement.diamondGear", "diamondGearAchievement", 8, 0, diamondGearItem, goldGearAchievement).registerStat();
|
||||
wrenchAchievement = new Achievement("achievement.wrench", "wrenchAchievement", 3, 2, wrenchItem, stoneGearAchievement).registerStat();
|
||||
aLotOfCraftingAchievement = new Achievement("achievement.aLotOfCrafting", "aLotOfCraftingAchievement", 1, 2, BuildCraftFactory.autoWorkbenchBlock, woodenGearAchievement).registerStat();
|
||||
straightDownAchievement = new Achievement("achievement.straightDown", "straightDownAchievement", 5, 2, BuildCraftFactory.miningWellBlock, ironGearAchievement).registerStat();
|
||||
chunkDestroyerAchievement = new Achievement("achievement.chunkDestroyer", "chunkDestroyerAchievement", 9, 2, BuildCraftFactory.quarryBlock, diamondGearAchievement).registerStat();
|
||||
fasterFillingAchievement = new Achievement("achievement.fasterFilling", "fasterFillingAchievement", 7, 2, BuildCraftBuilders.fillerBlock, goldGearAchievement).registerStat();
|
||||
timeForSomeLogicAchievement = new Achievement("achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, BuildCraftSilicon.assemblyTableBlock, diamondGearAchievement).registerStat();
|
||||
refineAndRedefineAchievement = new Achievement("achievement.refineAndRedefine", "refineAndRedefineAchievement", 10, 0, BuildCraftFactory.refineryBlock, diamondGearAchievement).registerStat();
|
||||
tinglyLaserAchievement = new Achievement("achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, BuildCraftSilicon.laserBlock ,timeForSomeLogicAchievement).registerStat();
|
||||
|
||||
BuildcraftAchievements = new AchievementPage("Buildcraft", woodenGearAchievement, stoneGearAchievement, ironGearAchievement, goldGearAchievement, diamondGearAchievement, wrenchAchievement, aLotOfCraftingAchievement, straightDownAchievement, chunkDestroyerAchievement, fasterFillingAchievement, timeForSomeLogicAchievement, refineAndRedefineAchievement, tinglyLaserAchievement);
|
||||
AchievementPage.registerAchievementPage(BuildcraftAchievements);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,8 +43,9 @@ public class BlockFiller extends BlockContainer {
|
|||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
|
||||
|
||||
// Drop through if the player is sneaking
|
||||
if (entityplayer.isSneaking())
|
||||
if (entityplayer.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
|
||||
|
@ -61,14 +62,16 @@ public class BlockFiller extends BlockContainer {
|
|||
if (tile != null && tile instanceof TileFiller) {
|
||||
TileFiller filler = (TileFiller) tile;
|
||||
if (side == 1 || side == 0) {
|
||||
if (!filler.isActive())
|
||||
if (!filler.isActive()) {
|
||||
return textureTopOff;
|
||||
else
|
||||
} else {
|
||||
return textureTopOn;
|
||||
} else if (filler.currentPattern != null)
|
||||
}
|
||||
} else if (filler.currentPattern != null) {
|
||||
return filler.currentPattern.getIcon();
|
||||
else
|
||||
} else {
|
||||
return textureSides;
|
||||
}
|
||||
}
|
||||
|
||||
return getIcon(side, m);
|
||||
|
@ -76,10 +79,11 @@ public class BlockFiller extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public IIcon getIcon(int i, int j) {
|
||||
if (i == 0 || i == 1)
|
||||
if (i == 0 || i == 1) {
|
||||
return textureTopOn;
|
||||
else
|
||||
} else {
|
||||
return textureSides;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
57
common/buildcraft/core/utils/CraftingHandler.java
Normal file
57
common/buildcraft/core/utils/CraftingHandler.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package buildcraft.core.utils;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
|
||||
public class CraftingHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCrafing(PlayerEvent.ItemCraftedEvent Event){
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.woodenGearItem)){
|
||||
Event.player.addStat(BuildCraftCore.woodenGearAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.stoneGearItem)){
|
||||
Event.player.addStat(BuildCraftCore.stoneGearAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.ironGearItem)){
|
||||
Event.player.addStat(BuildCraftCore.ironGearAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.goldGearItem)){
|
||||
Event.player.addStat(BuildCraftCore.goldGearAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.diamondGearItem)){
|
||||
Event.player.addStat(BuildCraftCore.diamondGearAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(BuildCraftCore.wrenchItem)){
|
||||
Event.player.addStat(BuildCraftCore.wrenchAchievement, 1);
|
||||
}
|
||||
if(Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftFactory.autoWorkbenchBlock))){
|
||||
Event.player.addStat(BuildCraftCore.aLotOfCraftingAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftFactory.miningWellBlock))){
|
||||
Event.player.addStat(BuildCraftCore.straightDownAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftFactory.quarryBlock))){
|
||||
Event.player.addStat(BuildCraftCore.chunkDestroyerAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftFactory.refineryBlock))){
|
||||
Event.player.addStat(BuildCraftCore.refineAndRedefineAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftBuilders.fillerBlock))){
|
||||
Event.player.addStat(BuildCraftCore.fasterFillingAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftSilicon.laserBlock))){
|
||||
Event.player.addStat(BuildCraftCore.tinglyLaserAchievement, 1);
|
||||
}
|
||||
if (Event.crafting.getItem().equals(Item.getItemFromBlock(BuildCraftSilicon.assemblyTableBlock))){
|
||||
Event.player.addStat(BuildCraftCore.timeForSomeLogicAchievement, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -34,10 +34,11 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
|
|||
|
||||
@Override
|
||||
public IIcon getIcon(int i, int j) {
|
||||
if (i == 1 || i == 0)
|
||||
if (i == 1 || i == 0) {
|
||||
return topTexture;
|
||||
else
|
||||
} else {
|
||||
return sideTexture;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,12 +46,14 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
|
|||
super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9);
|
||||
|
||||
// Drop through if the player is sneaking
|
||||
if (entityplayer.isSneaking())
|
||||
if (entityplayer.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityplayer.getCurrentEquippedItem() != null) {
|
||||
if (entityplayer.getCurrentEquippedItem().getItem() instanceof IItemPipe)
|
||||
if (entityplayer.getCurrentEquippedItem().getItem() instanceof IItemPipe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
|
|
|
@ -40,25 +40,26 @@ public class BlockMiningWell extends BlockBuildCraft {
|
|||
|
||||
@Override
|
||||
public IIcon getIcon(int i, int j) {
|
||||
if (j == 0 && i == 3)
|
||||
if (j == 0 && i == 3) {
|
||||
return textureFront;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
if (i == 1) {
|
||||
return textureTop;
|
||||
else if (i == 0)
|
||||
} else if (i == 0) {
|
||||
return textureBack;
|
||||
else if (i == j)
|
||||
} else if (i == j) {
|
||||
return textureFront;
|
||||
else if (j >= 0 && j < 6 && ForgeDirection.values()[j].getOpposite().ordinal() == i)
|
||||
} else if (j >= 0 && j < 6 && ForgeDirection.values()[j].getOpposite().ordinal() == i) {
|
||||
return textureBack;
|
||||
else
|
||||
} else {
|
||||
return textureSides;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
|
||||
ForgeDirection orientation = Utils.get2dOrientation(entityliving);
|
||||
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(),1);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,13 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
@Override
|
||||
public IIcon getIcon(int i, int j) {
|
||||
// If no metadata is set, then this is an icon.
|
||||
if (j == 0 && i == 3)
|
||||
if (j == 0 && i == 3) {
|
||||
return textureFront;
|
||||
}
|
||||
|
||||
if (i == j && i > 1) // Front can't be top or bottom.
|
||||
if (i == j && i > 1) {
|
||||
return textureFront;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
|
@ -82,13 +84,15 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
|
||||
public void searchFrames(World world, int i, int j, int k) {
|
||||
int width2 = 1;
|
||||
if (!world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2))
|
||||
if (!world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(i, j, k);
|
||||
|
||||
if (block != BuildCraftFactory.frameBlock)
|
||||
if (block != BuildCraftFactory.frameBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
|
@ -180,8 +184,9 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
TileQuarry tile = (TileQuarry) world.getTileEntity(i, j, k);
|
||||
|
||||
// Drop through if the player is sneaking
|
||||
if (entityplayer.isSneaking())
|
||||
if (entityplayer.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Restart the quarry if its a wrench
|
||||
Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
|
||||
|
|
|
@ -57,8 +57,9 @@ public class BlockLaserTable extends BlockContainer {
|
|||
@Override
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
|
||||
// Drop through if the player is sneaking
|
||||
if (entityplayer.isSneaking())
|
||||
if (entityplayer.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
|
|
@ -55,6 +55,7 @@ import buildcraft.core.utils.Utils;
|
|||
import buildcraft.transport.gates.GateDefinition;
|
||||
import buildcraft.transport.gates.GateFactory;
|
||||
import buildcraft.transport.gates.ItemGate;
|
||||
import buildcraft.transport.utils.FacadeMatrix;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -636,16 +637,27 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
if (rayTraceResult != null && rayTraceResult.boundingBox != null) {
|
||||
switch (rayTraceResult.hitPart) {
|
||||
case Gate:
|
||||
case Gate:
|
||||
Pipe pipe = getPipe(world, x, y, z);
|
||||
return pipe.gate.getGateItem();
|
||||
case Plug:
|
||||
case Plug:
|
||||
return new ItemStack(BuildCraftTransport.plugItem);
|
||||
case RobotStation:
|
||||
return new ItemStack(BuildCraftTransport.robotStationItem);
|
||||
case RobotStation:
|
||||
return new ItemStack(BuildCraftTransport.robotStationItem);
|
||||
case Pipe:
|
||||
return new ItemStack(getPipe(world, x, y, z).item);
|
||||
case Facade:
|
||||
ForgeDirection dir = ForgeDirection
|
||||
.getOrientation(target.sideHit);
|
||||
FacadeMatrix matrix = getPipe(world, x, y, z).container.renderState.facadeMatrix;
|
||||
Block block = matrix.getFacadeBlock(dir);
|
||||
if (block != null) {
|
||||
return ItemFacade.getStack(block,
|
||||
matrix.getFacadeMetaId(dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getPickBlock(target, world, x, y, z);
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Wrappers ************************************************************ */
|
||||
|
@ -1176,7 +1188,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
* the particles. Useful when you have entirely different texture sheets for
|
||||
* different sides/locations in the world.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param worldObj The current world
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param effectRenderer A reference to the current effect renderer.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
|
@ -1239,7 +1251,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
* your block. So be sure to do proper sanity checks before assuming that
|
||||
* the location is this block.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param worldObj The current world
|
||||
* @param x X position to spawn the particle
|
||||
* @param y Y position to spawn the particle
|
||||
* @param z Z position to spawn the particle
|
||||
|
|
Loading…
Reference in a new issue