fixed bugs and added new compat port io textures
@@ -21,7 +21,7 @@ apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
version = '1.16.5-0.1.47-B' + getVersionNumber()
|
||||
version = '1.16.5-0.1.48-B' + getVersionNumber()
|
||||
group = 'com.ticticboooom.mods.mm' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'MasterfulMachinery'
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.ticticboooom.mods.mm.block;
|
||||
|
||||
import com.ticticboooom.mods.mm.block.tile.MachinePortBlockEntity;
|
||||
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
|
||||
import com.ticticboooom.mods.mm.ports.storage.StarlightPortStorage;
|
||||
import hellfirepvp.astralsorcery.common.block.base.BlockStarlightRecipient;
|
||||
import hellfirepvp.astralsorcery.common.constellation.IWeakConstellation;
|
||||
import hellfirepvp.astralsorcery.common.starlight.network.StarlightNetworkRegistry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class AstralMachinePortBlock extends MachinePortBlock implements BlockStarlightRecipient {
|
||||
public AstralMachinePortBlock(RegistryObject<TileEntityType<?>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) {
|
||||
super(type, name, controllerId, textureOverride, overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveStarlight(World world, Random random, BlockPos blockPos, IWeakConstellation iWeakConstellation, double v) {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof MachinePortBlockEntity){
|
||||
PortStorage storage = ((MachinePortBlockEntity) tile).getStorage();
|
||||
if (!((MachinePortBlockEntity) tile).isInput()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (storage instanceof StarlightPortStorage) {
|
||||
StarlightPortStorage starlightStorage = (StarlightPortStorage) storage;
|
||||
int rec = new Double(v).intValue();
|
||||
starlightStorage.getInv().receiveStarlight(rec, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.ticticboooom.mods.mm.block.tile;
|
||||
|
||||
import com.ticticboooom.mods.mm.block.container.PortBlockContainer;
|
||||
import com.ticticboooom.mods.mm.inventory.as.MMSimpleTransmissionReceiver;
|
||||
import com.ticticboooom.mods.mm.network.PacketHandler;
|
||||
import com.ticticboooom.mods.mm.network.packets.TileClientUpdatePacket;
|
||||
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
|
||||
import hellfirepvp.astralsorcery.common.constellation.ConstellationTile;
|
||||
import hellfirepvp.astralsorcery.common.constellation.IMinorConstellation;
|
||||
import hellfirepvp.astralsorcery.common.constellation.IWeakConstellation;
|
||||
import hellfirepvp.astralsorcery.common.tile.base.network.TileReceiverBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.network.PacketDistributor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AstralMachineInputPortBlockEntity extends TileReceiverBase<MMSimpleTransmissionReceiver> implements IMachinePortTile {
|
||||
public AstralMachineInputPortBlockEntity(TileEntityType<?> tileEntityTypeIn, ContainerType<?> cont, PortStorage storage) {
|
||||
super(tileEntityTypeIn);
|
||||
this.cont = cont;
|
||||
this.storage = storage;
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote()) {
|
||||
PacketHandler.INSTANCE.send(PacketDistributor.ALL.noArg(), new TileClientUpdatePacket.Data(pos, write(new CompoundNBT())));
|
||||
}
|
||||
}
|
||||
|
||||
private ContainerType<?> cont;
|
||||
PortStorage storage;
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(CompoundNBT nbt) {
|
||||
nbt.put("inv", storage.save(new CompoundNBT()));
|
||||
super.writeCustomNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(BlockState state, CompoundNBT nbt) {
|
||||
super.read(state, nbt);
|
||||
storage.load(nbt.getCompound("inv"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortStorage getStorage() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return new StringTextComponent("Port");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) {
|
||||
return new PortBlockContainer(cont, p_createMenu_1_, p_createMenu_2_, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBreak() {
|
||||
super.onBreak();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateCaps() {
|
||||
this.onBreak();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MMSimpleTransmissionReceiver provideEndpoint(BlockPos blockPos) {
|
||||
return new MMSimpleTransmissionReceiver(blockPos);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AstralMachinePortBlockEntity extends TileSourceBase<SimpleTransmissionSourceNode> implements IMachinePortTile, ConstellationTile {
|
||||
public AstralMachinePortBlockEntity(TileEntityType<?> tileEntityTypeIn, ContainerType<?> cont, PortStorage storage) {
|
||||
public AstralMachinePortBlockEntity(TileEntityType<?> tileEntityTypeIn, ContainerType<?> cont, PortStorage storage) {
|
||||
super(tileEntityTypeIn);
|
||||
this.cont = cont;
|
||||
this.storage = storage;
|
||||
@@ -100,7 +100,7 @@ public class AstralMachinePortBlockEntity extends TileSourceBase<SimpleTransmiss
|
||||
|
||||
@Override
|
||||
public boolean setAttunedConstellation(IWeakConstellation cst) {
|
||||
if (cst != this.constellationType){
|
||||
if (cst != this.constellationType) {
|
||||
markForUpdate();
|
||||
}
|
||||
constellationType = cst;
|
||||
@@ -114,10 +114,27 @@ public class AstralMachinePortBlockEntity extends TileSourceBase<SimpleTransmiss
|
||||
|
||||
@Override
|
||||
public boolean setTraitConstellation(IMinorConstellation tst) {
|
||||
if (tst != this.traitConstellationType){
|
||||
if (tst != this.traitConstellationType) {
|
||||
markForUpdate();
|
||||
}
|
||||
traitConstellationType = tst;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryUnlink(PlayerEntity player, BlockPos other) {
|
||||
boolean i = super.tryUnlink(player, other);
|
||||
markForUpdate();
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBreak() {
|
||||
super.onBreak();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateCaps() {
|
||||
this.onBreak();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ticticboooom.mods.mm.inventory.as;
|
||||
|
||||
import com.ticticboooom.mods.mm.block.tile.AstralMachineInputPortBlockEntity;
|
||||
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
|
||||
import com.ticticboooom.mods.mm.ports.storage.StarlightPortStorage;
|
||||
import hellfirepvp.astralsorcery.common.constellation.IWeakConstellation;
|
||||
import hellfirepvp.astralsorcery.common.starlight.transmission.IPrismTransmissionNode;
|
||||
import hellfirepvp.astralsorcery.common.starlight.transmission.base.SimpleTransmissionReceiver;
|
||||
import hellfirepvp.astralsorcery.common.starlight.transmission.registry.TransmissionProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MMSimpleTransmissionReceiver extends SimpleTransmissionReceiver<AstralMachineInputPortBlockEntity> {
|
||||
|
||||
|
||||
private AstralMachineInputPortBlockEntity astralMachineInputPortBlockEntity;
|
||||
|
||||
public MMSimpleTransmissionReceiver(BlockPos thisPos) {
|
||||
super(thisPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syncTileData(World world, AstralMachineInputPortBlockEntity astralMachineInputPortBlockEntity) {
|
||||
this.astralMachineInputPortBlockEntity = astralMachineInputPortBlockEntity;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<AstralMachineInputPortBlockEntity> getTileClass() {
|
||||
return AstralMachineInputPortBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarlightReceive(World world, IWeakConstellation iWeakConstellation, double v) {
|
||||
AstralMachineInputPortBlockEntity tileAtPos = this.getTileAtPos(world);
|
||||
if (tileAtPos == null){
|
||||
return;
|
||||
}
|
||||
PortStorage storage = tileAtPos.getStorage();
|
||||
if (storage instanceof StarlightPortStorage) {
|
||||
((StarlightPortStorage) storage).getInv().receiveStarlight((int)v, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionProvider getProvider() {
|
||||
return new Provider();
|
||||
}
|
||||
|
||||
public static final class Provider extends TransmissionProvider {
|
||||
|
||||
@Override
|
||||
public IPrismTransmissionNode get() {
|
||||
return new MMSimpleTransmissionReceiver(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import com.ticticboooom.mods.mm.MM;
|
||||
import com.ticticboooom.mods.mm.block.AstralMachinePortBlock;
|
||||
import com.ticticboooom.mods.mm.block.MachinePortBlock;
|
||||
import com.ticticboooom.mods.mm.block.RotationMachinePortBlock;
|
||||
import com.ticticboooom.mods.mm.block.tile.RotationGenMachinePortBlockEntity;
|
||||
|
||||
@@ -6,10 +6,9 @@ import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import com.ticticboooom.mods.mm.MM;
|
||||
import com.ticticboooom.mods.mm.block.AstralMachinePortBlock;
|
||||
import com.ticticboooom.mods.mm.block.MachinePortBlock;
|
||||
import com.ticticboooom.mods.mm.block.tile.AstralMachineInputPortBlockEntity;
|
||||
import com.ticticboooom.mods.mm.block.tile.AstralMachinePortBlockEntity;
|
||||
import com.ticticboooom.mods.mm.block.tile.MachinePortBlockEntity;
|
||||
import com.ticticboooom.mods.mm.ports.state.PortState;
|
||||
import com.ticticboooom.mods.mm.ports.state.StarlightPortState;
|
||||
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
|
||||
@@ -17,7 +16,6 @@ import com.ticticboooom.mods.mm.ports.storage.StarlightPortStorage;
|
||||
import com.ticticboooom.mods.mm.registration.Registerable;
|
||||
import lombok.SneakyThrows;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
@@ -69,16 +67,10 @@ public class StarlightPortParser extends PortFactory {
|
||||
return buf.func_240628_a_(StarlightPortState.CODEC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) {
|
||||
return reg.register(id, () -> new AstralMachinePortBlock(type.get(), name, controllerId, textureOverride, overlay));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegistryObject<TileEntityType<?>> registerTileEntity(String id, DeferredRegister<TileEntityType<?>> reg, Registerable<RegistryObject<TileEntityType<?>>> tile, Registerable<RegistryObject<MachinePortBlock>> block, Registerable<RegistryObject<ContainerType<?>>> containerType, Supplier<PortStorage> portStorage, boolean isInput) {
|
||||
|
||||
if (isInput){
|
||||
return super.registerTileEntity(id, reg, tile, block, containerType, portStorage, isInput);
|
||||
return reg.register(id, () -> TileEntityType.Builder.create(() -> new AstralMachineInputPortBlockEntity(tile.get().get(), containerType.get().get(), portStorage.get()), block.get().get()).build(null));
|
||||
} else {
|
||||
return reg.register(id, () -> TileEntityType.Builder.create(() -> new AstralMachinePortBlockEntity(tile.get().get(), containerType.get().get(), portStorage.get()), block.get().get()).build(null));
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 420 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 402 B |
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 401 B |
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 330 B |
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 329 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 329 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 347 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 329 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 388 B |
@@ -1,2 +1,2 @@
|
||||
#Sat May 29 16:05:26 BST 2021
|
||||
VERSION_CODE=333
|
||||
#Wed Jun 02 14:35:30 BST 2021
|
||||
VERSION_CODE=358
|
||||
|
||||