1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-28 15:08:47 +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 class ComputerCraft
public static PocketModem wirelessModem; public static PocketModem wirelessModem;
public static PocketModem advancedModem; public static PocketModem advancedModem;
public static PocketSpeaker speaker; public static PocketSpeaker speaker;
@Deprecated
public static PocketSpeaker pocketSpeaker;
}
@Deprecated
public static class Upgrades {
public static TurtleModem advancedModem;
} }
// Registries // Registries

View File

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

View File

@ -16,6 +16,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -39,7 +40,13 @@ public abstract class SpeakerPeripheral implements IPeripheral
public abstract World getWorld(); 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 ) public boolean madeSound( long ticks )
{ {
@ -125,7 +132,7 @@ public abstract class SpeakerPeripheral implements IPeripheral
} }
World world = getWorld(); World world = getWorld();
Vec3d pos = getPos(); Vec3d pos = getPosition();
context.issueMainThreadTask( () -> { context.issueMainThreadTask( () -> {
MinecraftServer server = world.getMinecraftServer(); MinecraftServer server = world.getMinecraftServer();

View File

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

View File

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

View File

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