-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
you can now sit on chairs
- Loading branch information
Showing
3 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/main/java/com/fusionflux/portalcubed/entity/ChairEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
package com.fusionflux.portalcubed.entity; | ||
|
||
import com.fusionflux.portalcubed.util.PortalCubedComponents; | ||
|
||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.PathfinderMob; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class ChairEntity extends CorePhysicsEntity { | ||
public ChairEntity(EntityType<? extends PathfinderMob> type, Level world) { | ||
super(type, world); | ||
} | ||
|
||
@Override | ||
protected InteractionResult physicsEntityInteraction(Player player, InteractionHand hand) { | ||
if (isVehicle() || level().isClientSide()) | ||
return InteractionResult.PASS; | ||
CorePhysicsEntity heldEntity = PortalCubedComponents.HOLDER_COMPONENT.get(player).entityBeingHeld(); | ||
if (heldEntity == this) | ||
return InteractionResult.PASS; | ||
|
||
player.startRiding(this); | ||
return InteractionResult.SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters