Skip to content

Commit

Permalink
3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MORIMORI0317 committed Jan 25, 2023
1 parent 095074b commit aea2c8a
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 17 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Changelog

Changelog to track updates for this mod.
Add your changes to Unreleased if you want to commit.
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
Add your changes to Unreleased if you want to commit.
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Added

- Add living tick event

### Changed

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

### Added

- Add new utility class

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

### Changed

- Port MC1.19.3

### Removed

- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))

### Fixed

- Fixed a problem that crashes without notifying when Architecture is not installed (Forge Only)

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

### Changed

- Port MC1.19.3

### Removed

- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))

[Unreleased]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0...HEAD

[3.3.0]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-beta.1...v3.3.0

[3.3.0-beta.1]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-alpha.1...v3.3.0-beta.1

[3.3.0-alpha.1]: https://github.com/TeamFelnull/OtyacraftEngine/commits/v3.3.0-alpha.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

import dev.architectury.event.Event;
import dev.architectury.event.EventFactory;
import dev.architectury.event.EventResult;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;

public interface MoreEntityEvent {
Event<EntityDefineSynchedData> ENTITY_DEFINE_SYNCHED_DATA = EventFactory.createLoop();
Event<LivingEntityTick> LIVING_ENTITY_TICK = EventFactory.createEventResult();

interface EntityDefineSynchedData {
void onDefineSynchedData(@NotNull Entity entity, @NotNull SynchedEntityData entityData);
}

interface LivingEntityTick {
EventResult livingEntityTick(@NotNull LivingEntity livingEntity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;

public class OECommonEventHooks {
public static void onEntityDefineSynchedData(@NotNull Entity entity, @NotNull SynchedEntityData entityData) {
MoreEntityEvent.ENTITY_DEFINE_SYNCHED_DATA.invoker().onDefineSynchedData(entity, entityData);
}

public static boolean onLivingEntityTick(@NotNull LivingEntity livingEntity) {
var event = MoreEntityEvent.LIVING_ENTITY_TICK.invoker().livingEntityTick(livingEntity);
return event.isEmpty() || event.isTrue();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package dev.felnull.otyacraftengine.fabric.mixin;

import dev.felnull.otyacraftengine.event.OECommonEventHooks;
import dev.felnull.otyacraftengine.item.EquipmentItem;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(LivingEntity.class)
Expand All @@ -19,4 +21,10 @@ private static void getEquipmentSlotForItem(ItemStack itemStack, CallbackInfoRet
cir.setReturnValue(slot);
}
}

@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
private void tick(CallbackInfo ci) {
if (!OECommonEventHooks.onLivingEntityTick((LivingEntity) (Object) this))
ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

import dev.felnull.otyacraftengine.event.OECommonEventHooks;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class CommonHandlerForge {
@SubscribeEvent
public static void onEntityConstructing(EntityEvent.EntityConstructing e) {
OECommonEventHooks.onEntityDefineSynchedData(e.getEntity(), e.getEntity().getEntityData());
}

@SubscribeEvent
public static void onLivingTick(LivingEvent.LivingTickEvent e) {
if (!OECommonEventHooks.onLivingEntityTick(e.getEntity()))
e.setCanceled(true);
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enabled_platforms=fabric,forge
#Mod
archives_base_name=otyacraftengine
mod_display_name=OtyacraftEngine
mod_version=3.3.0
mod_version=3.4.0
#Dependencies
architectury_version=7.0.65
fabric_loader_version=0.14.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.felnull.otyacraftenginetest.block.TestBlocks;
import dev.felnull.otyacraftenginetest.blockentity.TestBlockEntitys;
import dev.felnull.otyacraftenginetest.handler.CommonHandler;
import dev.felnull.otyacraftenginetest.item.TestItems;
import dev.felnull.otyacraftenginetest.server.handler.ServerHandler;

Expand All @@ -13,6 +14,7 @@ public static void init() {
TestBlocks.init();
TestBlockEntitys.init();

CommonHandler.init();
ServerHandler.init();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package dev.felnull.otyacraftenginetest.handler;

import dev.architectury.event.EventResult;
import dev.felnull.otyacraftengine.event.MoreEntityEvent;
import net.minecraft.world.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;

public class CommonHandler {
public static void init() {
MoreEntityEvent.LIVING_ENTITY_TICK.register(CommonHandler::livingEntityTick);
}

private static EventResult livingEntityTick(@NotNull LivingEntity livingEntity) {

/* System.out.println(livingEntity);
if (livingEntity instanceof Villager)
return EventResult.interruptFalse();*/

return EventResult.pass();
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Tags for minecraft:block
// 1.19.3 2023-01-25T23:26:30.4255283 Otyacraft Engine Test/Tags for minecraft:block
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Advancements
// 1.19.3 2023-01-25T23:26:30.4245289 Otyacraft Engine Test/Advancements
24ed8addd22a4702b7c77f0cd605fc53795f19e4 data\otyacraftenginetest\advancements\otyacraftenginetest\root.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Input copy
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Input copy
183e554347c694dd0d75591721b58459636bd6f2 assets\otyacraftenginetest\copy_test\test.json
183e554347c694dd0d75591721b58459636bd6f2 assets\otyacraftenginetest\copy_test\fcoh\ikisugi.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Recipes
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Recipes
afe1da46e75b1ff0ac6ea63110f2748c8aa84b96 data\otyacraftenginetest\recipes\test.json
d1ccb28bcc88e720665ccb40ab3bc54348a05587 data\otyacraftenginetest\advancements\recipes\food\test.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.3 2023-01-25T04:17:51.605033 Otyacraft Engine Test/Model Definitions
// 1.19.3 2023-01-25T23:26:30.4245289 Otyacraft Engine Test/Model Definitions
d40f279d0798e10ef4fe6a50dc7c0c3b22f8f3a2 assets\otyacraftenginetest\models\item\test_item.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// 1.19.3 2023-01-25T04:17:51.6030333 Otyacraft Engine Test/Tags for minecraft:item
// 1.19.3 2023-01-25T23:26:30.4225289 Otyacraft Engine Test/Tags for minecraft:item
7eb508a49db08b3875db67cd0383ae0d7494beb6 data\minecraft\tags\items\boats.json
cfa612cb64f7e213d984ca4431202690f594df8a data\c\tags\items\ender_pearls.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.3 2023-01-25T04:17:51.6040356 Otyacraft Engine Test/Model Process
// 1.19.3 2023-01-25T23:26:30.423527 Otyacraft Engine Test/Model Process
d949ee0f371db9fc9b8bceb58f7d74284b47ade3 assets\otyacraftenginetest\models\item\slide.json
8cb44dd96d67f1401394f517ced825ebc2b7728e assets\otyacraftenginetest\models\item\glock_17.json
b2c02147d1dbbc14042fc6c1a40e7f1072660b5b assets\otyacraftenginetest\models\item\magazine.json

This file was deleted.

0 comments on commit aea2c8a

Please sign in to comment.