1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package me.hammerle.supersnuvi.tiles;
- import me.hammerle.supersnuvi.entity.Entity;
- import me.hammerle.supersnuvi.gamelogic.ILevel;
- import me.hammerle.supersnuvi.util.CollisionBox;
- import me.hammerle.supersnuvi.util.CollisionObject;
- import me.hammerle.supersnuvi.util.Face;
- public class PressureTile extends BaseTile
- {
- public PressureTile(float tMinX, float tMinY, float tMaxX, float tMaxY)
- {
- super(tMinX, tMinY, tMaxX, tMaxY);
- super.setCollisionBox(CollisionBox.createScaledTileBox(0.09375f, 0.90625f, 0.90625f, 1.0f));
- super.setMovementBox(CollisionObject.NULL_BOX);
- }
-
- @Override
- public float getWidth()
- {
- return Tile.SIZE * 0.8125f;
- }
- @Override
- public float getOffsetX()
- {
- return Tile.SIZE * 0.09375f;
- }
- @Override
- public float getHeight()
- {
- return Tile.SIZE * 0.09375f;
- }
- @Override
- public float getOffsetY()
- {
- return Tile.SIZE * 0.90625f;
- }
- @Override
- public boolean shouldAiUseCollisionBox(int x, int y, ILevel l)
- {
- return false;
- }
- @Override
- public void onEntityCollide(Entity ent, int x, int y, Face face, ILevel l)
- {
- if(face == Face.UP)
- {
- l.callEvent("auto_tile_interact", (sc) ->
- {
- sc.setVar("tile_x", (double) x);
- sc.setVar("tile_y", (double) y);
- sc.setVar("entity", ent);
- }, null);
- }
- }
- }
|