This commit is contained in:
Adrian 2015-06-14 09:12:47 +02:00
parent cc6fc2324c
commit 4e89f290a4
5 changed files with 21 additions and 19 deletions

View file

@ -134,7 +134,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
CoreProxy.proxy.registerTileEntity(TilePackager.class, "buildcraft.TilePackager"); CoreProxy.proxy.registerTileEntity(TilePackager.class, "buildcraft.TilePackager");
CoreProxy.proxy.registerTileEntity(TileStampingTable.class, "buildcraft.TileStampingTable"); CoreProxy.proxy.registerTileEntity(TileStampingTable.class, "buildcraft.TileStampingTable");
BuilderAPI.schematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[] {2, 5, 3, 4}, true); BuilderAPI.schematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
timeForSomeLogicAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, assemblyTableBlock, BuildCraftCore.diamondGearAchievement)); timeForSomeLogicAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, assemblyTableBlock, BuildCraftCore.diamondGearAchievement));
tinglyLaserAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, laserBlock, timeForSomeLogicAchievement)); tinglyLaserAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, laserBlock, timeForSomeLogicAchievement));
@ -253,7 +253,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:diamondChipset", Math.round(800000 * chipsetCostMultiplier), BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:diamondChipset", Math.round(800000 * chipsetCostMultiplier),
Chipset.DIAMOND.getStack(), "dustRedstone", "gemDiamond"); Chipset.DIAMOND.getStack(), "dustRedstone", "gemDiamond");
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:emeraldChipset", Math.round(1200000 * chipsetCostMultiplier), BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:emeraldChipset", Math.round(1200000 * chipsetCostMultiplier),
Chipset.EMERALD.getStack(), "dustRedstone", "gemEmerald"); Chipset.EMERALD.getStack(), "dustRedstone", "gemEmerald");
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:pulsatingChipset", Math.round(400000 * chipsetCostMultiplier), BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:pulsatingChipset", Math.round(400000 * chipsetCostMultiplier),
Chipset.PULSATING.getStack(2), "dustRedstone", Items.ender_pearl); Chipset.PULSATING.getStack(2), "dustRedstone", Items.ender_pearl);
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:quartzChipset", Math.round(600000 * chipsetCostMultiplier), Chipset.QUARTZ.getStack(), BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:quartzChipset", Math.round(600000 * chipsetCostMultiplier), Chipset.QUARTZ.getStack(),
@ -268,7 +268,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
} }
@Mod.EventHandler @Mod.EventHandler
public void processRequests(FMLInterModComms.IMCEvent event) { public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(event); InterModComms.processIMC(event);
} }

View file

@ -20,16 +20,7 @@ public final class ThreadSafeUtils {
} }
/** private static Chunk getChunkHacky(World world, int x, int z) {
* This function will NOT load a chunk - it will only get one.
* Chunk loading is not fully threadsafe. Therefore, this function is
* also useful for faster chunk lookups.
* @param world
* @param x
* @param z
* @return
*/
public static Chunk getChunk(World world, int x, int z) {
Chunk chunk; Chunk chunk;
chunk = lastChunk.get(); chunk = lastChunk.get();
@ -45,7 +36,8 @@ public final class ThreadSafeUtils {
IChunkProvider provider = world.getChunkProvider(); IChunkProvider provider = world.getChunkProvider();
// These probably won't guarantee full thread safety, but it's our best bets. // These probably won't guarantee full thread safety, but it's our best bets.
if (provider instanceof ChunkProviderServer) { if (!Utils.CAULDRON_DETECTED && provider instanceof ChunkProviderServer) {
// Slight optimization
chunk = (Chunk) ((ChunkProviderServer) provider).loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(x, z)); chunk = (Chunk) ((ChunkProviderServer) provider).loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(x, z));
} else { } else {
chunk = provider.chunkExists(x, z) ? provider.provideChunk(x, z) : null; chunk = provider.chunkExists(x, z) ? provider.provideChunk(x, z) : null;

View file

@ -622,8 +622,12 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable
} }
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player); RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player);
ForgeDirection hitSide = rayTraceResult.hitPart == Part.Pipe ? rayTraceResult.sideHit : ForgeDirection.UNKNOWN; if (rayTraceResult != null) {
return pipe.blockActivated(player, hitSide); ForgeDirection hitSide = rayTraceResult.hitPart == Part.Pipe ? rayTraceResult.sideHit : ForgeDirection.UNKNOWN;
return pipe.blockActivated(player, hitSide);
} else {
return false;
}
} else if (currentItem.getItem() instanceof IMapLocation) { } else if (currentItem.getItem() instanceof IMapLocation) {
// We want to be able to record pipe locations // We want to be able to record pipe locations
return false; return false;
@ -671,8 +675,10 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable
return true; return true;
} }
ForgeDirection hitSide = rayTraceResult.hitPart == Part.Pipe ? rayTraceResult.sideHit : ForgeDirection.UNKNOWN; if (rayTraceResult != null) {
return pipe.blockActivated(player, hitSide); ForgeDirection hitSide = rayTraceResult.hitPart == Part.Pipe ? rayTraceResult.sideHit : ForgeDirection.UNKNOWN;
return pipe.blockActivated(player, hitSide);
}
} }
} }

View file

@ -44,6 +44,7 @@ import buildcraft.transport.utils.TransportUtils;
public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnergyHandler, IStripesPipe { public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnergyHandler, IStripesPipe {
private ForgeDirection actionDir = ForgeDirection.UNKNOWN; private ForgeDirection actionDir = ForgeDirection.UNKNOWN;
private float currentSpeed;
public PipeItemsStripes(Item item) { public PipeItemsStripes(Item item) {
super(new PipeTransportItems(), item); super(new PipeTransportItems(), item);
@ -67,6 +68,7 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
if (direction == ForgeDirection.UNKNOWN) { if (direction == ForgeDirection.UNKNOWN) {
direction = event.direction; direction = event.direction;
} }
currentSpeed = event.item.getSpeed();
Position p = new Position(container.xCoord, container.yCoord, Position p = new Position(container.xCoord, container.yCoord,
container.zCoord, direction); container.zCoord, direction);
@ -162,6 +164,8 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
pos.moveBackwards(0.25D); pos.moveBackwards(0.25D);
TravelingItem newItem = TravelingItem.make(pos.x, pos.y, pos.z, itemStack); TravelingItem newItem = TravelingItem.make(pos.x, pos.y, pos.z, itemStack);
newItem.setSpeed(Math.min(0.01F, currentSpeed - 0.005F));
transport.injectItem(newItem, direction); transport.injectItem(newItem, direction);
} }

View file

@ -44,7 +44,7 @@ public class StripesHandlerPlaceBlock implements IStripesHandler {
if (stack.stackSize > 0) { if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite()); activator.sendItem(stack, direction.getOpposite());
} }
return true; return true;
} }
} }