-
Notifications
You must be signed in to change notification settings - Fork 33
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
14 changed files
with
158 additions
and
84 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package space.essem.image2map; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.MapCodec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.util.math.Direction; | ||
|
||
import java.util.Optional; | ||
|
||
public record ImageData(int x, int y, int width, int height, boolean quickPlace, Optional<Direction> right, Optional<Direction> down, Optional<Direction> facing) { | ||
public static final MapCodec<ImageData> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( | ||
Codec.INT.optionalFieldOf("image2map:x", 0).forGetter(ImageData::x), | ||
Codec.INT.optionalFieldOf("image2map:y", 0).forGetter(ImageData::y), | ||
Codec.INT.optionalFieldOf("image2map:width", 0).forGetter(ImageData::width), | ||
Codec.INT.optionalFieldOf("image2map:height", 0).forGetter(ImageData::width), | ||
Codec.BOOL.optionalFieldOf("image2map:quick_place", false).forGetter(ImageData::quickPlace), | ||
Direction.CODEC.optionalFieldOf("image2map:right").forGetter(ImageData::right), | ||
Direction.CODEC.optionalFieldOf("image2map:down").forGetter(ImageData::down), | ||
Direction.CODEC.optionalFieldOf("image2map:facing").forGetter(ImageData::facing) | ||
).apply(instance, ImageData::new)); | ||
|
||
public static ImageData ofSimple(int x, int y, int width, int height) { | ||
return new ImageData(x, y ,width, height, false, Optional.empty(), Optional.empty(), Optional.empty()); | ||
} | ||
|
||
public ImageData withDirection(Direction right, Direction down, Direction facing) { | ||
return new ImageData(x, y, width, height, quickPlace, Optional.of(right), Optional.of(down), Optional.of(facing)); | ||
} | ||
|
||
public static ImageData ofBundle(int width, int height) { | ||
return new ImageData(0, 0, width, height, true, Optional.empty(), Optional.empty(), Optional.empty()); | ||
} | ||
|
||
public boolean isReal() { | ||
return this.width != 0 && this.height != 0; | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/space/essem/image2map/mixin/EntityPassengersSetS2CPacketAccessor.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,14 @@ | ||
package space.essem.image2map.mixin; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(EntityPassengersSetS2CPacket.class) | ||
public interface EntityPassengersSetS2CPacketAccessor { | ||
@Invoker("<init>") | ||
static EntityPassengersSetS2CPacket createEntityPassengersSetS2CPacket(PacketByteBuf buf) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
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
Oops, something went wrong.