Skip to content

Commit

Permalink
feature: Added Fixed Cannon Mount
Browse files Browse the repository at this point in the history
  • Loading branch information
rbasamoyai committed Dec 27, 2024
1 parent f543d0b commit b4ca1b7
Show file tree
Hide file tree
Showing 46 changed files with 1,928 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Translators-Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Note: Changes to en_us.json before Create Big Cannons 0.5.3.b => 0.5.4 will not
## 5.7.2 → 5.8.0
Additions: \
+ `"block.createbigcannons.cannon_mount_extension": "Cannon Mount Extension"` \
+ `"block.createbigcannons.fixed_cannon_mount": "Fixed Cannon Mount"` \
+ `"createbigcannons.fixed_cannon_mount.angle_pitch": "Pitch Adjustment"` \
+ `"createbigcannons.fixed_cannon_mount.angle_yaw": "Yaw Adjustment"` \
+ `"createbigcannons.ponder.cannon_mount/upside_down_cannon_mounts.header": "Placing Cannon Mounts upside down"` \
+ `"createbigcannons.ponder.cannon_mount/upside_down_cannon_mounts.text_1": "Cannon Mounts can be rotated to face downwards by clicking their sides with a wrench."` \
+ `"createbigcannons.ponder.cannon_mount/upside_down_cannon_mounts.text_2": "Cannon Mounts can also be placed upside-down on the bottom of blocks."` \
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"block.createbigcannons.drop_mortar_shell.tooltip.condition1": "uoıʇɐuoʇǝᗡ uO",
"block.createbigcannons.drop_mortar_shell.tooltip.summary": "‾˙pǝɹıɟ ʎןןɐuoıʇuǝʌuoɔ‾ ǝq osןɐ uɐɔ ʇı ɥbnoɥʇןɐ 'uouuɐɔ bıq ‾ǝdʎʇ-ɹɐʇɹoɯ doɹp ɐ oʇuı buıddoɹp‾ ʎq pǝɹıℲ ˙ǝbɐɯɐp ןɐɹnʇɔnɹʇs ɟo ʇıq ɐ sןɐǝp ʇɐɥʇ ןןǝɥs ‾ǝʌısoןdxǝ‾ ʎʇıʇuǝ-ıʇuɐ ʇɥbıꞀ",
"block.createbigcannons.finished_cannon_cast": "ʇsɐƆ uouuɐƆ pǝɥsıuıℲ",
"block.createbigcannons.fixed_cannon_mount": "ʇunoW uouuɐƆ pǝxıℲ",
"block.createbigcannons.fluid_shell": "ןןǝɥS pınןℲ",
"block.createbigcannons.fluid_shell.tooltip": "ꞀꞀƎHS ᗡI∩ꞀℲ",
"block.createbigcannons.fluid_shell.tooltip.behaviour1": "˙sʇuǝʇuoɔ sʇı sǝsɐǝןǝᴚ",
Expand Down Expand Up @@ -246,6 +247,8 @@
"createbigcannons.display_source.cannon_mount.pitch": "ɥɔʇıԀ uouuɐƆ",
"createbigcannons.display_source.cannon_mount.yaw": "ʍɐʎ uouuɐƆ",
"createbigcannons.display_source.cannon_mount_source": "ʇunoW uouuɐƆ ɯoɹℲ",
"createbigcannons.fixed_cannon_mount.angle_pitch": "ʇuǝɯʇsnظpⱯ ɥɔʇıԀ",
"createbigcannons.fixed_cannon_mount.angle_yaw": "ʇuǝɯʇsnظpⱯ ʍɐʎ",
"createbigcannons.goggles.cannon_mount.autocannon_rate_of_fire": " :ǝɹıℲ ɟo ǝʇɐᴚ uouuɐɔoʇnⱯ",
"createbigcannons.goggles.cannon_mount.autocannon_rate_of_fire.value": "WԀᴚ %s",
"createbigcannons.goggles.cannon_mount.cannon_strength": " :ɥʇbuǝɹʇS uouuɐƆ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"block.createbigcannons.drop_mortar_shell.tooltip.condition1": "On Detonation",
"block.createbigcannons.drop_mortar_shell.tooltip.summary": "Light anti-entity _explosive_ shell that deals a bit of structural damage. Fired by _dropping into a drop mortar-type_ big cannon, although it can also be _conventionally fired._",
"block.createbigcannons.finished_cannon_cast": "Finished Cannon Cast",
"block.createbigcannons.fixed_cannon_mount": "Fixed Cannon Mount",
"block.createbigcannons.fluid_shell": "Fluid Shell",
"block.createbigcannons.fluid_shell.tooltip": "FLUID SHELL",
"block.createbigcannons.fluid_shell.tooltip.behaviour1": "Releases its contents.",
Expand Down Expand Up @@ -246,6 +247,8 @@
"createbigcannons.display_source.cannon_mount.pitch": "Cannon Pitch",
"createbigcannons.display_source.cannon_mount.yaw": "Cannon Yaw",
"createbigcannons.display_source.cannon_mount_source": "From Cannon Mount",
"createbigcannons.fixed_cannon_mount.angle_pitch": "Pitch Adjustment",
"createbigcannons.fixed_cannon_mount.angle_yaw": "Yaw Adjustment",
"createbigcannons.goggles.cannon_mount.autocannon_rate_of_fire": "Autocannon Rate of Fire: ",
"createbigcannons.goggles.cannon_mount.autocannon_rate_of_fire.value": "%s RPM",
"createbigcannons.goggles.cannon_mount.cannon_strength": "Cannon Strength: ",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "createbigcannons:block/cannon_mount/fixed_cannon_mount_north"
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"createbigcannons:cannon_mount",
"createbigcannons:yaw_controller",
"createbigcannons:cannon_mount_extension",
"createbigcannons:fixed_cannon_mount",
"createbigcannons:cannon_carriage",
"createbigcannons:cannon_drill",
"createbigcannons:cannon_builder",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "createbigcannons:fixed_cannon_mount"
}
],
"rolls": 1.0
}
],
"random_sequence": "createbigcannons:blocks/fixed_cannon_mount"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"createbigcannons:cannon_mount",
"createbigcannons:yaw_controller",
"createbigcannons:cannon_mount_extension",
"createbigcannons:fixed_cannon_mount",
"createbigcannons:cannon_carriage",
"createbigcannons:cannon_drill",
"createbigcannons:cannon_drill_bit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"createbigcannons:cannon_mount",
"createbigcannons:yaw_controller",
"createbigcannons:cannon_mount_extension",
"createbigcannons:fixed_cannon_mount",
"createbigcannons:cannon_drill",
"createbigcannons:cannon_drill_bit",
"createbigcannons:cannon_builder",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import rbasamoyai.createbigcannons.cannon_control.cannon_mount.CannonMountBlock;
import rbasamoyai.createbigcannons.cannon_control.carriage.CannonCarriageBlock;
import rbasamoyai.createbigcannons.cannon_control.carriage.CannonCarriageBlockItem;
import rbasamoyai.createbigcannons.cannon_control.fixed_cannon_mount.FixedCannonMountBlock;
import rbasamoyai.createbigcannons.cannon_loading.CannonLoaderGen;
import rbasamoyai.createbigcannons.cannons.autocannon.AutocannonBarrelBlock;
import rbasamoyai.createbigcannons.cannons.autocannon.AutocannonBlock;
Expand Down Expand Up @@ -577,6 +578,21 @@ public static <T extends Block, P> NonNullUnaryOperator<BlockBuilder<T, P>> cann
.build();
}

