-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
205 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
common/src/main/java/juuxel/adorn/client/ClientNetworkBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package juuxel.adorn.client; | ||
|
||
import juuxel.adorn.util.InlineServices; | ||
import juuxel.adorn.util.Services; | ||
import net.minecraft.item.ItemStack; | ||
|
||
@InlineServices | ||
public interface ClientNetworkBridge { | ||
void sendSetTradeStack(int syncId, int slotId, ItemStack stack); | ||
|
||
@InlineServices.Getter | ||
static ClientNetworkBridge get() { | ||
return Services.load(ClientNetworkBridge.class); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
common/src/main/java/juuxel/adorn/client/FluidRenderingBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package juuxel.adorn.client; | ||
|
||
import juuxel.adorn.fluid.FluidReference; | ||
import juuxel.adorn.util.InlineServices; | ||
import juuxel.adorn.util.Services; | ||
import net.minecraft.client.item.TooltipContext; | ||
import net.minecraft.client.texture.Sprite; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.BlockRenderView; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
@InlineServices | ||
public interface FluidRenderingBridge { | ||
@Nullable Sprite getStillSprite(FluidReference volume); | ||
|
||
int getColor(FluidReference volume, @Nullable BlockRenderView world, @Nullable BlockPos pos); | ||
|
||
default int getColor(FluidReference volume) { | ||
return getColor(volume, null, null); | ||
} | ||
|
||
boolean fillsFromTop(FluidReference volume); | ||
|
||
List<Text> getTooltip(FluidReference volume, TooltipContext context, @Nullable Integer maxAmountInLitres); | ||
|
||
@InlineServices.Getter | ||
static FluidRenderingBridge get() { | ||
return Services.load(FluidRenderingBridge.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
common/src/main/java/juuxel/adorn/platform/BlockEntityBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.block.entity.BrewerBlockEntity; | ||
import juuxel.adorn.block.entity.KitchenSinkBlockEntity; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
public interface BlockEntityBridge { | ||
BrewerBlockEntity createBrewer(BlockPos pos, BlockState state); | ||
KitchenSinkBlockEntity createKitchenSink(BlockPos pos, BlockState state); | ||
} |
12 changes: 12 additions & 0 deletions
12
common/src/main/java/juuxel/adorn/platform/BlockFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.block.SofaBlock; | ||
import juuxel.adorn.block.variant.BlockVariant; | ||
|
||
public interface BlockFactory { | ||
BlockFactory DEFAULT = new BlockFactory() {}; | ||
|
||
default SofaBlock createSofa(BlockVariant variant) { | ||
return new SofaBlock(variant); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.entity.SeatEntity; | ||
import net.minecraft.entity.EntityType; | ||
|
||
public interface EntityBridge { | ||
EntityType<SeatEntity> createSeatType(); | ||
} |
25 changes: 25 additions & 0 deletions
25
common/src/main/java/juuxel/adorn/platform/FluidBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.fluid.FluidAmountPredicate; | ||
import juuxel.adorn.fluid.FluidUnit; | ||
import juuxel.adorn.fluid.FluidVolume; | ||
import juuxel.adorn.util.InlineServices; | ||
import juuxel.adorn.util.Services; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.fluid.Fluid; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@InlineServices | ||
public interface FluidBridge { | ||
FluidUnit getFluidUnit(); | ||
|
||
@Nullable FluidVolume drain(World world, BlockPos pos, @Nullable BlockState state, Direction side, Fluid fluid, FluidAmountPredicate amountPredicate); | ||
|
||
@InlineServices.Getter | ||
static FluidBridge get() { | ||
return Services.load(FluidBridge.class); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
common/src/main/java/juuxel/adorn/platform/MenuBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.entity.player.PlayerInventory; | ||
import net.minecraft.menu.Menu; | ||
import net.minecraft.menu.MenuType; | ||
import net.minecraft.menu.NamedMenuFactory; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.util.math.BlockPos; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface MenuBridge { | ||
/** | ||
* Opens a menu with a pos with the opening NBT sent to the client. | ||
* Does nothing on the client. | ||
*/ | ||
void open(PlayerEntity player, @Nullable NamedMenuFactory factory, BlockPos pos); | ||
|
||
<M extends Menu> MenuType<M> createType(Factory<M> factory); | ||
|
||
@FunctionalInterface | ||
interface Factory<M extends Menu> { | ||
M create(int syncId, PlayerInventory inventory, PacketByteBuf buf); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
common/src/main/java/juuxel/adorn/platform/NetworkBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.fluid.FluidReference; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.packet.Packet; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.Identifier; | ||
|
||
public interface NetworkBridge { | ||
void sendToTracking(Entity entity, Packet<?> packet); | ||
void sendOpenBookPacket(PlayerEntity player, Identifier bookId); | ||
void sendBrewerFluidSync(PlayerEntity player, int syncId, FluidReference fluid); | ||
|
||
default void syncBlockEntity(BlockEntity be) { | ||
if (!(be.getWorld() instanceof ServerWorld world)) { | ||
throw new IllegalStateException("[Adorn] Block entities cannot be synced client->server"); | ||
} | ||
world.getChunkManager().markForUpdate(be.getPos()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
common/src/main/java/juuxel/adorn/platform/PlatformBridges.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.util.InlineServices; | ||
import juuxel.adorn.util.Services; | ||
|
||
@InlineServices | ||
public interface PlatformBridges { | ||
BlockEntityBridge getBlockEntities(); | ||
BlockFactory getBlockFactory(); | ||
EntityBridge getEntities(); | ||
MenuBridge getMenus(); | ||
NetworkBridge getNetwork(); | ||
ResourceBridge getResources(); | ||
|
||
@InlineServices.Getter | ||
static PlatformBridges get() { | ||
return Services.load(PlatformBridges.class); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
common/src/main/java/juuxel/adorn/platform/ResourceBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package juuxel.adorn.platform; | ||
|
||
import juuxel.adorn.client.book.BookManager; | ||
import juuxel.adorn.client.resources.ColorManager; | ||
|
||
public interface ResourceBridge { | ||
BookManager getBookManager(); | ||
ColorManager getColorManager(); | ||
} |
17 changes: 0 additions & 17 deletions
17
common/src/main/kotlin/juuxel/adorn/client/ClientNetworkBridge.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
common/src/main/kotlin/juuxel/adorn/client/ClientPlatformBridges.kt
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
common/src/main/kotlin/juuxel/adorn/client/FluidRenderingBridge.kt
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
common/src/main/kotlin/juuxel/adorn/platform/BlockEntityBridge.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.