@Override public Text translateAction(User user) { int oldTicks = this.oldBlock.as(Diode.class).getDelay(); int newTicks = this.newBlock.as(Diode.class).getDelay(); if (this.hasAttached()) { UseRepeater action = (UseRepeater)this.getAttached().get(this.getAttached().size() - 1); newTicks = action.newBlock.as(Diode.class).getDelay(); } if (oldTicks == newTicks) { return user.getTranslation(POSITIVE, "{user} fiddled around with the repeater but did not change anything", this.player.name); } return user.getTranslation(POSITIVE, "{user} set the repeater to {amount} ticks delay", this.player.name, newTicks); }
@Override @Nullable protected Number[] get(Event e) { MaterialData repeater = block.getSingle(e).getState().getData(); if (repeater instanceof Diode) { return new Number[]{((Diode)repeater).getDelay()}; } return null; }
@Override public void change(Event e, Object[] delta, Changer.ChangeMode mode){ if (mode == ChangeMode.SET) { BlockState state = block.getSingle(e).getState(); MaterialData repeater = state.getData(); if (repeater instanceof Diode) { Number delay = (Number)delta[0]; ((Diode)repeater).setDelay(delay.intValue()); state.setData(repeater); state.update(true); } } }
public Diode() { }
@Deprecated public Diode(int type) { }
public Diode(Material type) { }
@Deprecated public Diode(int type, byte data) { }
@Deprecated public Diode(Material type, byte data) { }
public Diode clone() { return null; }