public static <T extends Block, P> NonNullUnaryOperator<BlockBuilder<T, P>> fixedCannonMount() {
String key = "block/cannon_mount/fixed_cannon_mount_";
return b -> b.properties(p -> p.noOcclusion())
.addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.directionalBlock(c.get(), state -> {
Direction rotation = state.getValue(FixedCannonMountBlock.ROTATION);
ResourceLocation loc = CreateBigCannons.resource(key + rotation.getName());
return p.models().getExistingFile(loc);
}))
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
.item()
.model((c, p) -> p.withExistingParent(c.getName(), CreateBigCannons.resource(key + "north")))
.build();
}

public static <T extends Block, P> NonNullUnaryOperator<BlockBuilder<T, P>> cannonCarriage() {
ResourceLocation blockLoc = CreateBigCannons.resource("block/cannon_carriage/block");
ResourceLocation saddleLoc = CreateBigCannons.resource("block/cannon_carriage/block_saddle");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package rbasamoyai.createbigcannons.fabric.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.simibubi.create.AllKeys;
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsClient;

import me.pepperbell.simplenetworking.C2SPacket;
import me.pepperbell.simplenetworking.SimpleChannel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import rbasamoyai.createbigcannons.cannon_control.fixed_cannon_mount.FixedCannonMountBlockEntity;
import rbasamoyai.createbigcannons.multiloader.NetworkPlatform;
import rbasamoyai.createbigcannons.network.ServerboundSetFixedCannonMountValuePacket;

@Mixin(ValueSettingsClient.class)
public class ValueSettingsClientMixin {

@Shadow public BlockPos interactHeldPos;
@Shadow public InteractionHand interactHeldHand;
@Shadow public Direction interactHeldFace;

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lme/pepperbell/simplenetworking/SimpleChannel;sendToServer(Lme/pepperbell/simplenetworking/C2SPacket;)V"), remap = false)
private void createbigcannons$tick$cancelPacket(SimpleChannel instance, C2SPacket packet, Operation<Void> original,
@Local ValueSettingsBehaviour valueSettingBehaviour) {
if (valueSettingBehaviour instanceof FixedCannonMountBlockEntity.FixedCannonMountScrollValueBehaviour fixedMountBehaviour) {
NetworkPlatform.sendToServer(new ServerboundSetFixedCannonMountValuePacket(this.interactHeldPos, 0, 0,
this.interactHeldHand, this.interactHeldFace, AllKeys.ctrlDown(), fixedMountBehaviour.setsPitch()));
return;
}
original.call(instance, packet);
}

}
3 changes: 2 additions & 1 deletion fabric/src/main/resources/createbigcannons.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"client.GuiMixin",
"client.KeyboardHandlerMixin",
"client.KeyMappingAccessor",
"client.MouseHandlerMixin"
"client.MouseHandlerMixin",
"client.ValueSettingsClientMixin"
],
"mixins": [
"AbstractCannonProjectileMixin",
Expand Down
Loading

0 comments on commit b4ca1b7

Please sign in to comment.