1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00

Backwards compat patch for Plethora

Ughghgghghr.
This commit is contained in:
SquidDev 2019-01-20 16:16:02 +00:00
parent 83b01d35eb
commit 1f498dcc73
6 changed files with 28 additions and 5 deletions

View File

@ -229,6 +229,14 @@ public static class PocketUpgrades
public static PocketModem wirelessModem;
public static PocketModem advancedModem;
public static PocketSpeaker speaker;
@Deprecated
public static PocketSpeaker pocketSpeaker;
}
@Deprecated
public static class Upgrades {
public static TurtleModem advancedModem;
}
// Registries

View File

@ -200,6 +200,7 @@ public static void registerItems( RegistryEvent.Register<Item> event )
registerTurtleUpgrades();
registerPocketUpgrades();
registerLegacyUpgrades();
}
@SubscribeEvent
@ -336,6 +337,13 @@ public static void registerPocketUpgrades()
ComputerCraftAPI.registerPocketUpgrade( ComputerCraft.PocketUpgrades.speaker );
}
@SuppressWarnings( "deprecation" )
private static void registerLegacyUpgrades()
{
ComputerCraft.PocketUpgrades.pocketSpeaker = ComputerCraft.PocketUpgrades.speaker;
ComputerCraft.Upgrades.advancedModem = ComputerCraft.TurtleUpgrades.advancedModem;
}
@SubscribeEvent
public static void remapItems( RegistryEvent.MissingMappings<Item> mappings )
{

View File

@ -16,6 +16,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -39,7 +40,13 @@ public void update()
public abstract World getWorld();
public abstract Vec3d getPos();
public abstract Vec3d getPosition();
@Deprecated
public BlockPos getPos()
{
return new BlockPos( getPosition() );
}
public boolean madeSound( long ticks )
{
@ -125,7 +132,7 @@ private synchronized boolean playSound( ILuaContext context, String name, float
}
World world = getWorld();
Vec3d pos = getPos();
Vec3d pos = getPosition();
context.issueMainThreadTask( () -> {
MinecraftServer server = world.getMinecraftServer();

View File

@ -59,7 +59,7 @@ public World getWorld()
}
@Override
public Vec3d getPos()
public Vec3d getPosition()
{
BlockPos pos = speaker.getPos();
return new Vec3d( pos.getX(), pos.getY(), pos.getZ() );

View File

@ -29,7 +29,7 @@ public World getWorld()
}
@Override
public Vec3d getPos()
public Vec3d getPosition()
{
return world != null ? position : null;
}

View File

@ -48,7 +48,7 @@ public World getWorld()
}
@Override
public Vec3d getPos()
public Vec3d getPosition()
{
BlockPos pos = turtle.getPosition();
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );