Skip to content

Commit aea2c8a

Browse files
committed
3.4.0
1 parent 095074b commit aea2c8a

File tree

16 files changed

+74
-17
lines changed

16 files changed

+74
-17
lines changed

CHANGELOG.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Changelog
2+
23
Changelog to track updates for this mod.
3-
Add your changes to Unreleased if you want to commit.
4-
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4+
Add your changes to Unreleased if you want to commit.
5+
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
56

67
## [Unreleased]
78

89
### Added
910

11+
- Add living tick event
12+
1013
### Changed
1114

1215
### Deprecated
@@ -20,28 +23,37 @@ Changelog to track updates for this mod.
2023
## [3.3.0] - 2023-01-24
2124

2225
### Added
26+
2327
- Add new utility class
2428

2529
## [3.3.0-beta.1] - 2023-01-22
2630

2731
### Changed
32+
2833
- Port MC1.19.3
2934

3035
### Removed
36+
3137
- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))
3238

3339
### Fixed
40+
3441
- Fixed a problem that crashes without notifying when Architecture is not installed (Forge Only)
3542

3643
## [3.3.0-alpha.1] - 2023-01-18
3744

3845
### Changed
46+
3947
- Port MC1.19.3
4048

4149
### Removed
50+
4251
- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))
4352

4453
[Unreleased]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0...HEAD
54+
4555
[3.3.0]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-beta.1...v3.3.0
56+
4657
[3.3.0-beta.1]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-alpha.1...v3.3.0-beta.1
58+
4759
[3.3.0-alpha.1]: https://github.com/TeamFelnull/OtyacraftEngine/commits/v3.3.0-alpha.1

common/src/main/java/dev/felnull/otyacraftengine/event/MoreEntityEvent.java

+7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22

33
import dev.architectury.event.Event;
44
import dev.architectury.event.EventFactory;
5+
import dev.architectury.event.EventResult;
56
import net.minecraft.network.syncher.SynchedEntityData;
67
import net.minecraft.world.entity.Entity;
8+
import net.minecraft.world.entity.LivingEntity;
79
import org.jetbrains.annotations.NotNull;
810

911
public interface MoreEntityEvent {
1012
Event<EntityDefineSynchedData> ENTITY_DEFINE_SYNCHED_DATA = EventFactory.createLoop();
13+
Event<LivingEntityTick> LIVING_ENTITY_TICK = EventFactory.createEventResult();
1114

1215
interface EntityDefineSynchedData {
1316
void onDefineSynchedData(@NotNull Entity entity, @NotNull SynchedEntityData entityData);
1417
}
18+
19+
interface LivingEntityTick {
20+
EventResult livingEntityTick(@NotNull LivingEntity livingEntity);
21+
}
1522
}

common/src/main/java/dev/felnull/otyacraftengine/event/OECommonEventHooks.java

+6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
import net.minecraft.network.syncher.SynchedEntityData;
44
import net.minecraft.world.entity.Entity;
5+
import net.minecraft.world.entity.LivingEntity;
56
import org.jetbrains.annotations.NotNull;
67

78
public class OECommonEventHooks {
89
public static void onEntityDefineSynchedData(@NotNull Entity entity, @NotNull SynchedEntityData entityData) {
910
MoreEntityEvent.ENTITY_DEFINE_SYNCHED_DATA.invoker().onDefineSynchedData(entity, entityData);
1011
}
12+
13+
public static boolean onLivingEntityTick(@NotNull LivingEntity livingEntity) {
14+
var event = MoreEntityEvent.LIVING_ENTITY_TICK.invoker().livingEntityTick(livingEntity);
15+
return event.isEmpty() || event.isTrue();
16+
}
1117
}

fabric/src/main/java/dev/felnull/otyacraftengine/fabric/mixin/LivingEntityMixin.java

+8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package dev.felnull.otyacraftengine.fabric.mixin;
22

3+
import dev.felnull.otyacraftengine.event.OECommonEventHooks;
34
import dev.felnull.otyacraftengine.item.EquipmentItem;
45
import net.minecraft.world.entity.EquipmentSlot;
56
import net.minecraft.world.entity.LivingEntity;
67
import net.minecraft.world.item.ItemStack;
78
import org.spongepowered.asm.mixin.Mixin;
89
import org.spongepowered.asm.mixin.injection.At;
910
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1012
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1113

1214
@Mixin(LivingEntity.class)
@@ -19,4 +21,10 @@ private static void getEquipmentSlotForItem(ItemStack itemStack, CallbackInfoRet
1921
cir.setReturnValue(slot);
2022
}
2123
}
24+
25+
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
26+
private void tick(CallbackInfo ci) {
27+
if (!OECommonEventHooks.onLivingEntityTick((LivingEntity) (Object) this))
28+
ci.cancel();
29+
}
2230
}

forge/src/main/java/dev/felnull/otyacraftengine/forge/handler/CommonHandlerForge.java

+7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
import dev.felnull.otyacraftengine.event.OECommonEventHooks;
44
import net.minecraftforge.event.entity.EntityEvent;
5+
import net.minecraftforge.event.entity.living.LivingEvent;
56
import net.minecraftforge.eventbus.api.SubscribeEvent;
67

78
public class CommonHandlerForge {
89
@SubscribeEvent
910
public static void onEntityConstructing(EntityEvent.EntityConstructing e) {
1011
OECommonEventHooks.onEntityDefineSynchedData(e.getEntity(), e.getEntity().getEntityData());
1112
}
13+
14+
@SubscribeEvent
15+
public static void onLivingTick(LivingEvent.LivingTickEvent e) {
16+
if (!OECommonEventHooks.onLivingEntityTick(e.getEntity()))
17+
e.setCanceled(true);
18+
}
1219
}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enabled_platforms=fabric,forge
77
#Mod
88
archives_base_name=otyacraftengine
99
mod_display_name=OtyacraftEngine
10-
mod_version=3.3.0
10+
mod_version=3.4.0
1111
#Dependencies
1212
architectury_version=7.0.65
1313
fabric_loader_version=0.14.11

testmod-common/src/main/java/dev/felnull/otyacraftenginetest/OtyacraftEngineTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import dev.felnull.otyacraftenginetest.block.TestBlocks;
44
import dev.felnull.otyacraftenginetest.blockentity.TestBlockEntitys;
5+
import dev.felnull.otyacraftenginetest.handler.CommonHandler;
56
import dev.felnull.otyacraftenginetest.item.TestItems;
67
import dev.felnull.otyacraftenginetest.server.handler.ServerHandler;
78

@@ -13,6 +14,7 @@ public static void init() {
1314
TestBlocks.init();
1415
TestBlockEntitys.init();
1516

17+
CommonHandler.init();
1618
ServerHandler.init();
1719
}
1820
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package dev.felnull.otyacraftenginetest.handler;
2+
3+
import dev.architectury.event.EventResult;
4+
import dev.felnull.otyacraftengine.event.MoreEntityEvent;
5+
import net.minecraft.world.entity.LivingEntity;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
public class CommonHandler {
9+
public static void init() {
10+
MoreEntityEvent.LIVING_ENTITY_TICK.register(CommonHandler::livingEntityTick);
11+
}
12+
13+
private static EventResult livingEntityTick(@NotNull LivingEntity livingEntity) {
14+
15+
/* System.out.println(livingEntity);
16+
17+
if (livingEntity instanceof Villager)
18+
return EventResult.interruptFalse();*/
19+
20+
return EventResult.pass();
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Tags for minecraft:block
1+
// 1.19.3 2023-01-25T23:26:30.4255283 Otyacraft Engine Test/Tags for minecraft:block
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Advancements
1+
// 1.19.3 2023-01-25T23:26:30.4245289 Otyacraft Engine Test/Advancements
22
24ed8addd22a4702b7c77f0cd605fc53795f19e4 data\otyacraftenginetest\advancements\otyacraftenginetest\root.json
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Input copy
1+
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Input copy
22
183e554347c694dd0d75591721b58459636bd6f2 assets\otyacraftenginetest\copy_test\test.json
33
183e554347c694dd0d75591721b58459636bd6f2 assets\otyacraftenginetest\copy_test\fcoh\ikisugi.json
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Recipes
1+
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Recipes
22
afe1da46e75b1ff0ac6ea63110f2748c8aa84b96 data\otyacraftenginetest\recipes\test.json
33
d1ccb28bcc88e720665ccb40ab3bc54348a05587 data\otyacraftenginetest\advancements\recipes\food\test.json
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Model Definitions
1+
// 1.19.3 2023-01-25T23:26:30.4245289 Otyacraft Engine Test/Model Definitions
22
d40f279d0798e10ef4fe6a50dc7c0c3b22f8f3a2 assets\otyacraftenginetest\models\item\test_item.json
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
// 1.19.3 2023-01-25T04:17:51.6030333 Otyacraft Engine Test/Tags for minecraft:item
1+
// 1.19.3 2023-01-25T23:26:30.4225289 Otyacraft Engine Test/Tags for minecraft:item
22
7eb508a49db08b3875db67cd0383ae0d7494beb6 data\minecraft\tags\items\boats.json
3-
cfa612cb64f7e213d984ca4431202690f594df8a data\c\tags\items\ender_pearls.json
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Model Process
1+
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Model Process
22
d949ee0f371db9fc9b8bceb58f7d74284b47ade3 assets\otyacraftenginetest\models\item\slide.json
33
8cb44dd96d67f1401394f517ced825ebc2b7728e assets\otyacraftenginetest\models\item\glock_17.json
44
b2c02147d1dbbc14042fc6c1a40e7f1072660b5b assets\otyacraftenginetest\models\item\magazine.json

testmod-fabric/src/main/generated/data/c/tags/items/ender_pearls.json

-6
This file was deleted.

0 commit comments

Comments
 (0)