Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loader_version=0.15.10
fabric_kotlin_version=1.10.19+kotlin.1.9.23

# Mod Properties
mod_version=1.1.1
mod_version=1.3.0
maven_group=ace.actually.pirates
archives_base_name=ValkyrienPirates

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/ace/actually/pirates/Pirates.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.world.GameRules;
Expand Down Expand Up @@ -88,11 +91,12 @@ private void registerEntityThings()

}

private static final BlockSoundGroup Silent = new BlockSoundGroup(0, 0, SoundEvents.ENTITY_COD_AMBIENT, SoundEvents.ENTITY_COD_AMBIENT, SoundEvents.ENTITY_COD_AMBIENT, SoundEvents.ENTITY_COD_AMBIENT, SoundEvents.ENTITY_COD_AMBIENT);

public static final MotionInvokingBlock MOTION_INVOKING_BLOCK = new MotionInvokingBlock(AbstractBlock.Settings.copy(Blocks.BIRCH_WOOD).noBlockBreakParticles().hardness(7).dropsNothing());
public static final CannonPrimingBlock CANNON_PRIMING_BLOCK = new CannonPrimingBlock(AbstractBlock.Settings.copy(Blocks.DISPENSER).hardness(5));
public static final DispenserCannonBlock DISPENSER_CANNON_BLOCK = new DispenserCannonBlock(AbstractBlock.Settings.copy(Blocks.DISPENSER).hardness(5));
public static final CrewSpawnerBlock CREW_SPAWNER_BLOCK = new CrewSpawnerBlock(AbstractBlock.Settings.copy(Blocks.BIRCH_WOOD).noBlockBreakParticles().noCollision().dropsNothing());
public static final CrewSpawnerBlock CREW_SPAWNER_BLOCK = new CrewSpawnerBlock(AbstractBlock.Settings.copy(Blocks.BIRCH_WOOD).noBlockBreakParticles().noCollision().dropsNothing().sounds(Silent));
private void registerBlocks()
{
Registry.register(Registries.BLOCK,new Identifier("pirates","cannon_priming_block"),CANNON_PRIMING_BLOCK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private static void stopMotion(World world, BlockPos pos)
if(ship!=null)
{
SeatedControllingPlayer seatedControllingPlayer = ship.getAttachment(SeatedControllingPlayer.class);
if (seatedControllingPlayer == null) return;
seatedControllingPlayer.setLeftImpulse(0);
seatedControllingPlayer.setForwardImpulse(0);
seatedControllingPlayer.setCruise(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.state.property.Properties;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.*;
import net.minecraft.world.GameRules;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.World;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
Expand Down Expand Up @@ -67,7 +68,9 @@ public void fire(World world, BlockPos pos, BlockState state) {
{
cooldownConfig = Integer.parseInt(ConfigUtils.config.getOrDefault("cannon-firing-pause","40"));
}
fire(world, pos, state, cooldownConfig + (int) (Math.random() * 20));
if(world.getGameRules().getBoolean(Pirates.PIRATES_IS_LIVE_WORLD)) {
fire(world, pos, state, cooldownConfig + (int) (Math.random() * 20));
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@ public CannonPrimingBlockEntityRenderer(BlockEntityRendererFactory.Context conte
public void render(CannonPrimingBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (entity.isRemoved()) return;


BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();

BlockState state = Objects.requireNonNull(entity.getWorld()).getBlockState(entity.getPos());

if (state.get(Properties.DISARMED)) return;

BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();

matrices.push();

matrices.translate(0.5, 1.25, 0.5);
// matrices.scale(0.8f, 0.8f, 0.8f);
matrices.translate(0.5, 1.2501, 0.5);

double rotationValue = (state.get(Properties.FACING).asRotation() * PI / 180) + entity.randomRotation + PI / 8;
matrices.multiply(new Quaternionf(cos(rotationValue / 2), 0, sin(rotationValue / 2), 0));
//matrices.multiply(new Quaternionf(0, 0, 1, 0));

matrices.multiply(new Quaternionf(cos(PI / 4), sin(PI / 4), 0, 0));


matrices.translate(-0.5 + 0.1875, -0.25, -0.5);

if (!state.get(Properties.DISARMED)) {
blockRenderManager.renderBlockAsEntity(Blocks.TORCH.getDefaultState(), matrices, vertexConsumers, 255, overlay);
}
blockRenderManager.renderBlockAsEntity(Blocks.TORCH.getDefaultState(), matrices, vertexConsumers, 255, overlay);


matrices.pop();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static void spawnCrew(World world, CrewSpawnerBlockEntity be) {
Entity crew = getEntityFromState(world, be);

if (crew != null) {
crew.setPosition(be.getPos().toCenterPos());
crew.setPosition(be.getPos().toCenterPos().add(0,-0.5,0));
world.spawnEntity(crew);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void setPattern(String loc) {
private void utiliseInternalPattern(SeatedControllingPlayer seatedControllingPlayer, MotionInvokingBlockEntity be) {
String[] instruction = be.instructions.getString(0).split(" ");

if (seatedControllingPlayer == null) return;
switch (instruction[0]) {
case "forward" -> seatedControllingPlayer.setForwardImpulse(Float.parseFloat(instruction[1]));
case "left" -> seatedControllingPlayer.setLeftImpulse(Float.parseFloat(instruction[1]));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ace/actually/pirates/util/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static List<String> makeDefaults()
defaults.add("#general config for Valkyrien Pirates");
defaults.add("cannon-firing-pause=40");
defaults.add("#The max amount of blocks for the new ship builder, set to -1 to use the Eureka/VS version");
defaults.add("max-ship-blocks=5000");
defaults.add("max-ship-blocks=-1");

return defaults;
}
Expand Down
140 changes: 140 additions & 0 deletions src/main/resources/data/pirates/loot_tables/barrels/cannoneer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"type": "minecraft:chest",
"pools": [
{
"rolls": 2,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:stick",
"weight": 3,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 2
}
}
]
},
{
"type": "minecraft:item",
"name": "minecraft:torch",
"weight": 2,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 2
}
}
]
},
{
"type": "minecraft:item",
"name": "minecraft:flint_and_steel",
"weight": 1,
"quality": 2,
"functions": [
{
"function": "minecraft:set_count",
"count": 1
}
]
}
]
},
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:arrow",
"weight": 1,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 16
}
}
]
}
]
},
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:string",
"weight": 1,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 4
}
}
]
}
]
},
{
"rolls": 4,
"bonus_rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:gunpowder",
"weight": 1,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 4
}
}
]
}
]
},
{
"rolls": 4,
"bonus_rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "pirates:cannonball",
"weight": 1,
"quality": 1,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 16
}
}
]
}
]
}
]
}
Loading