Skip to content

Commit 8a450e5

Browse files
committed
fixed a bunch of bugs, uses eureka, eureka is currently broken, however
1 parent b3a1a96 commit 8a450e5

47 files changed

Lines changed: 307 additions & 31 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/src/main/java/ace/actually/pirates/Pirates.java

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
import ace.actually.pirates.items.ShipPather;
1212
import ace.actually.pirates.items.ShipPointer;
1313
import ace.actually.pirates.items.TestItem;
14+
import ace.actually.pirates.sound.ModSounds;
1415
import ace.actually.pirates.util.ConfigUtils;
1516
import com.google.common.base.Suppliers;
1617
import dev.architectury.platform.Platform;
18+
import dev.architectury.registry.CreativeTabRegistry;
1719
import dev.architectury.registry.level.entity.EntityAttributeRegistry;
1820
import dev.architectury.registry.registries.DeferredRegister;
1921
import dev.architectury.registry.registries.Registrar;
@@ -23,8 +25,10 @@
2325
import dev.architectury.utils.EnvExecutor;
2426
import net.minecraft.core.registries.BuiltInRegistries;
2527
import net.minecraft.core.registries.Registries;
28+
import net.minecraft.network.chat.Component;
2629
import net.minecraft.resources.ResourceKey;
2730
import net.minecraft.resources.ResourceLocation;
31+
import net.minecraft.sounds.SoundEvent;
2832
import net.minecraft.sounds.SoundEvents;
2933
import net.minecraft.world.entity.EntityType;
3034
import net.minecraft.world.entity.MobCategory;
@@ -55,7 +59,6 @@ public class Pirates {
5559
public static final GameRules.Key<GameRules.BooleanValue> PIRATES_IS_LIVE_WORLD =
5660
GameRules.register("piratesIsLive", GameRules.Category.MISC, GameRules.BooleanValue.create(true));
5761

58-
public static final ResourceKey<CreativeModeTab> PIRATES_ITEM_GROUP_KEY = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.tryBuild(MOD_ID, "item_group"));
5962

