-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement, bug: Added missing features to cannon mount blocks
- Added direct item input to Fixed Cannon Mount and Cannon Mount Extension - Added mechanical arm support to Cannon Mount Extension - Also added item input and mechanical arm support to the Yaw Controller - Added cannon contraption info tooltip to Fixed Cannon Mount - Renamed CannonMountMixin to CannonMountBlockEntityMixin on Fabric and Forge - Improved placement of Cannon Mount Extension to prioritize adjacent Cannon Mounts - Added tooltip to Fixed Cannon Mount
- Loading branch information
1 parent
4986909
commit a3478ce
Showing
17 changed files
with
273 additions
and
10 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
32 changes: 32 additions & 0 deletions
32
...n/java/rbasamoyai/createbigcannons/fabric/mixin/CannonMountExtensionBlockEntityMixin.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,32 @@ | ||
package rbasamoyai.createbigcannons.fabric.mixin; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity; | ||
|
||
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.Storage; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.base.SidedStorageBlockEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountExtensionBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.ExtendsCannonMount; | ||
|
||
@Mixin(CannonMountExtensionBlockEntity.class) | ||
public abstract class CannonMountExtensionBlockEntityMixin extends KineticBlockEntity implements ExtendsCannonMount, SidedStorageBlockEntity { | ||
|
||
CannonMountExtensionBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { super(typeIn, pos, state); } | ||
|
||
@Nullable | ||
@Override | ||
public Storage<ItemVariant> getItemStorage(@Nullable Direction face) { | ||
CannonMountBlockEntity mount = this.getCannonMount(); | ||
return mount instanceof SidedStorageBlockEntity transferable ? transferable.getItemStorage(face) : null; | ||
} | ||
|
||
} |
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
35 changes: 35 additions & 0 deletions
35
.../main/java/rbasamoyai/createbigcannons/fabric/mixin/FixedCannonMountBlockEntityMixin.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,35 @@ | ||
package rbasamoyai.createbigcannons.fabric.mixin; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; | ||
|
||
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.Storage; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.base.SidedStorageBlockEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import rbasamoyai.createbigcannons.cannon_control.contraption.PitchOrientedContraptionEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.fixed_cannon_mount.FixedCannonMountBlockEntity; | ||
|
||
@Mixin(FixedCannonMountBlockEntity.class) | ||
public abstract class FixedCannonMountBlockEntityMixin extends SmartBlockEntity implements SidedStorageBlockEntity { | ||
|
||
FixedCannonMountBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { super(typeIn, pos, state); } | ||
|
||
@Shadow | ||
protected PitchOrientedContraptionEntity mountedContraption; | ||
|
||
@Nullable | ||
@Override | ||
public Storage<ItemVariant> getItemStorage(@Nullable Direction face) { | ||
return this.mountedContraption instanceof SidedStorageBlockEntity transferable ? transferable.getItemStorage(face) : null; | ||
} | ||
|
||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...src/main/java/rbasamoyai/createbigcannons/fabric/mixin/YawControllerBlockEntityMixin.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,32 @@ | ||
package rbasamoyai.createbigcannons.fabric.mixin; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity; | ||
|
||
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.Storage; | ||
import net.fabricmc.fabric.api.transfer.v1.storage.base.SidedStorageBlockEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.ExtendsCannonMount; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.YawControllerBlockEntity; | ||
|
||
@Mixin(YawControllerBlockEntity.class) | ||
public abstract class YawControllerBlockEntityMixin extends KineticBlockEntity implements ExtendsCannonMount, SidedStorageBlockEntity { | ||
|
||
YawControllerBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { super(typeIn, pos, state); } | ||
|
||
@Nullable | ||
@Override | ||
public Storage<ItemVariant> getItemStorage(@Nullable Direction face) { | ||
CannonMountBlockEntity mount = this.getCannonMount(); | ||
return mount instanceof SidedStorageBlockEntity transferable ? transferable.getItemStorage(face) : null; | ||
} | ||
|
||
} |
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
34 changes: 34 additions & 0 deletions
34
...in/java/rbasamoyai/createbigcannons/forge/mixin/CannonMountExtensionBlockEntityMixin.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,34 @@ | ||
package rbasamoyai.createbigcannons.forge.mixin; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraftforge.common.capabilities.Capability; | ||
import net.minecraftforge.common.util.LazyOptional; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountExtensionBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.ExtendsCannonMount; | ||
|
||
@Mixin(CannonMountExtensionBlockEntity.class) | ||
public abstract class CannonMountExtensionBlockEntityMixin extends KineticBlockEntity implements ExtendsCannonMount { | ||
|
||
CannonMountExtensionBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { | ||
super(typeIn, pos, state); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { | ||
CannonMountBlockEntity cannonMount = this.getCannonMount(); | ||
return cannonMount == null ? super.getCapability(cap, side) : cannonMount.getCapability(cap, side); | ||
} | ||
|
||
} |
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
40 changes: 40 additions & 0 deletions
40
...c/main/java/rbasamoyai/createbigcannons/forge/mixin/FixedCannonMountBlockEntityMixin.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,40 @@ | ||
package rbasamoyai.createbigcannons.forge.mixin; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; | ||
|
||
import dev.architectury.patchedmixin.staticmixin.spongepowered.asm.mixin.Shadow; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraftforge.common.capabilities.Capability; | ||
import net.minecraftforge.common.capabilities.ForgeCapabilities; | ||
import net.minecraftforge.common.util.LazyOptional; | ||
import rbasamoyai.createbigcannons.cannon_control.contraption.PitchOrientedContraptionEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.fixed_cannon_mount.FixedCannonMountBlockEntity; | ||
|
||
@Mixin(FixedCannonMountBlockEntity.class) | ||
public abstract class FixedCannonMountBlockEntityMixin extends SmartBlockEntity { | ||
|
||
FixedCannonMountBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { | ||
super(typeIn, pos, state); | ||
} | ||
|
||
@Shadow | ||
protected PitchOrientedContraptionEntity mountedContraption; | ||
|
||
@Nonnull | ||
@Override | ||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { | ||
if (cap == ForgeCapabilities.ITEM_HANDLER && this.mountedContraption != null) { | ||
return this.mountedContraption.getCapability(cap, side).cast(); | ||
} | ||
return super.getCapability(cap, side); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
.../src/main/java/rbasamoyai/createbigcannons/forge/mixin/YawControllerBlockEntityMixin.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,34 @@ | ||
package rbasamoyai.createbigcannons.forge.mixin; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraftforge.common.capabilities.Capability; | ||
import net.minecraftforge.common.util.LazyOptional; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountBlockEntity; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.ExtendsCannonMount; | ||
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.YawControllerBlockEntity; | ||
|
||
@Mixin(YawControllerBlockEntity.class) | ||
public abstract class YawControllerBlockEntityMixin extends KineticBlockEntity implements ExtendsCannonMount { | ||
|
||
YawControllerBlockEntityMixin(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) { | ||
super(typeIn, pos, state); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { | ||
CannonMountBlockEntity cannonMount = this.getCannonMount(); | ||
return cannonMount == null ? super.getCapability(cap, side) : cannonMount.getCapability(cap, side); | ||
} | ||
|
||
} |
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
Oops, something went wrong.