Added Sky Stone Tracking.
Added Meteorite Compass Block / Item. Added Meteorite Spawner Debug Item. Some Refactoring.
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ import appeng.core.crash.CrashInfo;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.helpers.TickHandler;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationSide;
|
||||
import appeng.server.AECommand;
|
||||
|
||||
@@ -36,6 +36,7 @@ import appeng.block.misc.BlockInterface;
|
||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.block.misc.BlockSecurity;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.block.misc.BlockVibrationChamber;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
@@ -78,11 +79,11 @@ import appeng.core.localization.PlayerMessages;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.ToolDebugCard;
|
||||
import appeng.debug.ToolMeteoritePlacer;
|
||||
import appeng.debug.ToolReplicatorCard;
|
||||
import appeng.helpers.AETrading;
|
||||
import appeng.helpers.PartPlacement;
|
||||
import appeng.helpers.QuartzWorldGen;
|
||||
import appeng.helpers.TickHandler;
|
||||
import appeng.hooks.AETrading;
|
||||
import appeng.hooks.QuartzWorldGen;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.materials.ItemMaterial;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.items.misc.ItemCrystalSeed;
|
||||
@@ -115,6 +116,7 @@ import appeng.me.cache.SecurityCache;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.me.storage.AEExternalHandler;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.recipes.AEItemResolver;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.Recipes.ShapedRecipe;
|
||||
@@ -249,6 +251,7 @@ public class Registration
|
||||
blocks.blockFluix = addFeature( BlockFluix.class );
|
||||
blocks.blockSkyStone = addFeature( BlockSkyStone.class );
|
||||
blocks.blockSkyChest = addFeature( BlockSkyChest.class );
|
||||
blocks.blockSkyCompass = addFeature( BlockSkyCompass.class );
|
||||
|
||||
blocks.blockQuartzGlass = addFeature( BlockQuartzGlass.class );
|
||||
blocks.blockQuartzVibrantGlass = addFeature( BlockQuartzLamp.class );
|
||||
@@ -340,6 +343,7 @@ public class Registration
|
||||
items.itemFacade = addFeature( ItemFacade.class );
|
||||
items.itemCrystalSeed = addFeature( ItemCrystalSeed.class );
|
||||
|
||||
addFeature( ToolMeteoritePlacer.class );
|
||||
addFeature( ToolDebugCard.class );
|
||||
addFeature( ToolReplicatorCard.class );
|
||||
addFeature( BlockItemGen.class );
|
||||
|
||||
+25
-3
@@ -13,6 +13,7 @@ import net.minecraftforge.common.config.Property;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.me.GridStorage;
|
||||
import appeng.me.GridStorageSearch;
|
||||
import appeng.services.CompassService;
|
||||
|
||||
public class WorldSettings extends Configuration
|
||||
{
|
||||
@@ -22,8 +23,17 @@ public class WorldSettings extends Configuration
|
||||
long lastGridStorage = 0;
|
||||
int lastPlayer = 0;
|
||||
|
||||
public WorldSettings(File f) {
|
||||
super( f );
|
||||
private CompassService compass;
|
||||
|
||||
File AEFolder;
|
||||
|
||||
public WorldSettings(File aeFolder) {
|
||||
super( new File( aeFolder.getPath() + File.separatorChar + "settings.cfg" ) );
|
||||
AEFolder = aeFolder;
|
||||
|
||||
compass = new CompassService( AEFolder );
|
||||
(new Thread( compass, "AE Compass Service" )).start();
|
||||
|
||||
try
|
||||
{
|
||||
lastGridStorage = Long.parseLong( get( "Counters", "lastGridStorage", 0 ).getString() );
|
||||
@@ -36,11 +46,21 @@ public class WorldSettings extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
public CompassService getCompass()
|
||||
{
|
||||
return compass;
|
||||
}
|
||||
|
||||
public static WorldSettings getInstance()
|
||||
{
|
||||
if ( instance == null )
|
||||
{
|
||||
File f = DimensionManager.getWorld( 0 ).getSaveHandler().getMapFileFromName( "AppEng" );
|
||||
File world = DimensionManager.getWorld( 0 ).getSaveHandler().getWorldDirectory();
|
||||
File f = new File( world.getPath() + File.separatorChar + "AE2" );
|
||||
|
||||
if ( !f.exists() || !f.isDirectory() )
|
||||
f.mkdir();
|
||||
|
||||
instance = new WorldSettings( f );
|
||||
}
|
||||
|
||||
@@ -60,6 +80,7 @@ public class WorldSettings extends Configuration
|
||||
public void shutdown()
|
||||
{
|
||||
save();
|
||||
compass.kill();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
@@ -181,4 +202,5 @@ public class WorldSettings extends Configuration
|
||||
return prop.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ import appeng.api.parts.LayerBase;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.PartPlacement;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.core.sync.packets.PacketCompassRequest;
|
||||
import appeng.core.sync.packets.PacketCompassResponse;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketLightning;
|
||||
@@ -28,6 +30,10 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
public enum PacketTypes
|
||||
{
|
||||
PACKET_COMPASS_REQUEST(PacketCompassRequest.class),
|
||||
|
||||
PACKET_COMPASS_RESPONSE(PacketCompassResponse.class),
|
||||
|
||||
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
|
||||
|
||||
PACKET_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.services.helpers.ICompassCallback;
|
||||
|
||||
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
|
||||
{
|
||||
|
||||
final public long attunement;
|
||||
final public int cx, cz, cdy;
|
||||
|
||||
EntityPlayer talkBackTo;
|
||||
|
||||
// automatic.
|
||||
public PacketCompassRequest(ByteBuf stream) throws IOException {
|
||||
attunement = stream.readLong();
|
||||
cx = stream.readInt();
|
||||
cz = stream.readInt();
|
||||
cdy = stream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculatedDirection(boolean hasResult, boolean spin, double radians)
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) talkBackTo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
AELog.info( "PacketCompassRequest.serverPacketData" );
|
||||
talkBackTo = player;
|
||||
|
||||
DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( loc, this );
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketCompassRequest(long attunement, int cx, int cz, int cdy) throws IOException {
|
||||
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( getPacketID() );
|
||||
data.writeLong( this.attunement = attunement );
|
||||
data.writeInt( this.cx = cx );
|
||||
data.writeInt( this.cz = cz );
|
||||
data.writeInt( this.cdy = cdy );
|
||||
|
||||
configureWrite( data );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.hooks.CompassManager;
|
||||
import appeng.hooks.CompassResult;
|
||||
|
||||
public class PacketCompassResponse extends AppEngPacket
|
||||
{
|
||||
|
||||
final public long attunement;
|
||||
final public int cx, cz, cdy;
|
||||
|
||||
public CompassResult cr;
|
||||
|
||||
// automatic.
|
||||
public PacketCompassResponse(ByteBuf stream) throws IOException {
|
||||
attunement = stream.readLong();
|
||||
cx = stream.readInt();
|
||||
cz = stream.readInt();
|
||||
cdy = stream.readInt();
|
||||
|
||||
cr = new CompassResult( stream.readBoolean(), stream.readBoolean(), stream.readDouble() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
AELog.info( "PacketCompassResponse.clientPacketData" );
|
||||
CompassManager.instance.postResult( attunement, cx << 4, cdy << 5, cz << 4, cr );
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketCompassResponse(PacketCompassRequest req, boolean hasResult, boolean spin, double radians) {
|
||||
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( getPacketID() );
|
||||
data.writeLong( this.attunement = req.attunement );
|
||||
data.writeInt( this.cx = req.cx );
|
||||
data.writeInt( this.cz = req.cz );
|
||||
data.writeInt( this.cdy = req.cdy );
|
||||
|
||||
data.writeBoolean( hasResult );
|
||||
data.writeBoolean( spin );
|
||||
data.writeDouble( radians );
|
||||
|
||||
configureWrite( data );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.PartPlacement;
|
||||
import appeng.parts.PartPlacement;
|
||||
|
||||
public class PacketPartPlacement extends AppEngPacket
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user