6063
public static float baseShotPower;
6164
public static float cannonRange;
@@ -65,7 +68,12 @@ public class Pirates {
6568
public static CompatTracker loadedCompats = new CompatTracker();
6669
private static final SoundType Silent = new SoundType(0, 0, SoundEvents.COD_AMBIENT, SoundEvents.COD_AMBIENT, SoundEvents.COD_AMBIENT, SoundEvents.COD_AMBIENT, SoundEvents.COD_AMBIENT);
6770

68-
71+
public static final DeferredRegister<CreativeModeTab> TABS =
72+
DeferredRegister.create("pirates", Registries.CREATIVE_MODE_TAB);
73+
public static final RegistrySupplier<CreativeModeTab> TAB = TABS.register(
74+
"pirates_tab",
75+
()->CreativeTabRegistry.create(Component.translatable("pirates.tab"),
76+
()->Pirates.CANNONBALL.get().getDefaultInstance()));;
6977

7078
public static void init()
7179
{
@@ -92,7 +100,8 @@ public static void init()
92100
registerBlockEntities();
93101
registerItems();
94102
registerEntities();
95-
103+
registerSounds();
104+
//ModSounds.registerSounds();
96105
//thank you https://github.com/dayofpi/mob-catalog/blob/master/common/src/main/java/com/dayofpi/mobcatalog/MobCatalog.java
97106
//it works without this on fabric by default...
98107
EnvExecutor.runInEnv(Env.CLIENT, () -> PiratesClient::initClientFromMain);
@@ -153,26 +162,35 @@ private static void registerItems()
153162
{
154163
Registrar<Item> items = MANAGER.get().get(Registries.ITEM);
155164

156-
CANNONBALL = items.register(new ResourceLocation("pirates","cannonball"),()->new Item(new Item.Properties()));
157-
FIRE_CANNONBALL = items.register(new ResourceLocation("pirates","fire_cannonball"),()->new Item(new Item.Properties()));
158-
WEIGHTED_CANNONBALL = items.register(new ResourceLocation("pirates","weighted_cannonball"),()->new Item(new Item.Properties()));
159-
CANNONBALL_ENT = items.register(new ResourceLocation("util_pirates","util_1"),()->new Item(new Item.Properties()));
160-
SHIP_POINTER = items.register(new ResourceLocation("pirates","ship_pointer"),()->new ShipPointer(new Item.Properties()));
165+
CANNONBALL = items.register(new ResourceLocation("pirates","cannonball"),()->new Item(new Item.Properties().arch$tab(TAB)));
166+
FIRE_CANNONBALL = items.register(new ResourceLocation("pirates","fire_cannonball"),()->new Item(new Item.Properties().arch$tab(TAB)));
167+
WEIGHTED_CANNONBALL = items.register(new ResourceLocation("pirates","weighted_cannonball"),()->new Item(new Item.Properties().arch$tab(TAB)));
168+
CANNONBALL_ENT = items.register(new ResourceLocation("util_pirates","util_1"),()->new Item(new Item.Properties().arch$tab(TAB)));
169+
SHIP_POINTER = items.register(new ResourceLocation("pirates","ship_pointer"),()->new ShipPointer(new Item.Properties().arch$tab(TAB)));
161170
CANNONEER_ITEM = items.register(new ResourceLocation("pirates","cannoneer"),()->new ContractItem(CANNON_PRIMING_BLOCK.get(),"cannoneer"));
162171
DOCTOR_ITEM = items.register(new ResourceLocation("pirates","doctor"),()-> new ContractItem(Blocks.GOLD_BLOCK,"doctor"));
163-
SHIP_PATHER = items.register(new ResourceLocation("pirates","ship_pather"),()-> new ShipPather(new Item.Properties()));
172+
SHIP_PATHER = items.register(new ResourceLocation("pirates","ship_pather"),()-> new ShipPather(new Item.Properties().arch$tab(TAB)));
173+
174+
items.register(new ResourceLocation("pirates","stable_block"),()->new BlockItem(STABLE_BLOCK.get(),new Item.Properties().arch$tab(TAB)));
164175

165-
items.register(new ResourceLocation("pirates","stable_block"),()->new BlockItem(STABLE_BLOCK.get(),new Item.Properties()));
176+
items.register(new ResourceLocation("pirates","cannon_priming_block"),()->new BlockItem(CANNON_PRIMING_BLOCK.get(),new Item.Properties().arch$tab(TAB)));
166177

167-
items.register(new ResourceLocation("pirates","cannon_priming_block"),()->new BlockItem(CANNON_PRIMING_BLOCK.get(),new Item.Properties()));
178+
TEST_ITEM = items.register(new ResourceLocation("pirates","test"),()->new TestItem(new Item.Properties().arch$tab(TAB)));
168179

169-
TEST_ITEM = items.register(new ResourceLocation("pirates","test"),()->new TestItem(new Item.Properties()));
180+
items.register(new ResourceLocation("pirates","motion_invoking_block"),()->new BlockItem(MOTION_INVOKING_BLOCK.get(),new Item.Properties().arch$tab(TAB)));
181+
items.register(new ResourceLocation("pirates","crew_spawner_block"),()->new BlockItem(CREW_SPAWNER_BLOCK.get(),new Item.Properties().arch$tab(TAB)));
182+
items.register(new ResourceLocation("pirates","ship_id_block"),()->new BlockItem(SHIP_ID_BLOCK.get(),new Item.Properties().arch$tab(TAB)));
183+
184+
}
170185

171-
items.register(new ResourceLocation("pirates","motion_invoking_block"),()->new BlockItem(MOTION_INVOKING_BLOCK.get(),new Item.Properties()));
172-
items.register(new ResourceLocation("pirates","crew_spawner_block"),()->new BlockItem(CREW_SPAWNER_BLOCK.get(),new Item.Properties()));
173-
items.register(new ResourceLocation("pirates","ship_id_block"),()->new BlockItem(SHIP_ID_BLOCK.get(),new Item.Properties()));
174186

175187

188+
public static RegistrySupplier<SoundEvent> CANNONBALL_SHOT;
189+
public static void registerSounds()
190+
{
191+
Registrar<SoundEvent> sounds = MANAGER.get().get(Registries.SOUND_EVENT);
192+
ResourceLocation loc = new ResourceLocation("pirates","cannonball_shot");
193+
CANNONBALL_SHOT = sounds.register(loc,()->SoundEvent.createVariableRangeEvent(loc));
176194
}
177195

178196
public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(MOD_ID, Registries.ENTITY_TYPE);

common/src/main/java/ace/actually/pirates/blocks/DispenserCannonBlock.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,31 @@ public DispenserCannonBlock(Properties settings) {
3333

3434
@Override
3535
protected DispenseItemBehavior getDispenseMethod(ItemStack stack) {
36-
if(stack.getItem() == Pirates.CANNONBALL){
36+
if(stack.getItem() == Pirates.CANNONBALL.get()){
3737
return new CannonDispenserBehavior() {
3838
@Override
3939
protected Projectile createProjectile(Level world, Position position, ItemStack stack) {
40-
ShotEntity qentity = Util.make(new ShotEntity((EntityType<? extends ThrowableItemProjectile>) Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),6,""), (entity) -> {});
40+
ShotEntity qentity = Util.make(new ShotEntity(Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),6,""), (entity) -> {});
4141
qentity.setPos(new Vec3(position.x(),position.y(),position.z()));
4242
return qentity;
4343
}
4444
};
4545
}
46-
if(stack.getItem() == Pirates.FIRE_CANNONBALL){
46+
if(stack.getItem() == Pirates.FIRE_CANNONBALL.get()){
4747
return new CannonDispenserBehavior() {
4848
@Override
4949
protected Projectile createProjectile(Level world, Position position, ItemStack stack) {
50-
ShotEntity qentity = Util.make(new ShotEntity((EntityType<? extends ThrowableItemProjectile>) Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),3,"fire"), (entity) -> {});
50+
ShotEntity qentity = Util.make(new ShotEntity(Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),3,"fire"), (entity) -> {});
5151
qentity.setPos(new Vec3(position.x(),position.y(),position.z()));
5252
return qentity;
5353
}
5454
};
5555
}
56-
if(stack.getItem() == Pirates.WEIGHTED_CANNONBALL){
56+
if(stack.getItem() == Pirates.WEIGHTED_CANNONBALL.get()){
5757
return new CannonDispenserBehavior() {
5858
@Override
5959
protected Projectile createProjectile(Level world, Position position, ItemStack stack) {
60-
ShotEntity qentity = Util.make(new ShotEntity((EntityType<? extends ThrowableItemProjectile>) Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),3,"heavy"), (entity) -> {});
60+
ShotEntity qentity = Util.make(new ShotEntity(Pirates.SHOT_ENTITY_TYPE.get(),world,null,Pirates.CANNONBALL_ENT.get(),3,"heavy"), (entity) -> {});
6161
qentity.setPos(new Vec3(position.x(),position.y(),position.z()));
6262
return qentity;
6363
}

common/src/main/java/ace/actually/pirates/entities/pirate_abstract/AbstractPirateEntity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.minecraft.world.entity.EntityType;
88
import net.minecraft.world.entity.MobSpawnType;
99
import net.minecraft.world.entity.SpawnGroupData;
10+
import net.minecraft.world.entity.ai.goal.FloatGoal;
1011
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
1112
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
1213
import net.minecraft.world.entity.monster.Monster;
@@ -43,9 +44,10 @@ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstanc
4344
@Override
4445
protected void registerGoals() {
4546
super.registerGoals();
46-
this.goalSelector.addGoal(5, new PirateWanderArroundFarGoal(this, 1.0D));
47+
//this.goalSelector.addGoal(5, new PirateWanderArroundFarGoal(this, 1.0D));
4748
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 200.0F));
4849
this.goalSelector.addGoal(6, new RandomLookAroundGoal(this));
50+
this.goalSelector.addGoal(4,new FloatGoal(this));
4951

5052
}
5153

common/src/main/java/ace/actually/pirates/items/ContractItem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ace.actually.pirates.items;
22

3+
import ace.actually.pirates.Pirates;
34
import ace.actually.pirates.entities.friendly_pirate.FriendlyPirateEntity;
45
import ace.actually.pirates.util.DisarmUtils;
56
import net.minecraft.core.BlockPos;
@@ -15,7 +16,7 @@ public class ContractItem extends Item {
1516
Block jobsite;
1617
String jobname;
1718
public ContractItem(Block jobsite, String jobname) {
18-
super(new Properties());
19+
super(new Properties().arch$tab(Pirates.TAB));
1920
this.jobname=jobname;
2021
this.jobsite=jobsite;
2122
}

common/src/main/java/ace/actually/pirates/util/CannonDispenserBehavior.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package ace.actually.pirates.util;
22
import ace.actually.pirates.Pirates;
3-
import ace.actually.pirates.sound.ModSounds;
43
import net.minecraft.core.BlockSource;
54
import net.minecraft.core.Direction;
65
import net.minecraft.core.Position;
@@ -58,7 +57,7 @@ public ItemStack execute(BlockSource pointer, ItemStack stack) {
5857

5958
@Override
6059
protected void playSound(BlockSource pointer) {
61-
pointer.getLevel().playSound(null, pointer.getPos().getX(), pointer.getPos().getY(), pointer.getPos().getZ(), ModSounds.CANNONBALL_SHOT, SoundSource.BLOCKS, 1F, 1F);
60+
pointer.getLevel().playSound(null, pointer.getPos().getX(), pointer.getPos().getY(), pointer.getPos().getZ(), Pirates.CANNONBALL_SHOT.get(), SoundSource.BLOCKS, 1F, 1F);
6261
}
6362

6463

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "pirates:block/heavy_block"
5+
}
6+
}
7+
}

common/src/main/resources/assets/pirates/lang/en_us.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
"text.pirates.target": "The ships target position now is:",
1919
"text.pirates.paths": "The ships path positions are:",
2020
"text.pirates.pather.add": "Added a new position to this ships path!",
21-
"text.pirates.need_mib": "You need to interact with a motion invoking block first!"
21+
"text.pirates.need_mib": "You need to interact with a motion invoking block first!",
22+
23+
"pirates.tab": "Valkyrien Pirates"
2224
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"format_version": "1.9.0",
3+
"credit": "Made with Blockbench",
4+
"textures": {
5+
"0": "block/anvil",
6+
"particle": "block/anvil"
7+
},
8+
"elements": [
9+
{
10+
"from": [0, 1, 1],
11+
"to": [1, 15, 15],
12+
"rotation": {"angle": 0, "axis": "y", "origin": [0, 1, 1]},
13+
"faces": {
14+
"north": {"uv": [1, 0, 2, 14], "texture": "#0"},
15+
"east": {"uv": [0, 0, 14, 14], "texture": "#0"},
16+
"south": {"uv": [0, 0, 1, 14], "texture": "#0"},
17+
"west": {"uv": [0, 0, 14, 14], "texture": "#0"},
18+
"up": {"uv": [0, 0, 1, 14], "texture": "#0"},
19+
"down": {"uv": [0, 0, 1, 14], "texture": "#0"}
20+
}
21+
},
22+
{
23+
"from": [1, 0, 1],
24+
"to": [15, 1, 15],
25+
"rotation": {"angle": 0, "axis": "z", "origin": [15, 0, 1]},
26+
"faces": {
27+
"north": {"uv": [1, 0, 2, 14], "rotation": 90, "texture": "#0"},
28+
"east": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
29+
"south": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
30+
"west": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
31+
"up": {"uv": [2, 0, 16, 14], "rotation": 270, "texture": "#0"},
32+
"down": {"uv": [0, 0, 14, 14], "rotation": 270, "texture": "#0"}
33+
}
34+
},
35+
{
36+
"from": [1, 15, 1],
37+
"to": [15, 16, 15],
38+
"rotation": {"angle": 0, "axis": "z", "origin": [15, 15, 1]},
39+
"faces": {
40+
"north": {"uv": [1, 0, 2, 14], "rotation": 90, "texture": "#0"},
41+
"east": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
42+
"south": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
43+
"west": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
44+
"up": {"uv": [2, 0, 16, 14], "rotation": 270, "texture": "#0"},
45+
"down": {"uv": [0, 0, 14, 14], "rotation": 270, "texture": "#0"}
46+
}
47+
},
48+
{
49+
"from": [15, 1, 1],
50+
"to": [16, 15, 15],
51+
"rotation": {"angle": 0, "axis": "y", "origin": [15, 1, 1]},
52+
"faces": {
53+
"north": {"uv": [1, 0, 2, 14], "texture": "#0"},
54+
"east": {"uv": [0, 0, 14, 14], "texture": "#0"},
55+
"south": {"uv": [0, 0, 1, 14], "texture": "#0"},
56+
"west": {"uv": [0, 0, 14, 14], "texture": "#0"},
57+
"up": {"uv": [0, 0, 1, 14], "texture": "#0"},
58+
"down": {"uv": [0, 0, 1, 14], "texture": "#0"}
59+
}
60+
},
61+
{
62+
"from": [1, 1, 0],
63+
"to": [15, 15, 1],
64+
"rotation": {"angle": 0, "axis": "y", "origin": [1, 1, 1]},
65+
"faces": {
66+
"north": {"uv": [0, 0, 14, 14], "texture": "#0"},
67+
"east": {"uv": [0, 0, 1, 14], "texture": "#0"},
68+
"south": {"uv": [0, 0, 14, 14], "texture": "#0"},
69+
"west": {"uv": [1, 0, 2, 14], "texture": "#0"},
70+
"up": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
71+
"down": {"uv": [0, 0, 1, 14], "rotation": 90, "texture": "#0"}
72+
}
73+
},
74+
{
75+
"from": [1, 1, 15],
76+
"to": [15, 15, 16],
77+
"rotation": {"angle": 0, "axis": "y", "origin": [1, 1, 16]},
78+
"faces": {
79+
"north": {"uv": [0, 0, 14, 14], "texture": "#0"},
80+
"east": {"uv": [0, 0, 1, 14], "texture": "#0"},
81+
"south": {"uv": [0, 0, 14, 14], "texture": "#0"},
82+
"west": {"uv": [1, 0, 2, 14], "texture": "#0"},
83+
"up": {"uv": [0, 0, 1, 14], "rotation": 270, "texture": "#0"},
84+
"down": {"uv": [0, 0, 1, 14], "rotation": 90, "texture": "#0"}
85+
}
86+
}
87+
]
88+
}

common/src/main/resources/data/pirates_sails/structures/ship/anetum-contatum.nbt renamed to common/src/main/resources/data/pirates/datapacks/pirates_sails/structures/ship/anetum-contatum.nbt

File renamed without changes.

common/src/main/resources/data/pirates_sails/structures/ship/antelope.nbt renamed to common/src/main/resources/data/pirates/datapacks/pirates_sails/structures/ship/antelope.nbt

File renamed without changes.

0 commit comments

Comments
 (0)