Skip to content

Commit

Permalink
Ended the wormhole crash trilogy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragonoidzero committed Mar 10, 2021
1 parent e0b3692 commit 040abfb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.16.5
yarn_mappings=1.16.5+build.5
loader_version=0.11.2
# Mod Properties
mod_version=ALPHA.11
mod_version=ALPHA.13
maven_group=azzy.ttlg
archives_base_name=TTLG
libgui_version=3.3.3+1.16.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class WormholeEntity extends BlockEntity implements Tickable, BlockEntity
private HashMap<Entity, Long> receiverCooldown = new HashMap<>();
private int onTicks;
private final Consumer<Entity> teleporter = entity -> {
if(entity != null) {
if(world != null && entity != null && cachedOut != null) {
cachedOut.notifyAssign(entity);
entity.teleport(out.getX() + 0.5, out.getY() + 2, out.getZ() + 0.5);
if(entity.hasPassengers() && entity.getPassengerList().get(0).getDimensions(EntityPose.STANDING).height > 1f)
Expand Down Expand Up @@ -97,15 +97,18 @@ public void notifyObserver(BlockEntity movedEntity, BlockPos newPos) {
public void notifyMoved(BlockPos newPos) {}

private void getCollidingEntities() {
Box hitbox = new Box(pos.up(), pos.add(1, 3, 1));
world.getEntitiesByType(EntityType.ITEM, hitbox, itemEntity -> itemEntity != null && (!receiverCooldown.containsKey(itemEntity) || receiverCooldown.get(itemEntity) == 0)).forEach( teleporter );
world.getEntitiesByClass(Entity.class, new Box(pos.up(), pos.add(1, 3, 1)), entity -> entity != null&& (!receiverCooldown.containsKey(entity) || receiverCooldown.get(entity) == 0) && entity.getDimensions(EntityPose.STANDING).height <= 1f && !(entity instanceof ItemEntity)).forEach( teleporter );
if(world != null && cachedOut != null && world.isChunkLoaded(cachedOut.pos)) {
Box hitbox = new Box(pos.up(), pos.add(1, 3, 1));
world.getEntitiesByType(EntityType.ITEM, hitbox, itemEntity -> itemEntity != null && (!receiverCooldown.containsKey(itemEntity) || receiverCooldown.get(itemEntity) == 0)).forEach( teleporter );
world.getEntitiesByClass(Entity.class, new Box(pos.up(), pos.add(1, 3, 1)), entity -> entity != null&& (!receiverCooldown.containsKey(entity) || receiverCooldown.get(entity) == 0) && entity.getDimensions(EntityPose.STANDING).height <= 1f && !(entity instanceof ItemEntity)).forEach( teleporter );
}
}

public void notifyAssign(Entity entity) {
receiverCooldown.put(entity, 20L);
}

@SuppressWarnings("unchecked")
public boolean tryAssign(ItemStack stack) {
Optional<Long> pos = (Optional<Long>) DataShardItem.getData(stack, DataShardItem.DataType.POS);
if(pos.isPresent() && pos.get() != 0){
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "lookingglass",
"version": "2.0.0-alpha.11",
"version": "2.0.0-alpha.13",

"name": "Through The Looking Glass",
"description": "Not a mod about glass working",
Expand All @@ -11,7 +11,7 @@
],
"contact": {
"homepage": "https://github.com/Dragonoidzero/Through-the-Looking-Glass",
"sources": ""
"sources": "https://github.com/Dragonoidzero/Through-the-Looking-Glass"
},

"license": "MIT but please no forge thx",
Expand Down

0 comments on commit 040abfb

Please sign in to comment.